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

[linux-lvm] Patch for Miguel Cabeça's lvm2create_initrdscript



Hi all,
 I recently upgraded the kernel on my box and had an awful time getting
my old initrd image that relies on change_root() to work. I switched to
Miguel's new script and it works great, though I had to make a couple of
tweaks:

 The first one is pretty minor. I have /usr set up as a separate
partition, and debian puts chroot in /usr/sbin. Luckily, chroot is also
a busybox function, so I simply added /initrd/sbin and /initrd/bin to
the PATH so that it could find a working chroot after pivot_root occurs.

 The second one is an ugly hack, and I'm definitely open to better ways
of handling it. After my kernel upgrade (from 2.6.1 to 2.6.4-rc2), the
major number of the device mapper devices on my system changed. So, I
added a hack to copy the contents of the ramdisk /dev/mapper directory
to the /dev/mapper directory on the lvm2 root filesystem, prior to the
pivot_root. It works for me, but I'd love to hear about better ways of
handling this.

I've attached a patch to this email, or you can get the updated script
from:

http://poochiereds.net/svn/lvm2create_initrd

-- 
Jeff Layton <jtlayton poochiereds net>
Index: lvm2create_initrd.sh
===================================================================
--- lvm2create_initrd.sh        (revision 70)
+++ lvm2create_initrd.sh        (working copy)
@@ -77,7 +77,7 @@
                                                                                
 # include in the path some dirs from the real root filesystem
 # for chroot, blockdev
-PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200"
+PATH="/sbin:/bin:/usr/sbin:/usr/bin:/lib/lvm-200:/initrd/bin:/initrd/sbin"
 PRE="initrd:"
                                                                                
 echo "$PRE Remounting / read/write"
@@ -141,6 +141,10 @@
        return 0
 fi
                                                                                
+echo "$PRE Copying /dev/mapper devices to $rootvol"
+cd /dev
+tar cf - ./mapper | ( cd /rootvol/dev; tar xvf - )
+
 echo "$PRE Umounting /proc"
 umount /proc
                                                                                

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