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

Bug#378332: Update-initramfs: suggested patch to make scripts/local-top/lvm understand "/dev/vg/lv"




The following patch is employed at our company to enable the use of /dev/vg/lv syntax in the root argument on the kernel command line. It simply adds an extra case check, for the alternative syntax. I realise that /dev/vg/lv is a symlink and not the 'real' root device node. But given the symlink is widely deployed in fstab - after all why else does dm-mapper create this convenient symlink? - I don't suppose it does any harm to make this an option on the kernel command line too.

# diff -ubw initramfs-tools/scripts/local-top/lvm initramfs-tools.new/scripts/local-top/lvm --- initramfs-tools/scripts/local-top/lvm 2007-04-13 12:17:29.000000000 +0100 +++ initramfs-tools.new/scripts/local-top/lvm 2009-02-17 17:23:29.000000000 +0000
@@ -37,11 +37,9 @@
               ;;
       esac

-       # Make sure that we have a d-m path
+       # See if we have a /dev/mapper/vg-lv path
       vg=${vg#/dev/mapper/}
-       if [ "$vg" = "$1" ]; then
-               return 1
-       fi
+       if [ "$vg" != "$1" ]; then

       # Make sure that the device includes at least one dash
       if [ "$(echo -n "$vg" | tr -d -)" = "$vg" ]; then
@@ -54,6 +52,21 @@
       vg=$(echo ${vg} | sed -e 's#--#-#g')

       vgchange -ay ${vg}
+               return 0
+       fi
+
+       # See if we have a /dev/vg/lv path
+       vg=${1#/dev/}
+       if [ "$vg" != "$1" ]; then
+
+               # Split volume group from logical volume.
+               vg=$(echo ${vg} | sed -e 's#\(.*\)\([^/]\)/[^/].*#\1\2#')
+
+               vgchange -ay ${vg}
+               return 0
+       fi
+
+       return 1
}

if [ -e /scripts/local-top/lvm2 ]; then





Reply to: