Hi. I have a question for anyone who is a bit of a whiz with LVM. What I want to do is take a volume group of SSA disks, and replicate their contents onto another RS6000, in the minimum cut-over time possible.
The way I want to achieve this, is by mirroring the disks, splitting the mirror, and then importing the split copies on the other system. I have worked out a way of doing this, and when I test it on a small vg, it works fine. My main concern that is it might be a bit of a kludge, and more risky with large volumes of data. Also, there might be a
quicker, more correct way of doing this. Any input gratefully received. Here is how I do it:
Find out which disks belong to which lv with:
host1:/>lsvg -l Lvname |tail +3|awk '{print $1}' |xargs -n 1 lslv -l
Add new disks to group:
host1:/> extendvg Vgname hdiskn hdiskn+1 etc
Turn quorum checking off, otherwise problems will occur later when disks are removed:
host1:/> chvg -Qn Vgname
make mirrors:
host1:/> mklvcopy Lvname 2 hdiskn hdiskn+1
Sync all copies with:
host1:/> syncvg -v Vgname
On host1, unmount the filesystems associated with the vg.
Convert mirrors into separate lvs with:
host1:/> splitlvcopy -y newlv oldlv 1
( Make sure that the newlv name will be unique on both systems )
Power off all SSA disks used as copies.
Remove disks and their lv's from the vg:
host1:/> reducevg -d Vgname hdiskn hdiskn+1 etc
Remove disks from device configuration database:
host1:/> rmdev -d -l hdiskn
host1:/> rmdev -d -l pdiskn
Re-instate quorum checking:
host1:/> chvg -Qy Vgname
Remount filesystems associated with the vg, and ensure contents are fully accessible.
On host2, cable in SSA disks, and power back on again.
Update device database with new disks after checking beforehand that you know what disks are already there.
host2:/>cfgmgr
Import the volume group, but use force mode, as not all disks / lv's will be present ( synclvodm warnings will appear ):
host2:/> importvg -f -y Vgname hdiskn
Turn quorum checking off for Vgname with:
host2:/> chvg -Qn Vgname
Find the disks that used to be present in the vg, but which were not cabled across:
host2:/> lsvg -p Vgname
Remove the disks that show as removed ( from last step ) from the vg with:
host2:/> reducevg -d Vgname hdiskn hdiskn+1 etc
Re-instate quorum checking:
host2:/> chvg -Qy Vgname
Make sure that that the logical volumes in the vg have the expected filesystems associated with them:
host2:/> lsvg -l Vgname
If any are missing / incorrect, they will need to be recreated as they are on host1.
Check consistency across imported filesystems with:
host2:/> lsvg -l Vgname |tail +3|awk '{print $7}' | grep -v "N/A" |xargs -n 1 fsck
On host2, remount filesystems associated with the vg, and ensure contents are fully accessible.
That's it. Something tells me there's an easier way....
TIA
Mark Harris
The way I want to achieve this, is by mirroring the disks, splitting the mirror, and then importing the split copies on the other system. I have worked out a way of doing this, and when I test it on a small vg, it works fine. My main concern that is it might be a bit of a kludge, and more risky with large volumes of data. Also, there might be a
quicker, more correct way of doing this. Any input gratefully received. Here is how I do it:
Find out which disks belong to which lv with:
host1:/>lsvg -l Lvname |tail +3|awk '{print $1}' |xargs -n 1 lslv -l
Add new disks to group:
host1:/> extendvg Vgname hdiskn hdiskn+1 etc
Turn quorum checking off, otherwise problems will occur later when disks are removed:
host1:/> chvg -Qn Vgname
make mirrors:
host1:/> mklvcopy Lvname 2 hdiskn hdiskn+1
Sync all copies with:
host1:/> syncvg -v Vgname
On host1, unmount the filesystems associated with the vg.
Convert mirrors into separate lvs with:
host1:/> splitlvcopy -y newlv oldlv 1
( Make sure that the newlv name will be unique on both systems )
Power off all SSA disks used as copies.
Remove disks and their lv's from the vg:
host1:/> reducevg -d Vgname hdiskn hdiskn+1 etc
Remove disks from device configuration database:
host1:/> rmdev -d -l hdiskn
host1:/> rmdev -d -l pdiskn
Re-instate quorum checking:
host1:/> chvg -Qy Vgname
Remount filesystems associated with the vg, and ensure contents are fully accessible.
On host2, cable in SSA disks, and power back on again.
Update device database with new disks after checking beforehand that you know what disks are already there.
host2:/>cfgmgr
Import the volume group, but use force mode, as not all disks / lv's will be present ( synclvodm warnings will appear ):
host2:/> importvg -f -y Vgname hdiskn
Turn quorum checking off for Vgname with:
host2:/> chvg -Qn Vgname
Find the disks that used to be present in the vg, but which were not cabled across:
host2:/> lsvg -p Vgname
Remove the disks that show as removed ( from last step ) from the vg with:
host2:/> reducevg -d Vgname hdiskn hdiskn+1 etc
Re-instate quorum checking:
host2:/> chvg -Qy Vgname
Make sure that that the logical volumes in the vg have the expected filesystems associated with them:
host2:/> lsvg -l Vgname
If any are missing / incorrect, they will need to be recreated as they are on host1.
Check consistency across imported filesystems with:
host2:/> lsvg -l Vgname |tail +3|awk '{print $7}' | grep -v "N/A" |xargs -n 1 fsck
On host2, remount filesystems associated with the vg, and ensure contents are fully accessible.
That's it. Something tells me there's an easier way....
TIA
Mark Harris