Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

5.4.8. Merging Snapshot Volumes

As of the Red Hat Enterprise Linux 6 release, you can use the --merge option of the lvconvert command to merge a snapshot into its origin volume. If both the origin and snapshot volume are not open, the merge will start immediately. Otherwise, the merge will start the first time either the origin or snapshot are activated and both are closed. Merging a snapshot into an origin that cannot be closed, for example a root file system, is deferred until the next time the origin volume is activated. When merging starts, the resulting logical volume will have the origin’s name, minor number and UUID. While the merge is in progress, reads or writes to the origin appear as they were directed to the snapshot being merged. When the merge finishes, the merged snapshot is removed.
The following command merges snapshot volume vg00/lvol1_snap into its origin.
# lvconvert --merge vg00/lvol1_snap
You can specify multiple snapshots on the command line, or you can use LVM object tags to specify that multiple snapshots be merged to their respective origins. In the following example, logical volumes vg00/lvol1, vg00/lvol2, and vg00/lvol3 are all tagged with the tag @some_tag. The following command merges the snapshot logical volumes for all three volumes serially: vg00/lvol1, then vg00/lvol2, then vg00/lvol3. If the --background option were used, all snapshot logical volume merges would start in parallel.
# lvconvert --merge @some_tag
For information on tagging LVM objects, see Appendix D, LVM Object Tags. For further information on the lvconvert --merge command, see the lvconvert(8) man page.