This document describes how to split a Veritas mirror so that the sub-mirrors can be associated with new volumes, and hence be accessed via Solaris[TM] devices and possibly mounted.
Be aware that you may not be able to mount a filesystem taken from a split mirror, depending on the state of the filesystem at the time of the split. If a filesystem is unmounted cleanly prior to the split, both copies should be mountable afterwards.
So this is our starting point, a single volume with two plexes forming a simple mirror in the disk group 'baddg'.
# vxprint -g baddg
TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
dg baddg baddg - - - - - -
dm sd01 Disk_1 - 35358848 - - - -
v vol1 gen ENABLED 207328 - ACTIVE - -
pl plex1 vol1 ENABLED 207328 - ACTIVE - -
sd sd01-B0 plex1 ENABLED 1 0 - - Block0
sd sd01-02 plex1 ENABLED 207327 1 - - -
pl plex2 vol1 ENABLED 207328 - ACTIVE - -
sd sd01-01 plex2 ENABLED 207328 0 - - -
It has a filesystem which is mounted.
# mount |grep baddg
/a on /dev/vx/dsk/baddg/vol1
read/write/setuid/intr/largefiles/logging/xattr/onerror=panic/dev=3b41f40
on Thu Jul 21 16:05:26 2005
We write a file and calculate the checksum. (Note: This is not a necessary part of the procedure but will be used later in this document to illustrate that the procedure has been a success.)
# cp /kernel/genunix /a
# ls -l /a
total 3600
-rwxr-xr-x 1 root other 1823432 Jul 21 16:08 genunix
drwx------ 2 root root 8192 Jul 21 16:02 lost+found
# cksum /a/genunix
411313929 1823432 /a/genunix
Now unmount the filesystem, so that we know everything has been flushed to the physical disk.
# umount /a
In the following steps we are going to disassociate the plexes from the parent volume using vxplex 'dis'. VxVM also has a vxplex 'det' which is to detatch a plex. Confusingly, detatching a plex with vxplex 'det', stops writes to the plex, but the plex stays associated with the parent volume.
The first step is to detach one of the plexes and break its link to the remaining plex(es) (i.e. dissociate). We'll dissociate 'plex2'
# vxplex -g baddg dis plex2
Let's check how VxVM sees things now - plex2 is no longer associated with the volume.
# vxprint -g baddg
TY NAME ASSOC KSTATE LENGTH PLOFFS STATE TUTIL0 PUTIL0
dg baddg baddg - - - - - -
dm sd01 Disk_1 - 35358848 - - - -
pl plex2 - DISABLED 207328 - - - -
sd sd01-01 plex2 ENABLED 207328 0 - - -
v vol1 gen ENABLED 207328 - ACTIVE - -
pl plex1 vol1 ENABLED 207328 - ACTIVE - -
sd sd01-B0 plex1 ENABLED 1 0 - - Block0
sd sd01-02 plex1 ENABLED 207327 1 - - -
Now create a volume using the disassociated plex (plex2). The volume will be called 'vol2'
# vxmake -g baddg vol vol2 plex=plex2
vxprint shows the new volume, but the volume is disabled.
v vol2 gen DISABLED 207328 - EMPTY - -
pl plex2 vol2 DISABLED 207328 - EMPTY - -
sd sd01-01 plex2 ENABLED 207328 0 - - -
Next, we must start the new volume
# vxvol -g baddg start vol2
The new volume is now available to mount.
v vol2 gen ENABLED 207328 - ACTIVE - -
pl plex2 vol2 ENABLED 207328 - ACTIVE - -
sd sd01-01 plex2 ENABLED 207328 0 - - -
We can now mount the two volumes that were previously two halves of a single mirror and see that the same file is there, and has the same checksum - i.e. is a consistent copy.
First we mount the new volume
# mount /dev/vx/dsk/baddg/vol2 /b
# ls -l /b
total 3600
-rwxr-xr-x 1 root other 1823432 Jul 21 16:08 genunix
drwx------ 2 root root 8192 Jul 21 16:02 lost+found
# cksum /b/genunix
411313929 1823432 /b/genunix
Now the original volume (no longer a mirror)
# mount /dev/vx/dsk/baddg/vol1 /a
# ls -l /a
total 3600
-rwxr-xr-x 1 root other 1823432 Jul 21 16:08 genunix
drwx------ 2 root root 8192 Jul 21 16:02 lost+found
# cksum /a/genunix
411313929 1823432 /a/genunix
To recreate the original mirror, follow the above steps to disassociate the plex from the new volume. Then use vxplex 'att' to attach the plex to the original volume. The plex will be synchronised with the plex(es) already attached to the volume.