5.4.16.7. Splitting and Merging a RAID Image
You can temporarily split off an image of a RAID1 array for read-only use while keeping track of any changes by using the
--trackchanges
argument in conjunction with the --splitmirrors
argument of the lvconvert
command. This allows you to merge the image back into the array at a later time while resyncing only those portions of the array that have changed since the image was split.
The format for the
lvconvert
command to split off a RAID image is as follows.
lvconvert --splitmirrors count --trackchanges vg/lv [removable_PVs]
lvconvert --splitmirrors count --trackchanges vg/lv [removable_PVs]
When you split off a RAID image with the
--trackchanges
argument, you can specify which image to split but you cannot change the name of the volume being split. In addition, the resulting volumes have the following constraints.
- The new volume you create is read-only.
- You cannot resize the new volume.
- You cannot rename the remaining array.
- You cannot resize the remaining array.
- You can activate the new volume and the remaining array independently.
You can merge an image that was split off with the
--trackchanges
argument specified by executing a subsequent lvconvert
command with the --merge
argument. When you merge the image, only the portions of the array that have changed since the image was split are resynced.
The format for the
lvconvert
command to merge a RAID image is as follows.
lvconvert --merge raid_image
lvconvert --merge raid_image
The following example creates a RAID1 logical volume and then splits off an image from that volume while tracking changes to the remaining array.
The following example splits off an image from a RAID1 volume while tracking changes to the remaining array, then merges the volume back into the array.
Once you have split off an image from a RAID1 volume, you can make the split permanent by issuing a second
lvconvert --splitmirrors
command, repeating the initial lvconvert
command that split the image without specifying the --trackchanges
argument. This breaks the link that the --trackchanges
argument created.
After you have split an image with the
--trackchanges
argument, you cannot issue a subsequent lvconvert --splitmirrors
command on that array unless your intent is to permanently split the image being tracked.
The following sequence of commands splits an image and tracks the image and then permanently splits off the image being tracked.
Note, however, that the following sequence of commands will fail.
Similarly, the following sequence of commands will fail as well, since the split image is not the image being tracked.