Mirroring the Root File System and Primary Swap

By using mirror copies of the root or primary swap logical volumes on another disk, you will be able to use the copies to keep your system in operation, if either of these logical volumes fail.

To mirror the root file system, you must first add a bootable LVM disk:

Create a physical volume using pvcreate with the -Bf option:

pvcreate -Bf /dev/rdsk/c0t3d0

Add the physical volume to your existing root volume group with vgextend:

vgextend /dev/vg00 /dev/dsk/c0t3d0

Use mkboot (1M) to place boot utilities in the boot area:

mkboot /dev/rdsk/c0t3d0

Use mkboot -a to add an AUTO file in boot LIF area:

mkboot -a "hpux (;0)/stand/vmunix" /dev/rdsk/c0t3d0

Or, use the -lq option to allow your system to boot in the event that one of your disks is unavailable, resulting in a loss of quorum.

mkboot -a "hpux -lq /stand/vmunix" /dev/rdsk/c0t3d0

This example includes creating a mirror copy of the primary swap logical volume. The primary swap mirror does not need to be on a specific disk or at a specific location, but it does need to be allocated on contiguous disk space. The recommended mirror policy for primary swap is to have the Mirror Write Cache and the Mirror Consistency Recovery mechanisms disabled.

When primary swap is mirrored and your primary swap device also serves as a dump area, you must make sure that Mirror Write Cache and Mirror Consistency Recovery is set to off at boot time to avoid loss of your dump. To reset these options, you will need to reboot your system in maintenance mode. Then use the lvchange command with the -M n and -c n options.

Mirror the root logical volume to the above disk:

lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c0t3d0

Mirror the primary swap logical volume:

lvextend -m 1 /dev/vg00/prswaplv /dev/dsk/c0t3d0

Verify that the boot information contained in the BDRA of the boot disks in the root volume group has been automatically updated by lvlnboot (1M) with the locations of the mirror copies of root and primary swap:

lvlnboot -v

Once you have created mirror copies of the root logical volume and the primary swap logical volume, should either of the disks fail, the system can use the copy of root or of primary swap on the other disk and continue. When the failed disk comes back online, it will be automatically recovered, provided the system has not been rebooted.

If the system is rebooted before the disk is back online, you will need to reactivate the disk and update the LVM data structures that track the disks within the volume group. You can use vgchange -a y even though the volume group is already active.

For example, you can reactivate the disk using:

vgchange -a y /dev/vg00

As a result, LVM scans and activates all available disks in the volume group, vg00, including the disk that came online after the system rebooted.

Leave a Reply