Friday, November 18, 2011

HPUX: Mirroring boot disks

PA-RISC Mirroring procedures

  1. Use ioscan to identify a suitable alternate boot disk. The disk should be about the same size as the primary boot disk and, preferably, on a separate I/O channel. When I do this, I typically set up variables for the character and block devices. The example commands that follow use that syntax.
  2. Create the boot partitions on the disk. The args to ignore quorum are used on the hpux command. If you're booting off of the alternate boot disk, there's a better than even chance your primary isn't there anymore...
    1. pvcreate -B ${rdsk}
    2. mkboot ${rdsk}
    3. mkboot -a "hpux -lq" ${rdsk}
  3. Add the disk to vg00 - or where ever your OS is
    vgextend vg00 ${dsk}
  4. Extend the logical volumes. I typically use an inline function for this:
    for lv in $(vgdisplay -v vg00 | grep -i 'lv name' | awk '{print $NF}')
    do
        echo "#################################"
        echo ${lv}
        lvextend -m 1 ${lv} ${dsk}
    done

    NOTE: Each of the lvs can take awhile particularly if they're sizeable. I will usually create a function in another window that tells me how many logical extents are stale. Rerunning the function will hopefully show a decreasing number of extents.
    hm()
    {  lvdisplay -v $1 | sed -n -e '/Logical extents/,$p' | grep stale | wc -l
    }
    
  5. Verification:
    1. Use setboot to verify the alternate boot or HA alternate boot, as appropriate, is set:
      # setboot
      Primary bootpath : 0/1/1/0.1.0
      HA Alternate bootpath : 0/1/1/0.0.0
      Alternate bootpath : 0/1/1/0.1.0
      
      Autoboot is ON (enabled)
      
    2. Use lvlnboot to verify the alternate boot disk is configured. Use lvlnboot -R /dev/vg00 to update.
      # lvlnboot -v vg00
      Boot Definitions for Volume Group /dev/vg00:
      Physical Volumes belonging in Root Volume Group:
              /dev/dsk/c2t1d0s2 (0/1/1/0.1.0) -- Boot Disk
              /dev/dsk/c2t0d0s2 (0/1/1/0.0.0) -- Boot Disk
      Boot: lvol1     on:     /dev/dsk/c2t1d0s2
                              /dev/dsk/c2t0d0s2
      Root: lvol3     on:     /dev/dsk/c2t1d0s2
                              /dev/dsk/c2t0d0s2
      Swap: lvol2     on:     /dev/dsk/c2t1d0s2
                              /dev/dsk/c2t0d0s2
      Dump: lvol2     on:     /dev/dsk/c2t1d0s2, 0
      

Itanium mirroring procedure

As stated previously, the ia64 mirroring procedure is quite different. Using the old disk naming schemes, you will end up creating disk partitions, ${rdsk}s2, for instance. The new naming conventions create partitions named /dev/rdisk/disk#_p#. The directions below demonstrate the legacy naming convention. The commands are the same for the new naming convention.
  1. Use ioscan to identify a suitable alternate boot disk. The disk should be about the same size as the primary boot disk and, preferably, on a separate I/O channel. When I do this, I typically set up variables for the character and block devices. The example commands that follow use that syntax.
  2. Create the boot partition on the disk and generate the partition device files:
    1. Create the partition template:
       cat > /tmp/part << eof
      > 3
      > EFI 500MB
      > HPUX 100%
      > HPSP 400MB
      > eof
      
    2. idisk -f /tmp/part -w ${rdsk}
    3. Verify the partitions: idisk ${rdsk}
    4. Create the device files: insf -eH ${hw_path}
  3. Create and populate the boot partitions:
    1. pvcreate -B ${rdsk}s2 NOTE: the s2 partition
    2. mkboot -e -l ${rdsk}
    3. mkboot -a "boot vmunix -lq" ${dsk} NOTE: *not* rdsk
  4. vgextend vg00 ${dsk}s2 #note the s2 partition again
  5. Extend the logical volumes. I typically use an inline function for this:
    for lv in $(vgdisplay -v vg00 | grep -i 'lv name' | awk '{print $NF}')
    do
        echo "#################################"
        echo ${lv}
        lvextend -m 1 ${lv} ${dsk}s2 # note the s2 partition again
    done

    NOTE: Each of the lvs can take awhile particularly if they're sizeable. I will usually create a function in another window that tells me how many logical extents are stale. Rerunning the function will hopefully show a decreasing number of extents.
    hm()
    {  lvdisplay -v $1 | sed -n -e '/Logical extents/,$p' | grep stale | wc -l
    }
    
  6. Verification:
    1. Use setboot to verify the alternate boot or HA alternate boot, as appropriate, is set:
      # setboot
      Primary bootpath : 0/1/1/0.1.0
      HA Alternate bootpath : 0/1/1/0.0.0
      Alternate bootpath : 0/1/1/0.1.0
      
      Autoboot is ON (enabled)
      
    2. Use lvlnboot to verify the alternate boot disk is configured. Use lvlnboot -R vg00 to update.
      # lvlnboot -v vg00
      Boot Definitions for Volume Group /dev/vg00:
      Physical Volumes belonging in Root Volume Group:
              /dev/dsk/c2t1d0s2 (0/1/1/0.1.0) -- Boot Disk
              /dev/dsk/c2t0d0s2 (0/1/1/0.0.0) -- Boot Disk
      Boot: lvol1     on:     /dev/dsk/c2t1d0s2
                              /dev/dsk/c2t0d0s2
      Root: lvol3     on:     /dev/dsk/c2t1d0s2
                              /dev/dsk/c2t0d0s2
      Swap: lvol2     on:     /dev/dsk/c2t1d0s2
                              /dev/dsk/c2t0d0s2
      Dump: lvol2     on:     /dev/dsk/c2t1d0s2, 0
      
  7. Update the boot loaderThis part is still a bit confusing for me. The alternate boot option in the efi boot menu points to the right disk; however, it doesn't know about the hpux.efi boot command so it doesn't work. You'd figure HP would make that a bit more automatic.
    So, note the hardware paths for the primary and alternate disks, then boot to the efi menu. Boot configuration -> Add a boot option,
    Identify your new mirror disk. when it says (pun1,lun0), that's going to be c#t1d0, (pun0,lun) will be c#t0d0, etc. Highlight the suspected mirror disk and press [enter]
    Assuming you got the right disk, you should be looking at something that looks like an old norton commander menu. Highlight EFI, press [enter], then highlight HPUX, press [enter], and finally, hpux.efi and (you guessed it), press [enter]. Enter a good description for the mirror disk.
    If you want, move the mirror disk entry to the top using the other options in the boot options menu. Once done, select the mirror disk entry to attempt to boot from it.
    Troubleshoot as necessary
Taken from: 
URL:http://olearycomputers.com/ll/hpux_mirror.html