Tags: patch
The problem lies in the initramfs script:
/usr/share/initramfs-tools/scripts/local-top/lvm2
It attempts to activate the LV specified as "root=" but this call fails
for snapshots - the origin volume needs to be activated instead.
Please see the attached patch that adds snapshot support. It was
successfully tested on my system.
Regards,
Paweł Pawliński
--- lvm2.orig 2010-12-02 19:46:12.163189512 +0100
+++ lvm2 2010-12-02 22:22:07.419218418 +0100
@@ -46,10 +46,25 @@
eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev")
if [ "$DM_VG_NAME" ] && [ "$DM_LV_NAME" ]; then
- lvm lvchange -aly --ignorelockingfailure "$DM_VG_NAME/$DM_LV_NAME"
+
+ # Verify if we are dealing with a snapshot
+ full_vol_name="$DM_VG_NAME/$DM_LV_NAME"
+ snap_origin=$(lvm lvs --separator '' --noheadings -o origin $full_vol_name)
+
+ # Fix lvs formatting
+ snap_origin="${snap_origin# }"
+
+ if [ "$snap_origin" ]; then
+ _log_msg "Using LVM snapshot as the root device."
+ vol_to_activate="$DM_VG_NAME/$snap_origin"
+ else
+ vol_to_activate="$full_vol_name"
+ fi
+
+ lvm lvchange -aly --ignorelockingfailure "$vol_to_activate"
rc=$?
if [ $rc = 5 ]; then
- echo "Unable to find LVM volume $DM_VG_NAME/$DM_LV_NAME"
+ echo "Unable to activate LVM volume $vol_to_activate"
fi
fi
}