Thursday, October 30, 2008

LVM's Roots - Mirroring Your Boot Disk On HP-UX 10 Unix

Hey There,

If you read this blog every once in a while (or if you just happen to have ever searched for - or queried the tag named - LVM in our growing library of questionably-valuable articles ;) you've probably noted that, although mentioned in passing, none of them has ever dealt directly with HP-UX. AIX and, of course, Linux have received their fair share of attention. Even Solaris Volume Manager (or, if you still prefer it, Solstice Disk Suite) and Veritas Volume Manager have been covered in some detail with reference to their similarity to LVM. It's about time that HP-UX (arguably one of the mothers of LVM (or LVM2) as we know it today) should get some sort of treatment. This blog is, after all, dedicated to Linux and Unix (both terms being purposefully generic so we can write about whatever *nix machines we can get our hands on :)

Today's entry is a bit of a quick introduction to HP's Logical Volume Manager and was written specifically for an HP-UX 10.x box. We haven't specifically tested this against 11.x or 11i, but, from our experience working with both, this script should work with little-or-no modification on 11.x. Now that we've got a few HP servers to have fun with (I mean... work really hard on ;), we'll give HP-UX it's due and run through the essentials of LVM. We'll try to make it as short and sweet as possible, while not skimming over the basics, so that the posts themselves can serve as a decent reference for a straight-up HP-UX user. Actually, if you're an HP-UX user (Experience here ranges from 9.x through 11i - Old 800 series K class towers ( with matching WYSE terminals) to SuperDomes and some of the newer 9000 series), you're also well familiar with the huge differences in the basic functionality between versions of the OS and the ISL and GSP/BCH underpinnings (which you could, somewhat, liken to a difference between the Domain Console/System Controller setup on the big Sun 3800 through 25k servers and the newer XCP/XSCF setup on the Mx000 series).

Until that day, here's a little script to help mirror your root disks on HP-UX 10. This was actually tested and used on a K100 Server (Refurbished, of course, but smokin' fast with 4 100 MHz CPU's. Actually, pretty decent once it boots up okay :)

Cheers,


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License

#!/bin/sh

#
# hpmirrordisk.sh - Double check this before you run it. Seriously :)
#
# 2008 - Mike Golvach - eggi@comcast.net
#
# Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
#

echo "You have installed the MirrorDisk-HPUX Product already, right?"
echo "If you still need to, hit ctl-C and quit running this script!"
read oblig
echo
echo "This should show only one bootable disk to start out..."
echo
lvlnboot -v
echo
echo "New bootable physical volume name [c?t?d?]"
echo
read disk
pvcreate -B /dev/rdsk/$disk
echo
echo "Volume group you'll be mirroring [vg??]"
echo
read vgroup
vgextend /dev/$vgroup /dev/dsk/$disk
echo
echo "Making Mirror Disk Bootable..."
echo
mkboot /dev/rdsk/$disk
mkboot -a "hpux -lq (;0)/stand/vmunix" /dev/dsk/$disk
echo
echo "This result output should give you back \"hpux -lq (;0)/stand/vmunix\""
echo
lifcp /dev/rdsk/${disk}:AUTO -
echo
echo "Return to continue"
echo
read oblig
echo
echo "Extending all logical volumes..."
echo
for x in 1 2 3 4 5 6 7 8 9
do
/usr/sbin/lvextend -m 1 /dev/${vgroup}/lvol$x /dev/dsk/$disk
done
echo
echo "This should show two bootable disks now..."
echo
lvlnboot -v
echo
echo "Okay? Hit return"
echo
read oblig
echo
echo "For these tests, the Physical Extents should map to the"
echo "Logical Extents for each logical volume."
echo
for x in 1 2 3 4 5 6 7 8 9
do
echo
echo "lvol$x"
echo
lvdisplay -v /dev/${vgroup}/lvol$x |sed -n '/Distribution/,/Logical/p'|sed '$d'
echo
echo "Okay? Hit return"
echo
read oblig
done

echo
echo "All you need to do now is reboot and be sure to halt the"
echo "system at the boot menu. Make sure the Primary Boot Path"
echo "is set to the mirrored disk. If not, you will have to set"
echo "the correct path in the COnfiguration menu. Also, under the"
echo "COnfiguration menu, set Auto Search equal to ON."
echo "Finally, be sure to set the Alternate Boot Path to the"
echo "original disk"
echo


, Mike




Please note that this blog accepts comments via email only. See our Mission And Policy Statement for further details.