Bug#513504: flash-kernel should handle LVM roots better
Hi,
This works for me, see comments below!
On Thu, 29 Jan 2009, Martin Michlmayr wrote:
maks, can you comment on this patch. I've attached the full hook
for context. Maybe you'll find other cases that need to be handled
in a special way.
Index: initramfs-tools/hooks/flash_kernel_set_root
===================================================================
--- initramfs-tools/hooks/flash_kernel_set_root (revision 56152)
+++ initramfs-tools/hooks/flash_kernel_set_root (working copy)
@@ -43,6 +43,13 @@
# Record the root filesystem device for use during boot
rootdev=$(egrep '^[^# ]+[ ]+/[ ]' /etc/fstab | awk '{print $1}') || true
Aside: I think this may be fragile (literal tabs), using [:white:]
would be better. Indeed, grep piped to AWK is often redundant (as AWK
will parse the line again, and has its own POSIX RE support). Indeed
AWK has, what I would consider more comprehensible way of writing
this (tested along with the patch):
rootdev=$(awk '$1 !~ /^#/ && $2 == "/" { print $1; exit }' /etc/fstab) || true
+# Map LVM devices in the form of /dev/vg/lv to /dev/mapper/, otherwise
+# initramfs won't initialize them.
+link=$(readlink -f $rootdev)
+if echo "$link" | grep -q "^/dev/mapper/"; then
+ rootdev=$link
+fi
+
# Translate LABEL and UUID entries into a proper device name.
if echo "$rootdev" | grep -q "="; then
a=$(echo "$rootdev" | cut -d "=" -f 1)
This works fine for me!
Thanks very much!
regards,
--
Paul Jakma paul@clubi.ie paul@jakma.org Key ID: 64A2FF6A
Fortune:
You can't cheat an honest man. Never give a sucker an even break or
smarten up a chump.
-- W.C. Fields
Reply to: