Merging snapshot causing activation failure of origin volume after reboot

Solution Unverified - Updated -

Environment

  • Red Hat Enterprise Linux 5

Issue

  • Volume Group or Logical Volume activation fails with the following error
  Can't process LV LVNAME: snapshot-merge target support missing from kernel?
  0 logical volume(s) in volume group "VGNAME" now active
  • Logs show the following errors after activation attempt
kernel: device-mapper: table: 253:#: snapshot-merge: unknown target type
kernel: device-mapper: ioctl: error adding target to table

Resolution

1) Upgrade your lvm2 package to 2.02.88-11.el5 or greater

yum update lvm2

2) Re-active the volume

# vgchange -ay
Workaround

1) Identify a valid version of your LVM metadata by issuing the following grep command

# grep -l "\--merge" /etc/lvm/archive/*

2) Restore the metadata back to disk using the file in the output from the previous command

# vgcfgrestore -f /etc/lvm/archive/file.vg VGNAME

3) Rescan the Volume Group and reattempt the activation

# vgscan
# vgchange -ay VGNAME

Root Cause

  • The kernel in Red Hat Enterprise Linux 5 does not contain the logic to support snapshot merging

  • Support for snapshot merging in the kernel is only checked when the merge starts.

  • lvconvert does not check if the kernel supports merging when issuing the --merge option.

  • If the logical volume is not open at the time of the merge, the command will fail.

# lvconvert --merge VGNAME/LVSNAPNAME
  Can't process LV lv_origin: snapshot-merge target support missing from kernel?
  Failed to suspend origin LVNAME
  Unable to merge LV "LVSNAPNAME" into its origin.
  • If the logical volume is open at the time of the merge, the merge will occur during next activation, causing the issue.
# lvconvert --merge VGNAME/LVSNAPNAME
  Can't merge over open origin volume
  Merging of snapshot lv_snap will start next activation.

Diagnostic Steps

  • Check to see if activation fails agianst a volume after issuing merge command.
[root@rhel5 ~]# lvs vg_merge
  LV        VG       Attr   LSize   Origin    Snap%  Move Log Copy%  Convert
  lv_origin vg_merge owi-a- 500.00M                                         
  lv_snap   vg_merge swi-a- 100.00M lv_origin  64.54                        
[root@rhel5 ~]# mount /dev/vg_merge/lv_origin /mnt
[root@rhel5 ~]# lvconvert --merge vg_merge/lv_snap
  Can't merge over open origin volume
  Merging of snapshot lv_snap will start next activation.
[root@rhel5 ~]# lvs vg_merge
  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  lv_origin vg_merge Owi-ao 500.00M                                      
[root@rhel5 ~]# umount /mnt
[root@rhel5 ~]# vgchange -an vg_merge
  0 logical volume(s) in volume group "vg_merge" now active
[root@rhel5 ~]# vgchange -ay vg_merge
  Can't process LV lv_origin: snapshot-merge target support missing from kernel?
  0 logical volume(s) in volume group "vg_merge" now active
[root@rhel5 ~]# 
  • Check to see if merging is supported by looking for snapshot-merge in the output of the following command
# dmsetup targets
  • Check LV Attributes to see if the O attribute (snapshot merging with origin) has been set
# lvs VGNAME
  LV        VG       Attr   LSize   Origin Snap%  Move Log Copy%  Convert
  LVNAME    VGNAME   Owi-ao 500.00M

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