6.16. Splitting and Merging a RAID Image
You can temporarily split off an image of a RAID1 array for read-only use while tracking any changes by using the --trackchanges argument with the --splitmirrors argument of the lvconvert command. Using this feature, you can merge the image into an array at a later time while resyncing only those portions of the array that have changed since the image was split.
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. When you merge the image, only the portions of the array that have changed since the image was split are resynced.
Procédure
Create a RAID logical volume:
lvcreate --type raid1 -m 2 -L 1G -n my_lv my_vg
# lvcreate --type raid1 -m 2 -L 1G -n my_lv my_vg Logical volume "my_lv" createdCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: View the created RAID logical volume:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Split an image from the created RAID logical volume and track the changes to the remaining array:
lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv
# lvconvert --splitmirrors 1 --trackchanges my_vg/my_lv my_lv_rimage_2 split from my_lv for read-only purposes. Use 'lvconvert --merge my_vg/my_lv_rimage_2' to merge back into my_lvCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: View the logical volume after splitting the image:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Merge the volume back into the array:
lvconvert --merge my_vg/my_lv_rimage_1
# lvconvert --merge my_vg/my_lv_rimage_1 my_vg/my_lv_rimage_1 successfully merged back into my_vg/my_lvCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Vérification
View the merged logical volume:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow