Using the AIX splitvg command.
cggibbo 270000TMUJ Comment (1) Visits (25458)
Just the other day, I needed to use the AIX splitvg command in order to copy some data from one system to another.
I thought I’d share the experience here.
The splitvg command can split a single mirror copy of a fully mirrored volume group into a separate “snapshot” volume group.
From the man page:
The original volume group VGname will stop using the disks that are now part of the snapshot volume group SnapVGname. Both volume groups will keep track of the writes within the volume group so that when the snapshot volume group is rejoined with the original volume group consistent data is maintained across the rejoined mirrors copies. Notes:
1 To split a volume group, all logical volumes in the volume group must have the target mirror copy and the mirror must exist on a disk or set of disks. Only the target mirror copy must exist on the target disk or disks.
2 The splitvg command will fail if any of the disks to be split are not active within the original volume group.
3 In the unlikely event of a system crash or loss of quorum while running this command, the joinvg command must be run to rejoin the disks back to the original volume group.
4 There is no concurrent or enhanced concurrent mode support for creating snapshot volume groups.
5 New logical volumes and file system mount points will be created in the snapshot volume group.
6 The splitvg command is not supported for the rootvg.
7 The splitvg command is not supported for a volume group that has an active paging space.
8 When the splitvg command targets a concurrent-capable volume group which is varied on in non-concurrent mode, the new volume group that is created will not be varied on when the splitvg command completes. The new volume group must be varied on manually.
So, looking at point 4, above, if you are using enhanced concurrent volume groups (for example with PowerHA), then you will not be able to use the splitvg command. This is disappointing as this would have been very handy in some of the large PowerHA systems I have worked with…..perhaps this will be supported in the future?
Anyway, back to my example. I had wanted to break-off one of the mirrors of a mirrored volume group and then assign the “split” volume group to another host to copy some data off.
The volume group datavg contained two disks, hdisk0 and hdisk3, as shown in the lspv output below.
There were only two logical volumes (loglvl00, jfs2 log and fslv00, data) and a single file system (/data) in this volume group.
# lsvg -l datavg
The volume group datavg, was mirrored across hdisk0 and hdisk3, as shown in the lsvg output below.
# lsvg -p datavg
The logical volumes for the /data file system and the JFS2 log were both mirrored, as shown in the lslv/lspv output.
# lslv fslv00
# lslv loglv00
# lspv -l hdisk0
# lspv -l hdisk3
Using the splitvg command I was able to break-off one of the disks from the mirrored pair. This created a new volume group on hdisk3 called vg00.
# splitvg -c1 datavg
The new volume group contains a new logical volume (pre-fixed with fs i.e. fsfslv00) and a file system (pre-fixed with /fs i.e. /fs/data). I can mount this file system and access the data in the file system and create and/or modify files (as shown below).
# mount /fs/data
# cd /fs/data
# touch 3
At this point I was able to export the volume group and import it on another system. I had to re-map the Virtual SCSI disk on my VIOS first.
# varyoffvg vg00
# rmdev –dl hdisk3
; Re-map the disk at the VIOS layer to the other AIX LPAR.
; Configure the disk on the other LPAR (with cfgmgr) and import the volume group (with importvg).
Once I was finished with vg00 on the other LPAR, I re-mapped the disk to the original AIX LPAR, configured the disk and then re-joined the disk to the datavg volume group, with the joinvg command.
; Export the VG and remove the disk on the other AIX LPAR.
; Re-map the disk at the VIOS layer to the original AIX LPAR.
# lsdev –Cc | grep hdisk3
hdisk3 Available Virtual SCSI Disk Drive
# joinvg datavg
The volume group is now fully mirrored again. However the partitions are stale and need to be sync’ed. I manually re-sync the volume group with the syncvg command.
# lsvg -l datavg
# syncvg –v datavg
# lsvg -l datavg
More information can be found here: http