[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#374891: initramfs-tools: activate resume volume group



Package: initramfs-tools
Version: 0.60
Tags: patch

Currently the lvm script does not activate the volume group which the resume partition resides on. In case the resume lv is in the same vg as the root lv, then things will work anyway since the root vg is activated but if they are in different vg's this means that resume will not work.

I've attached a patch which fixes this by activating both resume and root vg's.

Regards,
David Härdeman

diff -ur initramfs-tools-0.60-orig/scripts/local-top/lvm initramfs-tools-0.60/scripts/local-top/lvm
--- initramfs-tools-0.60-orig/scripts/local-top/lvm	2006-03-26 21:56:35.000000000 +0200
+++ initramfs-tools-0.60/scripts/local-top/lvm	2006-06-21 23:43:19.000000000 +0200
@@ -15,23 +15,34 @@
 	;;
 esac
 
-vg=${ROOT#/dev/mapper/}
+activate_vg()
+{
+	local vg="$1"
 
-case ${vg} in
-	/dev/root)
-		unset vg
-		;;
-	/*)
-		exit 0
-		;;
-esac
-	
-modprobe -q dm-mod
+	# Make sure that we have a non-empty argument
+	if [ -z "$vg" ]; then
+		return 0
+	fi
+
+	# Make sure that we have a d-m path
+	vg=${vg#/dev/mapper/}
+	if [ "$vg" = "$1" ]; then
+		return 0
+	fi
 
-# Split volume group from logical volume.
-vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#')
-# Reduce padded --'s to -'s
-vg=$(echo ${vg} | sed -e 's#--#-#g')
+	# Split volume group from logical volume.
+	vg=$(echo ${vg} | sed -e 's#\(.*\)\([^-]\)-[^-].*#\1\2#')
+	# Reduce padded --'s to -'s
+	vg=$(echo ${vg} | sed -e 's#--#-#g')
 
-vgchange -ay ${vg}
+	vgchange -ay ${vg}
+}
+
+if [ ! -e /sbin/vgchange ]; then
+	exit 0
+fi
+
+modprobe -q dm-mod
 
+activate_vg "$ROOT"
+activate_vg "$resume"

Reply to: