How to mirror disk at HP-UX - 2
If we want 2 mirror Volume Group, we need to put it on different partition.
Each Volume Group can has many of Logical Volumes.
Show your disk layout partition
# 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
disk 3 0/3/1/0.0.0 sdisk CLAIMED DEVICE COMPAQ BF1468B26B
/dev/dsk/c4t0d0 /dev/rdsk/c4t0d0
disk 4 0/3/1/0.1.0 sdisk CLAIMED DEVICE COMPAQ BF1468B26B
/dev/dsk/c4t1d0 /dev/rdsk/c4t1d0
We will use 3rd and 4th disk.
Show disk capacity in MB
# diskinfo -b /dev/rdsk/c4t0d0 | awk '{print $1 / (1024)}'
140014
# diskinfo -b /dev/rdsk/c4t1d0 | awk '{print $1 / (1024)}'
140014
Create partition on both disks. Before this we need to create /tmp/parfile file that contain partition layout.
We need to create at least 2 partitions for each LVM, each have 70GB in capacity ( may different as your need).
Leave the remaining space ( 3rd partition ) on disk.
# vi /tmp/parfile
3
HPUX 70000MB
HPUX 70000MB
HPUX 100%
# idisk -f /tmp/parfile -w /dev/rdsk/c4t0d0
# insf –e –H 0/3/1/0.0.0
# idisk -f /tmp/parfile -w /dev/rdsk/c4t1d0
# insf –e –H 0/3/1/0.1.0
Show your disk layout partition
# 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
disk 3 0/3/1/0.0.0 sdisk CLAIMED DEVICE COMPAQ BF1468B26B
/dev/dsk/c4t0d0 /dev/dsk/c4t0d0s2 /dev/rdsk/c4t0d0 /dev/rdsk/c4t0d0s2
/dev/dsk/c4t0d0s1 /dev/dsk/c4t0d0s3 /dev/rdsk/c4t0d0s1 /dev/rdsk/c4t0d0s3
disk 4 0/3/1/0.1.0 sdisk CLAIMED DEVICE COMPAQ BF1468B26B
/dev/dsk/c4t1d0 /dev/dsk/c4t1d0s2 /dev/rdsk/c4t1d0 /dev/rdsk/c4t1d0s2
/dev/dsk/c4t1d0s1 /dev/dsk/c4t1d0s3 /dev/rdsk/c4t1d0s1 /dev/rdsk/c4t1d0s3
Create physical volume for Volume Group on both disks
# pvcreate -f /dev/rdsk/c4t0d0s1
# pvcreate -f /dev/rdsk/c4t0d0s2
# pvcreate -f /dev/rdsk/c4t1d0s1
# pvcreate -f /dev/rdsk/c4t1d0s2
Creating vg01 partition
# mkdir /dev/vg01
# mknod /dev/vg01/group c 64 0x010000
( 0x010000 is the magic number and this number has last 4 digits as 0000. The first two digits have to be unique and the maximum limit is 10 )
# vgcreate /dev/vg01 /dev/dsk/c4t0d0s1 /dev/dsk/c4t1d0s1
( use 'vgcreate -s 8 /dev/vg01 /dev/dsk/c4t0d0s1 /dev/dsk/c4t1d0s1' if there is an error about max_pvs )
Creating vg02 partition
# mkdir /dev/vg02
# mknod /dev/vg02/group c 64 0x020000
( 0x020000 is the magic number and this number has last 4 digits as 0000. The first two digits have to be unique and the maximum limit is 10 )
# vgcreate /dev/vg02 /dev/dsk/c4t0d0s2 /dev/dsk/c4t1d0s2
( use 'vgcreate -s 8 /dev/vg02 /dev/dsk/c4t0d0s2 /dev/dsk/c4t1d0s2' if there is an error about max_pvs )
Create logical volume for vg01 on both disks
We will create :
datalvol 35GB at vg01
newdatalvol 35GB at vg01
softlvol 70GB at vg02
# lvcreate -n datalvol vg01
# lvextend -l 1 /dev/vg01/datalvol /dev/dsk/c4t0d0s1
# lvextend -m 1 /dev/vg01/datalvol /dev/dsk/c4t1d0s1
# lvextend -L 35000 /dev/vg01/datalvol
# lvcreate -n newdatalvol vg01
# lvextend -l 1 /dev/vg01/newdatalvol /dev/dsk/c4t0d0s1
# lvextend -m 1 /dev/vg01/newdatalvol /dev/dsk/c4t1d0s1
# lvextend -L 35000 /dev/vg01/newdatalvol
Create logical volume for vg02 on both disks
# lvcreate -n softlvol vg02
# lvextend -l 1 /dev/vg02/softlvol /dev/dsk/c4t0d0s2
# lvextend -m 1 /dev/vg02/softlvol /dev/dsk/c4t1d0s2
# lvextend -L 70000 /dev/vg02/softlvol
Create file system for logical volume that you created
# newfs -F vxfs -o largefiles /dev/vg01/rdatalvol
# newfs -F vxfs -o largefiles /dev/vg02/rsoftlvol
Mount logical volume
# mkdir /data
# mkdir /newdata
# mkdir /soft
# echo "/dev/vg01/datalvol /data vxfs delaylog 0 2" >> /etc/fstab
# echo "/dev/vg01/newdatalvol /data vxfs delaylog 0 2" >> /etc/fstab
# echo "/dev/vg02/softlvol /data vxfs delaylog 0 2" >> /etc/fstab
# mount /dev/vg01/datalvol /data
# mount /dev/vg01/newdatalvol /newdata
# mount /dev/vg02/softlvol /soft
Thanks to Leo Sutinen (HP Finland) for tutoring me privately.