How to mirror the root disk HP-UX Integrity (testcase : HP 2620rx)
1. Run ioscan to know about your disk layout
# ioscan -fnC disk
Class I H/W Path Driver S/W State H/W Type Description
============================================================================
disk 0 0/0/2/0.0.0.0 sdisk CLAIMED DEVICE _NEC DVD+-RW ND-6650A
/dev/dsk/c0t0d0 /dev/rdsk/c0t0d0
disk 1 0/1/1/0.0.0 sdisk CLAIMED DEVICE HP 146 GST3146855LC
/dev/dsk/c2t0d0 /dev/dsk/c2t0d0s2 /dev/rdsk/c2t0d0 /dev/rdsk/c2t0d0s2
/dev/dsk/c2t0d0s1 /dev/dsk/c2t0d0s3 /dev/rdsk/c2t0d0s1 /dev/rdsk/c2t0d0s3
disk 2 0/1/1/0.1.0 sdisk CLAIMED DEVICE HP 146 GST3146855LC
/dev/dsk/c2t1d0 /dev/rdsk/c2t1d0
2. Show each of partition on primary disk
# diskinfo -b /dev/rdsk/c2t0d0s1 | awk '{print $1 / (1024)}'
500
# diskinfo -b /dev/rdsk/c2t0d0s2 | awk '{print $1 / (1024)}'
139114
# diskinfo -b /dev/rdsk/c2t0d0s3 | awk '{print $1 / (1024)}'
400
3. Delete any partition ( if any ) on secondary disk.
# idisk -r /dev/rdsk/c2t1d0
# insf -e -C disk
# rmsf -H 0/1/1/0.1.0
# ioscan
# insf -e
if you want to more efficient for re-create partiton without deleting it first, skip this step and just go through to step 4.
4. Create partition on secondary disk same as primary disk have. Before this we need to create parfile file that contain partition layout.
# vi /tmp/parfile
3
EFI 500MB
HPUX 100%
HPSP 400MB
# idisk -f /tmp/parfile -w /dev/rdsk/c2t1d0
# insf –e –H 0/1/1/0.1.0
5. Now show your partition layout and check partition layout at secondary disk.
s1 mean for EFI use. EFI partition tables point to each of the partitions.
s2 for HPUX use.
s3 for HPSP use. Offline Diagnostics.
# ioscan -fnC disk
Class I H/W Path Driver S/W State H/W Type Description
============================================================================
disk 0 0/0/2/0.0.0.0 sdisk CLAIMED DEVICE _NEC DVD+-RW ND-6650A
/dev/dsk/c0t0d0 /dev/rdsk/c0t0d0
disk 1 0/1/1/0.0.0 sdisk CLAIMED DEVICE HP 146 GST3146855LC
/dev/dsk/c2t0d0 /dev/dsk/c2t0d0s2 /dev/rdsk/c2t0d0 /dev/rdsk/c2t0d0s2
/dev/dsk/c2t0d0s1 /dev/dsk/c2t0d0s3 /dev/rdsk/c2t0d0s1 /dev/rdsk/c2t0d0s3
disk 2 0/1/1/0.1.0 sdisk CLAIMED DEVICE HP 146 GST3146855LC
/dev/dsk/c2t1d0 /dev/dsk/c2t1d0s2 /dev/rdsk/c2t1d0 /dev/rdsk/c2t1d0s2
/dev/dsk/c2t1d0s1 /dev/dsk/c2t1d0s3 /dev/rdsk/c2t1d0s1 /dev/rdsk/c2t1d0s3
# diskinfo -b /dev/rdsk/c2t1d0s1 | awk '{print $1 / (1024)}'
500
# diskinfo -b /dev/rdsk/c2t1d0s2 | awk '{print $1 / (1024)}'
139114
# diskinfo -b /dev/rdsk/c2t1d0s3 | awk '{print $1 / (1024)}'
400
6. Run the pvcreate command on the disk that you will be mirroring to, you must use the –B option to make this disk bootable, it is a common mistake when mirroring the root volume group to not use the –B option when running pvcreate on the alternate boot disk.
You may need to use the –f option to force pvcreate to operate on the disk if it has been used by LVM previously.
# pvcreate -B /dev/rdsk/c2t1d0s2
7. Update the boot string in the AUTO file in the LIF on the alternate boot disk.
# mkboot -e -l /dev/rdsk/c2t1d0
8. Initialize the HPSP partition with an EFI file system. This does not place any data into the partition.
It simply initializes HPSP partition with an EFI file system.
# efi_fsinit -d /dev/rdsk/c2t1d0s3
9. Extend the disk into the root volume group, at this point you should also extend any other disks required into the root volume group.
# vgextend /dev/vg00 /dev/dsk/c2t1d0s2
10. Show your LVM layout
# more /etc/fstab
/dev/vg00/lvol3 / vxfs delaylog 0 1
/dev/vg00/lvol1 /stand vxfs tranflush 0 1
/dev/vg00/lexpand /expand vxfs delaylog 0 2
/dev/vg00/lvol4 /tmp vxfs delaylog 0 2
/dev/vg00/lvol5 /home 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
8. Mirror the disks by extending all of the logical volumes, in order, onto the alternate boot disk.
The boot, root and primary swap/dump file systems should be mirrored before any other file system is mirrored.
Remember not to mirror Logical Volume for "expand".
Create file mirror.sh for ease your job. Run it at background.
# vi /tmp/mirror.sh
for lv in lvol1 lvol2 lvol3 lvol4 lvol5 lvol6 lvol7 lvol8
do
lvextend -m 1 /dev/vg00/$lv /dev/dsk/c2t1d0s2
done
# chmod 555 /tmp/mirror.sh
# nohup /tmp/mirror.sh &
you can check the progress at nohup.out file
# tail -f /tmp/nohup.out
9. Reestablish the location of boot, root and primary swap/dump file systems within LVM using (or modifying as needed) the following commands:
# lvlnboot -b /dev/vg00/lvol1
# lvlnboot -r /dev/vg00/lvol3
# lvlnboot -s /dev/vg00/lvol2
# lvlnboot -d /dev/vg00/lvol2
# lvlnboot -R
10. Set up the AUTO file in the EFI partition to ensure that if the primary boot disk fails that the system will be able to boot from the alternate boot disk without quorum:
# print 'boot vmunix -lq' > /tmp/AUTO
# efi_cp -d /dev/dsk/c2t1d0s1 /tmp/AUTO EFI/HPUX/AUTO
# rm /tmp/AUTO
11. Set the path to the alternate boot device to be the disk that has just been created, enter:
# setboot -a 0/1/1/0.1.0
12. You must add the boot disk to the /stand/bootconf.
A new line must be inserted in this file when using LVM and it should start with an “l” (lower case letter L), and then followed by 1 Logical Interchange Format.
# vi /stand/bootconf
l /dev/dsk/c2t0d0s2
l /dev/dsk/c2t1d0s2
13. Check your disk and LVM layout
# ioscan -fnC disk
Class I H/W Path Driver S/W State H/W Type Description
============================================================================
disk 0 0/0/2/0.0.0.0 sdisk CLAIMED DEVICE _NEC DVD+-RW ND-6650A
/dev/dsk/c0t0d0 /dev/rdsk/c0t0d0
disk 1 0/1/1/0.0.0 sdisk CLAIMED DEVICE HP 146 GST3146855LC
/dev/dsk/c2t0d0 /dev/dsk/c2t0d0s2 /dev/rdsk/c2t0d0 /dev/rdsk/c2t0d0s2
/dev/dsk/c2t0d0s1 /dev/dsk/c2t0d0s3 /dev/rdsk/c2t0d0s1 /dev/rdsk/c2t0d0s3
disk 2 0/1/1/0.1.0 sdisk CLAIMED DEVICE HP 146 GST3146855LC
/dev/dsk/c2t1d0 /dev/dsk/c2t1d0s2 /dev/rdsk/c2t1d0 /dev/rdsk/c2t1d0s2
/dev/dsk/c2t1d0s1 /dev/dsk/c2t1d0s3 /dev/rdsk/c2t1d0s1 /dev/rdsk/c2t1d0s3
# lvlnboot -v
Boot Definitions for Volume Group /dev/vg00:
Physical Volumes belonging in Root Volume Group:
/dev/dsk/c2t0d0s2 (0/1/1/0.0.0) -- Boot Disk
/dev/dsk/c2t1d0s2 (0/1/1/0.1.0) -- Boot Disk
Boot: lvol1 on: /dev/dsk/c2t0d0s2
/dev/dsk/c2t1d0s2
Root: lvol3 on: /dev/dsk/c2t0d0s2
/dev/dsk/c2t1d0s2
Swap: lvol2 on: /dev/dsk/c2t0d0s2
/dev/dsk/c2t1d0s2
Dump: lvol2 on: /dev/dsk/c2t0d0s2, 0
14. We should copy Offline Diagnostics that when install HP-UX, it only install on primary disk only.
# efi_ls –d /dev/rdsk/c2t0d0s3 /
# dd if=/dev/rdsk/c2t0d0s3 of=/dev/rdsk/c2t1d0s3 bs=1024k
15. (Optional) if we use Ignite make_net_recovery or make_tape_recovery.
We need to have copy Offline Diagnostics for both disks.
# mkdir /var/HPSP
# dd if=/dev/dsk/c2t0d0s3 bs=1024k | gzip >> /var/HPSP/c2t0d0s3.save.gz
# dd if=/dev/dsk/c2t1d0s3 bs=1024k | gzip >> /var/HPSP/c2t1d0s3.save.gz
Thanks to Leo Sutinen (HP Finland) for gimme "private lesson" about this.