As an example, you can split a mirrored logical volume to back up one of the mirrored copies of a file system while leaving the other mirrored copy of the file system open for use. When you complete the backup activity, you can merge the split pair back to one mirrored logical volume.
For each mirrored logical volume that you split into two logical volumes, LVM dynamically creates a table that it uses to resynchronize the two when you merge them back again. The table reduces synchronization time. The table exists as long as neither of the split pair is extended, reduced , or split again, or until the system is rebooted.If no table exists,all data is resynchronized
When LVM merges the split pair, it resynchronizes the data, updating the physical extents in the split-off copy based on changes made to the copy that remained in use. No resynchronization takes place if no changes occured in either copy.
Example:
Online backup using lvsplit, lvmerge
Suppose you want to back up the file system /lptest in the doubly mirrored logical volume /dev/vg02/lvol1. Because you want to access the file system even while backing it up(that is, you do not want to unmount it), you plan to temporarily split the logical volume in two).
1,Split the logical volume.
# lvsplit -s backup /dev/vg02/lvol1
Logical volume "/dev/vg02/lvol1backup"has been successfully created with lv number 5 Logical volume "/dev/vg02/lvol1"has been successfully split
The new logical volume /dev/vg02/lvol1backup, split off from the original, now exists.
2,Perform backup( or other file system operation) on the file system in /dev/vg02/lvol1backup
3,Unmount the file system(if you had mounted it) in the split-off logical volume when you are ready to merge the split pairs.
4,Merge the split-off logical volume and the original logical volume back into one mirrored logical volume
# lvmerge /dev/vg02/lvol1backup /dev/vg02/lvol1
CAUTION:Notice the sequence.
lvmerge split-off_logical_volume original_logical_volume. Do not reverse the order, or else the more recent data could be overwritten
The split-off logical volume merges back with the original logical volume, now modified.
After the merge, you can verify that the logical volume's mirrored state matches the pre-split state and that the split-off logical volume no longer exists.
阅读(1744) | 评论(0) | 转发(0) |