Helps and Hints for Unix

In the years I have done Unix system administration (since 1995), I have found that I keep finding myself looking through newsgroups for fixes I discovered long ago. The purpose of these pages is to store these helpful tidbits for future use, and forget about having to research them time and again.

I am hoping you find these hints as helpful as I did.

There is also a separate page for databse help.

General |AIX | HP-UX | Solaris


Dumb unix tricks... you may or may not find a use for:
Creating a dummy file of a specific size
dd if=/dev/zero bs=1k count=(however many 1024 byte blocks you need) > filename

Test network throughput without aggrivation of actual files
ftp> bin
ftp> put "|dd if=/dev/zero bs=32k count=10000" /dev/null

Need error codes?
Find errno.h for a listing.


Unable to read superblock (TERMINATED)
I had a particularly problematic 230 that liked to eat hard drives. This time, I looked into temporarily fixing the issue rather than just replace the drive outright. After all, it was a new drive; I suspect it was some other issue with the external housing that was causing the problem. At any rate, the process for fixing a bad primary superblock:

dd count=1 bs=4k skip=31 seek=1 if=/dev/lvname of=/dev/lvname

This copies the backup superblock over the primary. This is supposed to work for AIX 3.x, but I have used it for AIX 4.x with success. For AIX 4.x, I am told that the correct way is to do:

fsck -p /dev/lvname

How to find out if you are using a 32-bit or 64-bit kernel
Just run the commands:

cd /usr/lib/boot
ls -l unix

If unix is a link to /usr/lib/boot/unix_64 then your kernel is 64 bits.
If unix is a link to /usr/lib/boot/unix_mp then your kernel is 32 bits.

How to tell what Maintenance Level your system is on.

oslevel -r

The numbers after the - will be the level. OR...

instfix -i | grep AIX_ML

will list the ML packs installed.


Rebuilding volume groups missing physical volumes
I had an array where a disk in a RAID-0 group went bad on our Model 20 (yes, I am aware that RAID-0 is not fault-tolerant... but there were specific reasons for this). I found out that it had failed because I no longer could access the filesystems I was loading a cold backup from oracle on. Well, to make a long story short, in rebuilding the volume group I found I could not remove lvols or vgs due to the missing physical volume. The trick here is to rebuild /etc/lvmtab, and this is how:

# mv /etc/lvmtab /etc/lvmtab.old
# vgscan -a -v
# vgchange -a y

I also found that it still thought it had the logical volumes originally associated with it. Well, you need to manually clear these out since they no longer are in the LVMREC by:

# rm /dev/<vgroupname>/<lvolname>


A quick way to mount/unmount a floppy
This has got to be one of the fastest/easiest ways to do this... Put the floppy in, and type volcheck; it mounts the floppy automatically. Remove the floppy and do the same... voila, it's gone!

Email | Computer Home | Home