Replacing Mirrored root disk on HP-UX 11i V3 (11.31)

October 9, 2016 by S4

Filed under Uncategorized

Last modified October 9, 2016

1.0 Replacing Mirrored root disk on HP-UX 11i V3 (11.31)

1.0  Due to persistent naming of disks in 11iV3, 2 different disks (inserted one after another) on the same internal slot will have different disk instance number and device file name. Hence, the procedure for replacing mirrored root disks is different from previous versions. The following checklist gives the step by step procedure for root disk replacement in HP-UX 11iV3. The instructions are in blue and the actual commands are in black. The commands in this checklist can be copied and pasted to Unix, without the risk of characters getting converted to junk in Unix. The procedure assumes that one of the disks has gone bad and it is still plugged in the slot.
A sample scriptlog describing this procedure can be found at
11i V3 Root disk replacement scriptlog.

Step Instructions Done
1. #Login as root and start a scriptlog.


script -a /var/adm/install-logs/EC-replace-single-root-disk-`date +%m%d%y`.scriptlog

# Step 1

uname -a



2. #Save the hardware paths to the disk. Run the ioscan command and note the hardware paths of the failed disk.


#Step 2

vgdisplay -v vg00|more

ioscan -fnNC disk | more


#Identify the device file name of the bad disk and run set

#the BAD_DISK variable with the short name of the whole

#disk ( eg. disk3, but not /dev/dsk/disk3 or

# disk3_p2)


BAD_DISK=<short name of the whole disk>

echo $BAD_DISK




3. #IF the bad disk variable is set right, the following

#command should succeed. Otherwise adjust BAD_DISK value.


#Step 3

ll /dev/*disk/${BAD_DISK}_p[123]

ioscan -m lun /dev/disk/$BAD_DISK


HW_PATH=`ioscan -m lun /dev/disk/$BAD_DISK|awk ‘/^disk/ {getline; print $1}’`

echo $HW_PATH


TEST=`ioscan -fkNnH $HW_PATH|awk ‘/^lunpath/ {print $10}’`


#IF the variables are set as expected, value of TEST should

#be same as value of BAD_DISK. Verify by running..


if [ “$BAD_DISK” = “$TEST” ]; then

echo “\n\n\n\nTest successful. Proceed.\n”


echo “\n\n\n\nTest Failed. Make sure that the BAD_DISK is set to short name of the bad disk (eg disk3) and re-run step3.\n”



4. #Halt LVM access to the disk


#Step 4

pvchange -a N /dev/disk/${BAD_DISK}_p2

vgdisplay -v vg00|more


5. #Physically replace the disk (on the same slot).

#Step 5

#Disk replaced.


6. #Notify the mass storage subsystem that the disk has been replaced.


#Step 6

ioscan -fnNC disk   #The status of disks will not change.

scsimgr replace_wwid -D /dev/rdisk/$BAD_DISK


#enter y, when prompted.


7. #Note the new instance # for the new disk on the same H/W slot address, that is recorded in HW_PATH variable.


#Step 7

ioscan -m lun | more

ioscan -m hwpath -H $HW_PATH

NEW_LHW_PATH=`ioscan -m hwpath -H $HW_PATH|awk ‘{ if (NR == 3) print $1}’`

ioscan -m lun -H $NEW_LHW_PATH

NEW_DISK=`ioscan -m lun -H $NEW_LHW_PATH|awk ‘{if (NR == 5) print substr($1,11) }’`

echo $NEW_DISK     #This will be a complete new instance number for the replacement disk. Ensure this is the new disk, it will be formatted in the next step.



8. #Partition the new disk and create device files for them.


#Step 8

echo “3\nEFI 500MB\nHPUX 100%\nHPSP 400MB” > /tmp/idf

cat /tmp/idf

idisk -f /tmp/idf -w /dev/rdisk/$NEW_DISK

idisk /dev/rdisk/$NEW_DISK |more

insf -evH $NEW_LHW_PATH

ioscan -funNC disk


9. #Assign the old instance number to the replacement disk.


#Step 9

io_redirect_dsf -d /dev/disk/$BAD_DISK -n /dev/disk/$NEW_DISK

ioscan -m lun /dev/disk/$BAD_DISK

ioscan -funNC disk|more   #Note the new instance is gone.


10. #Restore LVM configuration information to the new disk.


#Step 10

vgcfgrestore -n /dev/vg00 /dev/rdisk/${BAD_DISK}_p2


11. #Place boot utilities in the boot area. Copy EFI utilities to the EFI partition, add AUTO file; use the device special file for the entire disk.


#Step 11

mkboot -e -l /dev/rdisk/$BAD_DISK

mkboot -a “hpux -lq” /dev/rdisk/$BAD_DISK


12. #Restore LVM access to the disk.


#Step 12

pvchange -a y /dev/disk/${BAD_DISK}_p2

vgchange -a y /dev/vg00


13. #If the above step didn’t trigger a sync, and if each volume of vg00 is not sycned up fully, sync it manually.


#Step 13

vgdisplay -v vg00|more

vgsync vg00

vgdisplay -v vg00|more  #Ensure all volumes are synced.




14. #Update root vg information and nvram.


#Step 14

lvlnboot -R /dev/vg00


setboot -v

echo $HW_PATH


#Run one of the following commands depending upon how the original HW_PATH was set, as primary or ha alternate or alternate. This decision can be based on how it is already set. Run one of the setboot commnds below, even if it seems to be OK, as displayed by the above commands.


setboot -p $HW_PATH  #If primary




setboot -h $HW_PATH  #If ha alternate




setboot -a $HW_PATH  #If alternate




setboot -v


15. #If possible, reboot using the new disk.


#Step 15

shutdown -ry 0 #If possible. Interupt boot and select the HA Alternate (or alternate, if third mirror) to boot.





Leave a Comment