Can I merge an LVM snapshot in Red Hat Enterprise Linux 5?

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • LVM snapshots

Issue

  • Does LVM snapshot merge work in RHEL 5?

Resolution

  • Using the --merge option of the lvconvert command does not work in RHEL5
  • The --merge option can be used in Rescue Mode if booted with RHEL6 installation media and the LV is not mounted, ie: 'When asked to Detect your current installation, choose No'.
  • Alternatively, all data from the snapshot can be copied into a new logical volume of equal size
# lvcreate -L <size> -n NewLV VolumeGroupName
# dd if=/dev/VolumeGroupName/OldLV of=/dev/VolumeGroupName/NewLV bs=8M  iflag=direct oflag=direct

Root Cause

  • Kernel support for merging LVM snapshots is not in RHEL5.
  • Only RHEL6 supports merging of LVM snapshots.
  • There are no plans to backport this functionality to RHEL5 due to the complexity of the changes required.

Diagnostic Steps

  • Look through the kernel source, in drivers/md/dm-snap.c, and look for "merge".  In RHEL5, there is no "merge" code.  This code only exists in RHEL6.
# grep merge ./rhel6/drivers/md/dm-snap.c -c
83
# grep merge ./rhel5/kernel/drivers/md/dm-snap.c -c
0
  • LV fails to activate after merge
  Can't process LV lv_name: snapshot-merge target support missing from kernel?
  • Check to see if dmsetup lists snapshot-merge as a target type
# dmsetup targets
multipath        v1.0.6
raid45           v1.0.0
snapshot-origin  v1.6.0
snapshot         v1.6.0
zero             v1.0.0
mirror           v1.2.0
striped          v1.1.0
linear           v1.0.2

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments