[Mageia-dev] RFC: Drop mkinitrd completely in favour of dracut.

David W. Hodgins davidwhodgins at gmail.com
Sat Dec 3 10:21:23 CET 2011


On Sat, 03 Dec 2011 01:05:31 -0500, Thomas Backlund <tmb at mageia.org> wrote:

Fyi. On one of my cauldron installs, I have /usr in a lvm
logical volume.  In order to get this to be bootable, I
modified /etc/dracut.conf to have
add_drivers+="dm_mod dm_crypt"
and
install_items+=(/bin/grep /lib/libpcre.so.0.0.1 /lib/libpcre.so.0 /lib/libdevmapper-event.so.1.02 /lib/libdevmapper.so.1.02 /lib/libreadline.so.6 /lib/libncurses.so.5 /sbin/lvm /lib/modules/3.1.4-server-1.mga2/kernel/drivers/md/dm-crypt.ko.gz /lib/modules/3.1.4-server-1.mga2/kernel/drivers/md/dm-mod.ko.gz /sbin/dmsetup /sbin/lsmod )

I modified /usr/share/dracut/modules.d/98usrmount/mount-usr.sh to have ...
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh

type info >/dev/null 2>&1 || . /lib/dracut-lib.sh
type fsck_single >/dev/null 2>&1 || . /lib/fs-lib.sh

mount_usr()
{
     local _dev _mp _fs _opts _rest _fs_found _ret _mount_point
     if ! __fgrep "device-mapper" /proc/devices >/dev/null 2>&1 ; then
        modprobe dm-mod >/dev/null 2>&1
     fi
     /sbin/lvm vgchange -a y --sysinit
fsck_mount()
(
     # check, if we have to mount the filesystem
     _fs_found=""
     while read _dev _mp _fs _opts _rest; do
         if [ "$_mp" = "/$_mount_point" ]; then
             echo "$_dev $NEWROOT/$_mp $_fs ${_opts} $_rest"
             _fs_found="1"
             break
         fi
     done < "$NEWROOT/etc/fstab" >> /etc/fstab
     if [ "x$_fs_found" != "x" ]; then
         # we have to mount it
         fsck_single "$_dev" "$_fs"
         _ret=$?
         echo $_ret >/run/initramfs/$_mount_point-fsck
         if [ $_ret -ne 255 ]; then
             info "Mounting /$_mount_point"
             mount "$NEWROOT/$_mount_point" 2>&1 | vinfo
         fi
     fi
)
     _mount_point="usr"; fsck_mount
     _mount_point="var"; fsck_mount
     _mount_point="var/mnt"; fsck_mount
     _mount_point="opt"; fsck_mount
     _mount_point="tmp"; fsck_mount
     _mount_point="home"; fsck_mount
}

mount_usr

I initially only had the /usr being mounted, but found that when it
got around to trying to mount the next lv, it would report that the
mount timed out due to a dependency failure, but with no indication
of why.  I ended up modifying the script to mount all of my lvm
partitions, in the initramfs, to get it to work.

Regards, Dave Hodgins



More information about the Mageia-dev mailing list