This document was created by man2html using the manual pages.
Section: Maintenance Commands (8)
Updated: Sat Mar 27 1999
Index Return to NetAdminTools


mkinitrd - creates initial ramdisk images for preloading modules  


mkinitrd [--version] [-v] [-f]
         [--preload=module] [--omit-scsi-modules] 
         [--omit-raid-modules] [--omit-lvm-modules] 
         [--with=module] [--image-version]
         [--fstab=fstab] [--nocompress]
         [--builtin=module] [--nopivot]
         image kernel-version



mkinitrd creates filesystem images which are suitable for use as Linux initial ramdisk (initrd) images. Such images are often used for preloading the block device modules (such as IDE, SCSI or RAID) which are needed to access the root filesystem. mkinitrd automatically loads filesystem modules (such as ext3 and jbd), IDE modules, all scsi_hostadapter entries in /etc/modules.conf, and raid modules if the system's root partition is on raid, which makes it simple to build and use kernels using modular device drivers.

Any module options specified in /etc/modules.conf are passed to the modules as they are loaded by the initial ramdisk.

If the root device is on a loop device (such as /dev/loop0), mkinitrd will build an initrd which sets up the loopback file properly. To do this, the fstab must contain a comment of the form:

    # LOOP0: /dev/hda1 vfat /linux/rootfs

LOOP0 must be the name of the loop device which needs to be configured, in all capital lettes. The parameters after the colon are the device which contains the filesystem with the loopback image on it, the filesystem which is on the device, and the full path to the loopback image. If the filesystem is modular, initrd will automatically add the filesystem's modules to the initrd image.

The root filesystem used by the kernel is specified in the boot configuration file, as always. The traditional root=/dev/hda1 style device specification is allowed. If a label is used, as in root=LABEL=rootPart the initrd will search all available devices for an ext2 or ext3 filesystem with the appropriate label, and mount that device as the root filesystem.



Act as if module is built into the kernel being used. mkinitrd will not look for this module, and will not emit an error if it does not exist. This option may be used multiple times.

Allows mkinitrd to overwrite an existing image file.

Use fstab to automatically determine what type of filesystem the root device is on. Normally, /etc/fstab is used.

The kernel version number is appended to the initrd image path before the image is created.

Normally the created initrd image is compressed with gzip. If this option is specified, the compression is skipped.

--nopivot Do not use the pivot_root system call as part of the initrd. This lets mkinitrd build proper images for Linux 2.2 kernels at the expense of some features. In particular, some filesystems (such as ext3) will not work properly and filesystem options will not be used to mount root. This option is not recommended, and will be removed in future versions.

Do not load any lvm modules, even if /etc/fstab expects them.

Do not load any raid modules, even if /etc/fstab and /etc/raidtab expect them.

Do not load any scsi modules, including 'scsi_mod' and 'sd_mod' modules, even if they are present.

Load the module module in the initial ramdisk image. The module gets loaded before any SCSI modules which are specified in /etc/modules.conf. This option may be used as many times as necessary.

Prints out verbose information while creating the image (normally the mkinitrd runs silently).

Prints the version of mkinitrd that's being used and then exits.

Load the modules module in the initial ramdisk image. The module gets loaded after any SCSI modules which are specified in /etc/modules.conf. This option may be used as many times as necessary.



A block loopback device is used to create the image, which makes this script useless on systems without block loopback support available.

Specified SCSI modules to be loaded and module options to be used.


fstab(5), insmod(1), (8), lilo(8)



Erik Troan <[email protected]>




Return to NetAdminTools,