Committing superseded, but corrupt patches

In the course of installing HPUX patches, I usually make a point of committing patches that have been superseded at least once by running:

# cleanup -c 1

While running this on a few machines, I’ve seen error messages similar to this:

ERROR: swmodify(1M) encountered problems committing the superseded patches:

ERROR: Could not select the software "PHCO_27020.*". This software is in a corrupt state and is not available for selection. Corrupt software can be removed with the swremove command, or replaced with the swcopy command.

We can get around this by forcing the patch to be marked as configured and superseded. Using the patch listed in the above example, do this:

# swmodify -a state=configured -a patch_state=superseded PHCO_27020.*

Once that is done, cleanup will no longer complain and will finish successfully.


Display numeric file permissions

I was *really* hoping ls would have a flag to show file permissions in octal, but it doesn’t.

However, there is another way!

$ stat -c "%a %n" *

This will list all of the files in the current directory along with their numeric permissions.

For example, this -rw-rw-r-- turns into this 664.

Tested on RHEL5 and Fedora 4.

Rescan SCSI bus for new disks

This will rescan a SCSI bus on a RHEL machine to search for new disks:

# echo "- - -" > /sys/class/scsi_host/hostX/scan

where X is the SCSI bus number.

If you are using Emulex HBAs, there is a nice little wrapper script that comes with the drivers:

# /usr/sbin/lpfc/lun_scan

AIX/HP-UX Interoperability Guide

It’s kind of old, but a lot of the information appears to be still valid.

AIX/HP-UX Interoperability Guide

resize2fs vs ext2online

Before RHEL5, there were two commands that could be used to resize ext2 or ext3 filesystems: resize2fs and ext2online.

resize2fs can be used to both grow or shrink a filesystem; however, the filesystem must be unmounted.

ext2online can be used only to grow a filesystem, but works on mounted filesystems.

As of RHEL5, online growing has been added to resize2fs and ext2online has been removed.