Find architechture of installed RPM package

When trying to find a rpm package on a 64 bit installation of Red Hat, you will sometime encounter two packages with the same name:

# rpm -qa zlib
zlib-1.2.1.2-1.2
zlib-1.2.1.2-1.2

This happens when a 32 as well as a 64 bit package exists on the server. If you want to find out which is which, you will have to use a somewhat trickier rpm command:

rpm -qa --qf "%{n}-%{v}-%{r}.%{arch}\n" zlib
zlib-1.2.1.2-1.2.i386
zlib-1.2.1.2-1.2.x86_64

Voila

Howto extend a ext3 filesystem in RHEL5

In RHEL5 ext2online is no longer available. However, do not despair – you can still grow your ext3 filesystems while online: The functionality has been included in resize2fs so to resize a logical volume, start by extending the volume:

# lvextend -L +2G /dev/systemvg/homelv

And the resize the filesystem:

# resize2fs /dev/systemvg/homelv (by omitting the size argument resize2fs defaults to using the available space in the partition/lv)

Expire password in Linux

If you need to force a user to change password at next login, simply use:

# chage -d 0 <userid>

Keep track of failed login attempts

To enable faillog to actually start logging failed login attempts you need to set up PAM to use the module “pam_tally.so”. To configure PAM open the file /etc/pam.d/system-auth in your favourite editor and add the following lines to the file:

auth required pam_tally.so onerr=fail deny=5
account required pam_tally.so

This should make sure that accounts are locked if the number of failed attempts exceeds 5. The counter is reset on successful login.

The behaviour of pam_tally has changed over time – this approach should work on at least Fedora Core 6+, RHEL 5, SLES10 and later.

In SLES 10 the PAM config-file is /etc/pam.d/login

Finding Disk ID on a Raw Device Mapping in ESX

vmkfstools is your friend. In ESX 2.5.x you can use the switch “-P” on the “mapping”-file to show you details of the RDM.

# vmkfstools -P /vmfs/FileSystem1/somemachinesdiskfile-META.vmdk

in VI3 the switch has changed to “–queryrdm” or just “-q” for short.

# vmkfstools -q /vmfs/FileSystem1/somemachinesdiskfile.vmdk

Howto change MTU in Red Hat Linux

In Red Hat Enterprise Linux you can change the MTU (Maximum Transmission Unit) dynamically

# ip link set mtu eth0 512

or using ifconfg

# ifconfig eth0 mtu 512

but to make it permanent even after a reboot you need to add the MTU setting to the correct interface configuration file.

continuing the above examples, that would be:

add


MTU=512

to


/etc/sysconfig/network-scripts/ifcfg-eth0

Qlogic HBA WWN’s in SLES 9/10

If using Qlogic HBAs in SLES 9, the recommended driver is the vendors own driver. In this case wwn's as well as wwpn's could be found by looking in /proc/scsi/qla2xxx
# cat /proc/scsi/qla2xxx/* | grep node

or

# cat /proc/scsi/qla2xxx/* | grep adapter-port

In SLES 10 the native HBA driver is the recommended. You can find WWNs and WWPNs by looking in /sys/class/fc_host or using the systool

# cat /sys/class/fc_host/host?/node_name

or

# systool -c fc_host -A "node_name"

Manifest

This Blog is not really a blog. It is meant as place to write tech stuff that I would otherwise forget. So it’s pretty much a private bulletin board.

On the other hand; If this collection – by any chance – can help somebody “out there”, it would be downright stupid not making it public. With the added bonus that I can access my “memory” from anywhere as long as I’m online (which is pretty much allways).

There’s not much (read: nothing) in this collection yet, but there will be shortly, and it will be a work in constant progress.