Adding storage, network and 3rd party kernel modules to a Linux initrd image

While playing around with initrd images a few weeks back, I came across the mkinitrd “–with” option. This option allows you to add additional modules to an initrd image, which is useful when you have a new storage or Ethernet driver that isn’t supported by the base operating system. To use this option, you can place the names of the modules to add to the initrd image in quotes, and pass them to the “–with” option:

$ mkinitrd -v --with="aoe virtio"


To verify the image contains the modules you specified, you can extract the initrd image and poke around the lib/modules directory:

$ gunzip < initrd- | cpio -i

$ cd lib/modules/

$ find . -name aoe ./

$ find . -name virtio ./

If you want the modules included in all future mkinitrd runs, you can add the modules to the modules variable in the/etc/sysconfig/initrd file. Nice!

This article was posted by Matty on 2009-08-04 17:29:00 -0400 EDT