Using splitvg in AIX to make a copy of a volume group

Technote (FAQ)


Question

How do I use splitvg to make a copy of a volume group I can back up?

Answer

Initial Volume Group Setup

Start with a mirrored volume group:
# lsvg -l zzvg
zzvg:
LV NAME            TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
zzlv               jfs        2       4       2    open/syncd    /zzfs
loglv03            jfslog     1       2       2    open/syncd    N/A

Since splitvg splits a volume group by mirror copy, the mirrored disks of each logical volume must be in the same columns, or splitvg will fail with the following error:

0516-1359 splitvg: The mirror specified to split the volume group must exists on a disk or
set of disks that contains nothing but this mirror.
0516-1355 splitvg: Unable to split the volume group.

This is an example of a volume group that will not be allowed to split:
# lslv -m zzlv
zzlv:/zzfs
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0129 hdisk16           0193 hdisk18
0002  0130 hdisk16           0194 hdisk18

# lslv -m loglv03
loglv03:N/A
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0131 hdisk18           0195 hdisk16

The first logical volume zzlv has hdisk16 as the first mirror copy, and hdisk18 as the second.

However the second logical volume loglv03 is reversed, with hdisk18 in the first copy and hdisk16 in the second. Using rmlvcopy to remove a copy from one of the logical volumes, then using mklvcopy to create it on the correct disk should fix this.

# lslv -m zzlv
zzlv:/zzfs
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0129 hdisk16           0193 hdisk18
0002  0130 hdisk16           0194 hdisk18

# lslv -m loglv03
loglv03:N/A
LP    PP1  PV1               PP2  PV2               PP3  PV3
0001  0131 hdisk16           0195 hdisk18

In the above example we have hdisk16 in the PV1 column, and hdisk18 in PV2 for both logical volumes, so this volume group is in a good configuration to be split. Splitvg will choose the 2nd mirror copy to split off by default.


Splitting Off A Copy Of The Volume Group

If we wish to make a split-off volume group that can be rejoined again to the original one, use the options below:

# splitvg -y newvg zzvg

# lsvg
rootvg
zzvg
newvg

# lsvg -l zzvg
zzvg:
LV NAME            TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
zzlv               jfs        2       4       2    open/syncd    /zzfs
loglv03            jfslog     1       2       2    open/syncd    N/A

# lsvg -l newvg
newvg:
LV NAME            TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
fszzlv             jfs        2       2       1    closed/syncd  /fs/zzfs
fsloglv03          jfslog     1       1       1    closed/syncd  N/A

Now we can mount our new mount points /fs/zzfs and back up the data.


Disk And Volume Group State While The Volume Group Is Split

Notice that while the volume groups are this state the disk that has been split-off from the original volume group has a new PV STATE:

# lsvg -p zzvg
zzvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE ...
hdisk16           active            639         636         ...
hdisk18           snapshotpv        639         636         ...

# lsvg -p newvg
newvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE ...
hdisk18           active            639         636         ...

Also note that the split-off volume group tells us it is a snapshot and where it came from.

# lsvg newvg
...
SNAPSHOT VG:        yes                      PRIMARY VG:     zzvg

Joining The Volume Group Together Again

To rejoin the vg again, which will remirror and synchronize with any new data that has been written to the original zzvg, use:

# joinvg zzvg

# lsvg -l zzvg
zzvg:
LV NAME            TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
zzlv               jfs        2       4       2    open/syncd    /zzfs
loglv03            jfslog     1       2       2    open/syncd    N/A


Splitting Off A New Independent Volume Group

Splitvg can also be used to split a mirrored volume group into a new, fully independent volume group. This volume group will not ever be joined back up with the original one. To do this use splitvg with the "-i" option, as in:

# splitvg -y newvg -i zzvg

In this case the disks will show that they completely belong to each respective volume group:

# lsvg -p zzvg
zzvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE ...
hdisk16           active            639         636        

# lsvg -p newvg
newvg:
PV_NAME           PV STATE          TOTAL PPs   FREE PPs    FREE ...
hdisk18           active            639         636        


Notes:

1. If a new volume group name is not provided using the "-y" option to splitvg, the new split-off snapshot vg will be called by a generic name "vgXX", where "XX" is numeric, starting at 00.

2. Splitvg really uses recreatevg behind the scenes, which is why the new logical volume and filesystem mount point names are the same that recreatevg produces.

3. The split-off logical volume will be prefixed with "fs". Note that for a generic JFS2 logical volume, which are named "fslvXX" this can get confusing, as they will be renamed "fsfslvXX".

4. To allow the split-off filesystems to be mounted, the mount points have been prefixed with "/fs". The /etc/filesystems file will also have been updated with this mount point information:

/fs/zzfs:
        dev             = /dev/fszzlv
        vfs             = jfs
        log             = /dev/fsloglv03
        mount           = false
        check           = false
        options         = rw
        account         = false

5. While the volume group is split, it still looks like a mirrored vg. However any updates to it will result in stale logical volumes.

For example, if you mount the original filesystem and copy some data into it, the logical volume and JFSlog logical volume go stale:

# lsvg -l zzvg
zzvg:
LV NAME            TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
zzlv               jfs        2       4       2    open/stale    /zzfs
loglv03            jfslog     1       2       2    open/stale    N/A

This is because the mirror is still associated with the original volume group, even when split off to a temporary new volume group. Using splitvg -i to create an independent volume group will not have this same effect.

0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Comments
There are no comments for this article. Be the first to post a comment.
Full Name
Email Address
Security Code Security Code
Related Articles RSS Feed
AIX alt_disk_copy
Viewed 9826 times since Sun, Jun 30, 2019
AIX Errpt - Diag - Alog
Viewed 3624 times since Wed, Mar 20, 2019
LVM: Display basic information about Physical Volumes, Volume Groups and Logical Volumes
Viewed 2912 times since Sun, Jun 3, 2018
AIX PDF ALL
Viewed 6563 times since Mon, Jul 16, 2018
AIX HOW TO CLONE A ROOTVG USING ALTERNATE DISK INSTALLATION ALTER_DISK_COPY
Viewed 16832 times since Sun, Jun 30, 2019
Install and configure GNU watch (gwatch) on AIX
Viewed 7761 times since Thu, Feb 21, 2019
Control Your Logs AIX
Viewed 18960 times since Wed, May 30, 2018
AIX - How to get IP and MAC address of ethernet adapter in AIX
Viewed 25081 times since Fri, Jun 8, 2018
AIX 7.2 running on my Macbook?
Viewed 12405 times since Mon, Jun 3, 2019
AIX, user gets “pwd: The file access permissions do not allow the specified action.”
Viewed 11007 times since Tue, Mar 16, 2021