On Thu, Jan 01, 2004 at 07:54:14AM -0500, Robert P. J. Day wrote: > in a nutshell, is there a recipe for taking a stock, LVM1-based, FC1 box, > and moving up to LVM2? while changing as little else as possible, and > still being in a position to upgrade to the 2.6 kernel afterwards? given > that the first step of patching the kernel for DM support doesn't really > work cleanly, i'm leery of pushing forward until i know what should > have happened at this step. First a warning: this is not for the faint-of-heart. Have a rescue CD handy, and back up essential files (or at least put them on a non-LVM partition)! I am not responsible if your system ends up unbootable. Well, the version of DM in the Fedora kernel is not terribly useful. It's from an older -ac kernel, and uses the old (v1) ioctl() interface. The latest version of the interface (v4) used in the 2.6 kernel is available from Joe Thornber's patchset. See the end of this message for information on applying the patches to FC1 kernels. As for packages, you need these or later versions from FC development: initscripts-7.43-1 device-mapper-1.00.07-1 lvm2-2.00.08-1 lvm-1.03-17 mkinitrd-3.5.15.1-1 Beware: Apparently, mkinitrd-3.5.16.1 was broken. You can get mkinitrd-3.5.15.1-2 from people.redhat.com/arjanv/2.6 Make the directory /etc/lvm: mkdir /etc/lvm You will also need to temporarily force /sbin/mkinitrd to use LVM2, using something like: --- /sbin/mkinitrd 2003-12-05 21:25:12.000000000 -0500 +++ /var/tmp/mkinitrd 2004-01-01 09:02:51.729458000 -0500 @@ -373,12 +373,6 @@ # If we use LVM, include lvm-mod if [ -z "$nolvm" ]; then - if [ -f /proc/lvm/global ]; then - if grep -q '^VG:' /proc/lvm/global ; then - findmodule -lvm-mod - fi - fi - if [ -x /sbin/dmsetup ]; then dmout=$(/sbin/dmsetup ls) if [ "$dmout" != "No devices found" ]; then @@ -446,8 +440,7 @@ elif ! echo $rootdev | cut -c1-6 |grep -q "LABEL=" ; then rootdev=$(echo "readlink $rootdev" | /sbin/nash --quiet) major=`ls -l $rootdev | sed -e "s/.* \\([0-9]\+\\), *[0-9]\+.*/\\1/"` - [ "$major" != "58" ] || root_lvm=1 - if echo $rootdev |grep -q /dev/mapper 2>/dev/null ; then root_lvm2=1 ; fi + root_lvm2=1 fi rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab) @@ -456,9 +449,6 @@ # in case the root filesystem is modular findmodule -${rootfs} -if [ -n "$root_lvm" ]; then - findmodule -lvm-mod -fi if [ -n "$root_lvm2" ]; then findmodule -dm-mod fi Then you can do KVER=2.6.0-1.21 # whatever mount --bind /var/tmp/mkinitrd /sbin/mkinitrd rpm -ivh kernel-$KVER.i686.rpm umount /sbin/mkinitrd or, if you've already installed the kernel: rm -f /boot/initrd-$KVER.img /var/tmp/mkinitrd -v /boot/initrd-$KVER.img $KVER Verify that dm-mod.o was included in the initrd. You will have the problem that the LVM2 tools will not overwrite device files in, e.g., the /dev/vg0/ directory; it will only overwrite symlinks. (Why? I don't know.) One possibility is to move these files elsewhere, e.g., /dev/lvm1/vg0/, and create symlinks, before rebooting. mkdir /dev/lvm1 cp -a /dev/vg0 /dev/lvm1 cd /dev/vg0 && ln -sf ../lvm1/vg0/* . ls -l Check that they are all symlinks. Alternatively, modify rc.sysinit to remove the files from your VG directories first. (I have not tested this!): --- /etc/rc.d/rc.sysinit 2003-12-05 19:22:54.000000000 -0500 +++ /etc/rc.d/rc.sysinit 2004-01-01 11:15:17.179458000 -0500 @@ -349,6 +349,9 @@ /bin/rm -f /dev/mapper/control echo "mkdmnod" | /sbin/nash --quiet >/dev/null 2>&1 if [ -e /dev/mapper/control -a -x /sbin/lvm ]; then + /sbin/lvm vgscan 2>/dev/null \ + | sed -n -e 's!^.*Found volume group "\([^"]\{1,\}\)".*$!/dev/\1!p' \ + | xargs -r rm -rf action $"Setting up Logical Volume Management:" /sbin/lvm vgscan --mknodes && /sbin/lvm vgchange -a y fi fi N.B.: These hacks are for a one-way trip to LVM2. If you plan on occasionally booting LVM1, you'll hit the same problem again when going back to LVM2, and will want to look more seriously at the problem. There is one final step, that I forgot to mention before (sorry), which is that you need to fastboot, in order to avoid running fsck (which will otherwise fail, because it can't find the root filesystem device on the (read-only) root filesystem: touch /fastboot If you are moving up to 2.6, be sure to examine the documents on migrating to 2.6, check the contents of your /etc/modprobe.conf, etc. I'll reiterate: it helps to have a rescue CD handy when doing these things. That ends the root-on-lvm2 instructions. Now on the issue of building the 2.4 kernel with current DM, take a look at what is modified by the DM patches: [2.4.23-pre7-dm3]$ diffstat *.patch Documentation/Configure.help | 14 MAINTAINERS | 7 arch/mips64/kernel/ioctl32.c | 17 arch/parisc/kernel/ioctl32.c | 17 arch/ppc64/kernel/ioctl32.c | 17 arch/s390x/kernel/ioctl32.c | 15 arch/sparc64/kernel/ioctl32.c | 17 arch/x86_64/ia32/ia32_ioctl.c | 17 drivers/md/Config.in | 10 drivers/md/Makefile | 35 drivers/md/dm-daemon.c | 115 +++ drivers/md/dm-daemon.h | 29 drivers/md/dm-exception-store.c | 677 +++++++++++++++++++ drivers/md/dm-io.c | 370 ++++++++++ drivers/md/dm-io.h | 86 ++ drivers/md/dm-ioctl.c | 1420 ++++++++++++++++++++++++++++++++++++++-- drivers/md/dm-linear.c | 125 +++ drivers/md/dm-log.c | 311 ++++++++ drivers/md/dm-log.h | 112 +++ drivers/md/dm-raid1.c | 1304 ++++++++++++++++++++++++++++++++++++ drivers/md/dm-snapshot.c | 1246 ++++++++++++++++++++++++++++++++++- drivers/md/dm-snapshot.h | 158 ++++ drivers/md/dm-stripe.c | 258 +++++++ drivers/md/dm-table.c | 792 ++++++++++++++++++++-- drivers/md/dm-target.c | 188 +++++ drivers/md/dm.c | 1133 +++++++++++++++++++++++++++++++ drivers/md/dm.h | 177 ++++ drivers/md/kcopyd.c | 680 ++++++++++++++++++- drivers/md/kcopyd.h | 47 + drivers/md/lvm.c | 9 fs/buffer.c | 31 fs/jbd/journal.c | 10 fs/reiserfs/super.c | 2 fs/super.c | 138 +++ include/linux/device-mapper.h | 104 ++ include/linux/dm-ioctl.h | 237 ++++++ include/linux/fs.h | 5 include/linux/jbd.h | 2 include/linux/mempool.h | 31 include/linux/vmalloc.h | 1 kernel/ksyms.c | 3 mm/Makefile | 4 mm/filemap.c | 11 mm/mempool.c | 299 ++++++++ mm/vmalloc.c | 19 45 files changed, 10101 insertions(+), 199 deletions(-) It should not be very difficult to merge; one ought to be able to simply replace the files drivers/md/{Config.in,Makefile,dm-*,k*,lvm.c} include/linux/device-mapper.h include/linux/dm-ioctl.h from a patched Marcelo kernel, and merge the others by hand. mempool.[ch] ought to be approximately the same. The only other large change is the one to fs/super.c, from 00005.patch, which replaces the use of fsync_dev() with fsync_dev_lockfs(). This is a cleanup, and is likely optional. Without 00005.patch, there are likely no significant differences outside of drivers/mod/{dm-*,kcopyd.*} include/linux/dm-ioctl.h include/linux/device-mapper.h on x86. [The ioctl() mapping for bi-arch systems can be ignored.] If that is the case, one can construct a drop-in replacement for dm-mod.o (on x86). Or one could politely ask Dave Jones if he would replace the device-mapper code in the next FC1 kernel. :-) Regards, Bill Rugolsky