Here’s a way to replace root disk on HP-UX
we are using Integrity (Itanium) 11.31 – Persistent DSF
1. Save hardware paths information of the disk (printout or file).
#ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
# ioscan -m hwpath -H 64000/0xfa00/0x4
Lun H/W Path Lunpath H/W Path Legacy H/W Path
====================================================================
64000/0xfa00/0x1b
1/0/0/2/0.0×6.0x0 1/0/0/2/0.6.0
Notes:
When the failed disk is replaced, a new LUN instance and LUN hardware path will be created. To identified the disk once is replaced, you must use the lunpath hardware path (1/0/0/2/0.0×6.0x0).
If the server is rebooted to execute the change, only the new LUN instance will be show. The old LUN will disappear from the ioscan output. Keep the output of the previous commands in a secure place.
2. Detach the physical volume from the volume group.
pvchange -a n /dev/disk/disk2_p2
3. Hot swap the disk.
4. Notify the mass storage subsystem that the disk has been replaced.
# scsimgr replace_wwid -D /dev/rdisk/disk2
Note:
This command allows the storage subsystem to replace the old disk’s LUN World-Wide-Identifier (WWID) with the new disk’s LUN WWID. The storage subsystem will create a new LUN instance and new device special files for the new disk. This command is not requiered if you rebooted the server.
5. Replace the new disk on the Hotswap bay.
6. Determine the new instance number for the disk.
# ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk NO_HW DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0 <==== LUN PATH
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
…
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk # 64000/0xfa00/0x# esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0 <==== LUN PATH
/dev/disk/disk# /dev/rdisk/disk#
7. Create a description file by doing the following:
# cat >> /tmp/idf << EOF
3
EFI 500MB
HPUX 100%
HPSP 400MB
EOF
8. Use idisk to setup the disk partitioning using the file created above and create the persistent device special files.
# idisk -wf /tmp/idf /dev/rdsk/disk2
Note:
There will be a prompt with a message saying the operation may be destructive and asks to continue. Be sure to answer ‘yes’ for the operation to be successful. If the prompt is answered with ‘y’ only, an error is received along with a message saying “user aborting”.
# insf -e -H 64000/0xfa00/0x#
insf: Installing special files for esdisk instance # address 64000/0xfa00/0x#
9. Verify the state of the mass storage subsystem after creating the EFI partitions.
# ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk NO_HW DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
…
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk # 64000/0xfa00/0x# esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0 <==== LUN PATH
/dev/disk/disk# /dev/disk/disk#_p2 /dev/rdisk/disk# /dev/rdisk/disk#_p2
/dev/disk/disk#_p1 /dev/disk/disk#_p3 /dev/rdisk/disk#_p1 /dev/rdisk/disk#_p3
10. Assign the old instance number to the replacement disk.
# io_redirect_dsf -d /dev/disk/disk2 -n /dev/disk/disk#
Note:
If you miss to create the efi partition before using io_redirect_dsf, the command will fail gracefully with the following error message:
# io_redirect_dsf -d /dev/disk/disk2 -n /dev/disk/disk#
Number of old DSFs=8.
Number of new DSFs=2.
The number of old and new DSFs must be the same.
11. Verified that the io_redirect_dsf has properly attach the disk to the previous persistent dsf ant that the physical volume is claimed.
# ioscan -m lun /dev/disk/disk2
Class I Lun H/W Path Driver S/W State H/W Type Health Description
======================================================================
disk 2 64000/0xfa00/0x4 esdisk CLAIMED DEVICE online HP Virtual LvDisk
0/0/0/0.0×0.0x0
/dev/disk/disk2 /dev/disk/disk2_p2 /dev/rdisk/disk2 /dev/rdisk/disk2_p2
/dev/disk/disk2_p1 /dev/disk/disk2_p3 /dev/rdisk/disk2_p1 /dev/rdisk/disk2_p3
12. Use mkboot to format and populate the newly created EFI partition:
# mkboot -e -l /dev/dsk/disk2
13. Change the AUTO file contents to the proper mode:.
A) Primary boot disk.
# cat >> /tmp/auto << EOF
boot vmunix
EOF
# efi_cp -d /dev/rdsk/disk2_p1 /tmp/auto /efi/hpux/auto
B) Alternate boot disk.
# cat >> /tmp/auto << EOF
boot vmunix -lq
EOF
# efi_cp -d /dev/rdsk/disk2_p1 /tmp/auto /efi/hpux/auto
14. Restore the LVM reserved areas (PVRA/VGRA).
# vgcfgrestore -n vg00 /dev/rdsk/disk2_p2
15. Reattach the new disk:
# pvchange -a y /dev/rdsk/disk2_p2
16. Reactivate the volume group to attach the physical volumen.
# vgchange -a y vgXX
Note: In case that the volume group don¡¯t start to synchronize the logical volumes automatically, you can force synchronization with:
# vgsync vgXX
17. Use lvlnboot to ensure that the LVM logical volumes are prepared to be root, primary swap or dump volume.
# lvlnboot -R
# lvlnboot -v
Monitor volume group syncronization
If you need to monitor the advance of the volume group sincronization, you can use this script to quickly monitor extends that are still “stale”. Running this command should give a lower value each iteration until it reachs zero.
while true
do
for lv in $(vgdisplay -v <vgname> | grep “LV Name” | awk ‘{print $3}’)
do
lvdisplay -v $lv
done | grep -i stale | wc -l
sleep 10
done
Example:
# while true
> do
> for lv in $(vgdisplay -v vg00 | grep “LV Name” | awk ‘{print $3}’)
> do
> lvdisplay -v $lv
> done | grep -i stale | wc -ldone | grep -i stale | wc -l
> sleep 10
> done
5
0