I've cloned a Linux (Fedora) server system from an IDE drive to a SATA drive but it doesn't boot, failing at switch root. I've done a clean install on the target drive and have learned thru inspection of the initrd files that when installing fedora on a SATA drive it includes the ahci module, which was not used when I had no SATA drives during the installation of my working system.

So I'd like to run mkinitrd to build the new initrd, same as the old but adding the ahci module (probably as a preload)

I'm doing too much guessing, so I wanted to park this question here: Whats the easiest way to build a new initrd from the existing one, just adding a single module?

Here is the diff of the two init files

 diff /media/disk/SATA_initrd/initrd/init /media/disk/PATA_initrd/initrd/init 
> echo "Loading crc-t10dif module"
> modprobe -q crc-t10dif
< echo "Loading ahci module"
< modprobe -q ahci
< echo Waiting for driver initialization.
< stabilized --hash --interval 250 /proc/scsi/scsi
> echo "Loading pata_amd module"
> modprobe -q pata_amd
> echo Waiting for driver initialization.
> stabilized --hash --interval 250 /proc/scsi/scsi

and the init file from the initrd that I want to modify.


mount -t proc /proc /proc
echo Mounting proc filesystem
echo Mounting sysfs filesystem
mount -t sysfs /sys /sys
echo Creating /dev
mount -o mode=0755 -t tmpfs /dev /dev
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
mkdir /dev/shm
mkdir /dev/mapper
echo Creating initial device nodes
mknod /dev/null c 1 3
mknod /dev/zero c 1 5
mknod /dev/systty c 4 0
mknod /dev/tty c 5 0
mknod /dev/console c 5 1
mknod /dev/ptmx c 5 2
mknod /dev/tty0 c 4 0
mknod /dev/tty1 c 4 1
mknod /dev/tty2 c 4 2
mknod /dev/tty3 c 4 3
mknod /dev/tty4 c 4 4
mknod /dev/tty5 c 4 5
mknod /dev/tty6 c 4 6
mknod /dev/tty7 c 4 7
mknod /dev/tty8 c 4 8
mknod /dev/tty9 c 4 9
mknod /dev/tty10 c 4 10
mknod /dev/tty11 c 4 11
mknod /dev/tty12 c 4 12
mknod /dev/ttyS0 c 4 64
mknod /dev/ttyS1 c 4 65
mknod /dev/ttyS2 c 4 66
mknod /dev/ttyS3 c 4 67
echo Setting up hotplug.
echo Creating block device nodes.
echo "Loading ehci-hcd module"
modprobe -q ehci-hcd
echo "Loading ohci-hcd module"
modprobe -q ohci-hcd
echo "Loading uhci-hcd module"
modprobe -q uhci-hcd
mount -t usbfs /proc/bus/usb /proc/bus/usb
echo "Loading ext3 module"
modprobe -q ext3
echo "Loading crc-t10dif module"
modprobe -q crc-t10dif
echo "Loading scsi_mod module"
modprobe -q scsi_mod
echo "Loading sd_mod module"
modprobe -q sd_mod
echo "Loading libata module"
modprobe -q libata
echo "Loading ata_generic module"
modprobe -q ata_generic
echo "Loading pata_acpi module"
modprobe -q pata_acpi
echo Waiting for driver initialization.
stabilized --hash --interval 250 /proc/scsi/scsi
echo "Loading pata_amd module"
modprobe -q pata_amd
echo Waiting for driver initialization.
stabilized --hash --interval 250 /proc/scsi/scsi
echo "Loading dm-mod module"
modprobe -q dm-mod
echo "Loading dm-mirror module"
modprobe -q dm-mirror
echo "Loading dm-zero module"
modprobe -q dm-zero
echo "Loading dm-snapshot module"
modprobe -q dm-snapshot
echo Making device-mapper control node
modprobe scsi_wait_scan
rmmod scsi_wait_scan
echo Scanning logical volumes
lvm vgscan --ignorelockingfailure
echo Activating logical volumes
lvm vgchange -ay --ignorelockingfailure  VolGroup00
resume /dev/VolGroup00/LogVol01
echo Creating root device.
mkrootdev -t ext3 -o defaults,ro /dev/VolGroup00/LogVol00
echo Mounting root filesystem.
mount /sysroot
echo Setting up other filesystems.
echo Switching to new root and running init.
echo Booting has failed.
sleep -1

4 Answers 4


You do not need to worry about all the already installed modules. To begin with, boot into the rescue disk.

chroot /mnt/sysimage      # this is for Fedora specifically - YMMV
cp /boot/initrd- \
mkinitrd --preload ahci -f /boot/initrd- \

exit and reboot the system. 


You don't have to worry about all the modprobes before the "driver initialization"

ignore  --> use the --preload *MODNAME* in the arguments to mkinitrd
ignore  --> for all the rest use --with

JUST add a --preload ahci

helpful links:

  • 1
    Or skip the --preload, add the correct alias into /etc/modules.conf, then perform the mkinitrd.
    – hurfdurf
    Jan 19, 2011 at 3:52

On a Debian system, you edit /etc/initramfs-tools/modules, and put one module name per line into the file. Then you run "mkinitramfs" and voila, it's done.

For Fedora, just put the module name in /etc/modprobe.conf and run mkinitrd. See also https://fedoraproject.org/wiki/KernelCommonProblems.

  • that file doesn't exist on my system..
    – jbdavid
    Jun 21, 2009 at 8:42
  • 3
    run update-initramfs -u (instead of "mkinitramfs")
    – Brent
    Jan 8, 2010 at 23:30

You need to create a new image and copy the contents of your "old" initrd over to the new and add your module:

dd if=/dev/zero of=~/file-inird count=2500 bs=1024 (or bigger if needed)
losetup /dev/loop0 ~/file-inird
mke2fs /dev/loop0
mkdir ~/mnt
mount /dev/loop0 ~/mnt
cp -a old_mounted_initrd/* ~/mnt/

[.. add your changes ..]

umount ~/mnt
losetup -d /dev/loop0
gzip -c ~/file-inird > initrd-<kernel-version>

I also found this :)


  • mkinitrd is supposed to handle most of the mechanics of that stuff.. its what fedora uses when it updates the kernel.. so I just want to "trick" it into adding the sata module needed.
    – jbdavid
    Jun 17, 2009 at 17:01
  • Ok thought you wanted to change an already existing initrd to add the module/conf.. So you didn't have to boot up your old installation to make a new initrd ;)
    – rkthkr
    Jun 17, 2009 at 17:07
  • I was thinking of using the Fedora 9 Rescue disk (install DVD in rescue mode). I guess I could boot the IDE drive again, add the module then reclone the drive too.. Guess I'm playing it too safe!
    – jbdavid
    Jun 18, 2009 at 8:15
  • and the link to initrd-util says it hadn't been tested on the cpio style archives initrd uses now.
    – jbdavid
    Jun 18, 2009 at 8:19
  • You can easily create those cpio module archives manually also :)
    – rkthkr
    Jun 18, 2009 at 8:54

Don't you just add the module to /etc/modprobe.conf then run mkinitrd?

  • I'll give that a try! first some sleep. A thought.. I might need to be booted on the original (pata) disk for that to work.. but re-cloning doesn't take long. (with clonezilla)
    – jbdavid
    Jun 19, 2009 at 8:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .