HP-UX Mirror Root Volume Group Script

Many companies utilizing the HP-UX operating system use Mirrordisk/UX to software mirror the operating system to an alternate boot drive.  Below is a script using HP-UX agile device special files that can be modified for your specific implementation to use Mirrordisk to mirror the root volume group which by default is vg00.    The first script is for the Itanium IA64 CPU architecture.  You just have to modify the DISK1 variable, and the last line that specifies the hardware path to the alternate boot drive to which you are mirroring the OS.

 

#!/usr/bin/ksh
DISK1=disk1626

#Create the partition map file for idisk
echo "3" > /tmp/partitionfile
echo "EFI 500MB" >> /tmp/partitionfile
echo "HPUX 100%" >> /tmp/partitionfile
echo "HPSP 400MB" >> /tmp/partitionfile

#Partition the drive, rescan disk devices, and install disk special device files to recognize the new partitions
idisk -q -wf /tmp/partitionfile /dev/rdisk/"$DISK1"
ioscan -fnNC disk > /dev/null 2>&1
insf -e -C disk > /dev/null 2>&1

#Make the disk bootable, list the efi file system, and ensure the LIF file is in partition 2
mkboot -e -l /dev/rdisk/"$DISK1"
efi_ls -d /dev/rdisk/"$DISK1"_p1
lifls -l /dev/rdisk/"$DISK1"_p2

#Create the AUTO file so the OS boots even with lost quorum, and validate the contents of the autoexecute file
mkboot -a "boot vmunix -lq" /dev/disk/"$DISK1"
efi_cp -d /dev/rdisk/"$DISK1"_p1 -u /EFI/HPUX/AUTO /tmp/x; cat /tmp/x;rm /tmp/x

#Write LVM metadata to the physical volume partition 2
pvcreate -f -B /dev/rdisk/"$DISK1"_p2

#Extend the root volume group to the new disk
vgextend /dev/vg00 /dev/disk/"$DISK1"_p2

#Extend the logical volumes onto the alternate drive
lvextend -m 1 /dev/vg00/lvol1 /dev/disk/"$DISK1"_p2
lvextend -m 1 /dev/vg00/lvol2 /dev/disk/"$DISK1"_p2
lvextend -m 1 /dev/vg00/lvol3 /dev/disk/"$DISK1"_p2
lvextend -m 1 /dev/vg00/lvol4 /dev/disk/"$DISK1"_p2
lvextend -m 1 /dev/vg00/lvol5 /dev/disk/"$DISK1"_p2
lvextend -m 1 /dev/vg00/lvol6 /dev/disk/"$DISK1"_p2
lvextend -m 1 /dev/vg00/lvol7 /dev/disk/"$DISK1"_p2
lvextend -m 1 /dev/vg00/lvol8 /dev/disk/"$DISK1"_p2

#Set the root, boot, swap, and dump devices
lvlnboot -r /dev/vg00/lvol3
lvlnboot -b /dev/vg00/lvol1
lvlnboot -s /dev/vg00/lvol2
lvlnboot -d /dev/vg00/lvol2
lvlnboot -R
lvlnboot -v
setboot

#Set the hardware path to the alternate boot device
setboot -a 1/0/0/2/0.6.0

 

Here is an example of an older version of the script for the PA-RISC CPU architecture. In this example we were mirroring the OS to SAN storage, and there were multiple paths to the disk. This version uses the HP-UX legacy device special files and adds in each path separately in the multi-path environment.

 

#!/usr/bin/ksh
DISK1=c9t13d4
ALT11=c10t13d4
ALT12=c12t13d4
ALT13=c14t13d4

#Write LVM metadata to the physical volume
pvcreate -f -B /dev/rdsk/$DISK1

#Make the disk bootable, and create the AUTO file so the OS boots even with lost quorum
mkboot /dev/rdsk/$DISK1
mkboot -a "hpux -lq (;0)/stand/vmunix" /dev/rdsk/$DISK1

#Extend the root volume group to the new disk
vgextend /dev/vg00 /dev/dsk/$DISK1 /dev/dsk/$ALT11 /dev/dsk/$ALT12 /dev/dsk/$ALT13

#Extend the logical volumes onto the alternate drive
lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/$DISK1
lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/$DISK1
lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/$DISK1
lvextend -m 1 /dev/vg00/lvol4 /dev/dsk/$DISK1
lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/$DISK1
lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/$DISK1
lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/$DISK1
lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/$DISK1

#Set the root, boot, swap, and dump devices
lvlnboot -r /dev/vg00/lvol3
lvlnboot -b /dev/vg00/lvol1
lvlnboot -s /dev/vg00/lvol2
lvlnboot -d /dev/vg00/lvol2
lvlnboot -R
lvlnboot -v
setboot
setboot -a 0/0/10/0/0.238.19.0.0.13.4

One Response to “HP-UX Mirror Root Volume Group Script”

  1. Fabio says:

    In Linux, the above steps are really heulpfl to create new partition. One must need to know about these codes and commands. But, in Mac there are so many third party applications to modify Mac partitions.I have used Stellar Partition manager software to add new partition and resize the the existing one.

Leave a Reply

Current ye@r *

  • Computer problems?

    We can help! Check out this eBook outlining the top 7 ways an outsourced managed IT service plan can help you and your business.

    Download Here

  • Time to Go Virtual

    Here at Helixstorm we can save you thousands of dollars on your equipment, energy bills, and maintenance.

    Find Out How

  • Reduce Downtime

    If there's a fire, earthquake, flood, or storm, how soon will your data be up and running? If you don't have a disaster recovery plan, you need to talk to us.

    Request Info