Monday, July 15, 2013

Fedora dracut in chroot environment

The following is the procedure to create new initframfs when the root filesystem has structural changes such as between LVM, MD or plain. 
  • Chroot to the desired folder (.e.g. /mnt/temp)
    chroot /mnt/temp
  • mount the system partitions /proc, /run, /dev, /sys
    mount -t proc proc /proc
    mount -t tmpfs tmpfs /run
    mount -t devtmpfs devtmpfs /dev
    mount -t sysfs sysfs /sys
  • mount the /boot and / partition
    mount -t ext4 /dev/sdb1 /boot
    mount -t ext4 /dev/md0 /
  • Create the udev/data folder to emulate the udev database
    cd /run
    mkdir udev/data
  • To include mdadm in Fedora dracut: add module mdraid found in /usr/lib/dracut/modules.d/
    dracut -v -f -a mdraid --mdadmconf /boot/initramfs-$(uname -r).img $(uname -r)

1 comment:

nd said...

thanks it saved my life..
btw chroot must be run after mounting partitions