Thursday, April 24, 2008

HPUX mirror root disk

The /etc/fstab before mirroring is:
/dev/vg00/lvol3 / vxfs delaylog 0 1
/dev/vg00/lvol1 /stand hfs defaults 0 1
/dev/vg00/lvol4 /tmp vxfs delaylog 0 2
/dev/vg00/lvol5 /lhome vxfs delaylog 0 2
/dev/vg00/lvol6 /opt vxfs delaylog 0 2
/dev/vg00/lvol7 /usr vxfs delaylog 0 2
/dev/vg00/lvol8 /var vxfs delaylog 0 2

ioscan -funC disk
pvdisplay /dev/dsk/c1t2d0 # get lvm info of existing disk.
pvdisplay /dev/dsk/c2t2d0 # get err, no lvm def on it, raw disk.

pvcreate -B /dev/rdsk/c2t2d0 # add physical disk to be used by LVM
vgextend /dev/vg00 /dev/dsk/c2t2d0 # incorporate new disk to existing vg00

# do some checking
strings /etc/lvmtab # see new disk used by lvm
lifls /dev/rdsk/c1t2d0 # see lot of boot util
lifls /dev/rdsk/c2t2d0 # no boot util, add next...

mkboot /dev/rdsk/c2t2d0 #
mkboot -a "hpux -lq" /dev/rdsk/c2t2d0 # SECONDARY disk, add AUTO, low quorum
mkboot -a "hpux -lq" /dev/rdsk/c1t2d0 # PRIMARY disk, low quorum (??)

lifls /dev/rdsk/c2t2d0 # see boot util, but not as extensive
# as primary disk. It is ok.

###
### The next steps will actually perform the mirror,
### and it will fail if -m mirroring option is not activated with valid license
###

lvextend -m 1 /dev/vg00/lvol1 /dev/dsk/c2t2d0 # add mirror for lvol1=/stand
lvextend -m 1 /dev/vg00/lvol2 /dev/dsk/c2t2d0 # add mirror for lvol2=/ (root)
lvextend -m 1 /dev/vg00/lvol3 /dev/dsk/c2t2d0 # add mirror for lvol3=(swap)
# Repeat for all lvolX...
lvextend -m 1 /dev/vg00/lvol8 /dev/dsk/c2t2d0 # add mirror for lvol8=(/var)
lvextend -m 1 /dev/vg00/lvol7 /dev/dsk/c2t2d0 # add mirror for lvol7=(/usr)
lvextend -m 1 /dev/vg00/lvol6 /dev/dsk/c2t2d0 # add mirror for lvol6=(/opt)
lvextend -m 1 /dev/vg00/lvol5 /dev/dsk/c2t2d0 # add mirror for lvol5=(/lhome)
lvextend -m 1 /dev/vg00/lvol4 /dev/dsk/c2t2d0 # add mirror for lvol4=(/tmp)

setboot # check current PDC bootpath
setboot -a 0/0/2/0.2.0 # set PDC> BO SEC (if needed)

###
### To undo the mirroring prep work:
###

vgreduce /dev/vg00 /dev/dsk/c2t2d0
pvremove /dev/rdsk/c2t2d0

###
### Replacing a mirror disk 149
###

vgcfgrestore -n /dev/vgXX /dev/rdsk/c... # vol grp conf restore
vgchange -a y /dev/vgXX # change vol grp to avai
lable (-a y)
vgsync /dev/vgXX # resync logical vol in
vol grp.

###
### Replace mirrored disk boot disk
### In addition to normal mirror disk replacements steps above,
### add:
###

mkboot /dev/rdsk/c.t...
mkboot -a "hpux lq" /dev/rdsk/c...

reboot # vgcfgbackup is run automatically on reboot