MKINITRD(8)

NAME
mkinitrd - create or rebuilt an initrd (initial ramdisk) using initramfs (simple cpio+gzip).

SYNOPSIS
mkinitrd [ -F ] [ -c ] [ -f filesystem ] [ -h hibernate_partition ] [ -k kernel_version1:kernel_version2:kernel_version3... ] [ -m module1:module2:module3... ] [ -XFW firmware1:firmware2:firmware3... ] [ -o output_file ] [ -r root_device ] [ -s source_tree ] [ -u ] [ -w wait_time ] [ -C device1:device2:device3... ] [ -K luks_keyfile ] [ -P microcode_archive ] [ -B ] [ -L ] [ -R ] [ -V ]

DESCRIPTION
mkinitrd is used to build an initial ramdisk. An initial ramdisk is a very small set of files that are loaded into RAM and "mounted" (as initramfs doesn't actually use a filesystem) as the kernel boots (before the main root filesystem is mounted). The usual reason to use an initrd is to load kernel kernel modules in order to access the root partition. An initrd might also be required to unlock an encrypted device. Usually these modules are required to support the filesystem used by the root partition (e.g., ext4, jfs, xfs), or perhaps the controller that the hard drive is attached to (SCSI, RAID, etc). Essentially, there are so many different options available in modern Linux kernels that it isn't practical to try to ship many different kernels to try to cover everyone's needs. It's a lot more flexible to ship a generic kernel and a set of kernel modules for it.

OPTIONS

-F  Use the contents of /etc/mkinitrd.conf as options to mkinitrd (optional). If this is used in conjunction with any other options passed on the command line, the command-line options will override the config file options.
    See mkinitrd.conf(5) for details.

-c  Clear the existing initrd tree (by default in /boot/initrd-tree/) first. If this is not done, running mkinitrd will add additional modules to the existing initrd.

-f filesystem
    Specify the filesystem to use for the root partition. If this isn't given, mount will usually figure it out. This option must be used together with the -r option in order to be beneficial.

--help
    Display a help summary.

-h hibernate_partition
    Specify the swap partition holding the hibernation image.

-k kernel version list
    Use kernel modules from the specified kernel version. mkinitrd will look for them in /lib/modules/(kernel version). This may be a single kernel version, or it may be a colon-delimited list of kernel versions.

-l keymap
    Load an alternative keyboard mapping. All supported keyboard mappings can be found in /usr/share/mkinitrd/keymaps.tar.gz Leave the '.bmap' out when you supply this parameter. E.g. '-l nl' will add support for dutch keyboard mapping to the initrd.

-m module list
    This is a list of colon-delimited modules to build into the initrd. Any dependencies of requested modules will also be added to the initrd. Additional options may be added to use when loading the kernel modules (but in this case the entire list must be wrapped with double quotes).

-XFW firmware list
    This is a list of colon-delimited firmware files to build into the initrd. An example would be EDID (Extended Display Identification Data) files needed for video drivers to correctly configure the display device.

-o output image
    The file to write the initrd to. (default: /boot/initrd.gz)

-r root_device
    Specify the device to be used as the root partition. If this isn't given, the kernel default will be used (which is usually fine). This option must be used together with the -f option in order to be beneficial. root_device can be a device node path, UUID, or LABEL. See examples for -C below.

-s source tree
    The directory to use as the source for the initrd. (default: /boot/initrd-tree/)

-u  Include udev in the initrd (provided for backward compatibility, as udev is always included in the initrd).

-w  The -w option specifies how long to wait in seconds before assuming that all the drives are spun up and ready to go.

-C device_list
    A colon (:) delimited list of luks encrypted block devices to be unlocked by the initrd using cryptsetup. device_list may include any of: device node path, UUID, or LABEL. All devices that must be unlocked in order to access the root filesystem must be specified. For example:
      -C /dev/sda2:/dev/sda3
      -C UUID=ec6dea40-c8d8-4590-850a-a757be60e45a
      -C LABEL=darkstar Each unlocked device will be assigned an automatically generated luks device name of the form luks<device> where '<device>' will be the basename of the encrypted device node path. For example:
      /dev/mapper/lukssda2 As a convenience to users, where -r specifies one of the device names listed on the -C option it will be automatically adjusted to use the correct luks device name. i.e.
      "-C /dev/sda2 -r /dev/sda2" and
      "-C /dev/sda2 -r /dev/mapper/lukssda2" are equivalent.
    (Use with '-r' option).

-K luks_keyfile
    When using cryptsetup to encrypt your partition, you can use a keyfile instead of a passphrase to unlock the LUKS volume. The LUKSKEY variable holds the filename of a keyfile, as well as the label (or uuid) of the partition this file is on. This way, you can unlock your computer automatically if you have a USB stick with your LUKS key inserted at boot. A passphrase will still be asked if the LUKS key can not be found.
    For example, if your USB thumb drive has a FAT partition with label "TRAVELSTICK" and the actual keyfile is called "/keys/alien.luks", then you need to set:
      -K LABEL=TRAVELSTICK:/keys/alien.luks

-T device list
    A colon (:) delimited list of luks encrypted block devices to be passed the "--allow-discards" option when unlocked by the initrd using cryptsetup, e.g.
      -T /dev/sda2:/dev/sda4 This has the effect of allowing TRIM on SSD drives. Be sure your SSD supports this feature (correctly) before enabling it. See fstrim(8) for more information.

-P microcode_archive
    This option specifies a cpio archive containing updated microcode for your CPU. CPU manufacturers occasionally release such updates to fix bugs in the microcode currently embedded in the CPU. The microcode archive will be prepended to the output initrd, where the kernel will find it for early patching:
      -P /boot/intel-ucode.cpio

-B  This option adds the btrfs utility to the initrd so that multi-device filesystems will be picked up by a scan (/sbin/btrfs device scan). This is needed if the root filesystem is a Btrfs multi-device filesystem.

-L  This option adds LVM support to the initrd, if the tools are available on the system.

-R  This option adds RAID support to the initrd, if a static mdadm binary is available on the system.

-M  This option add the files in /etc/modprobe.d/ and /lib/modprobe.d/ to the initrd.

-MNT mount_point_list
    List of filesystems to be mounted by initrd. Useful if libraries or commands that are outside the root filesystem are needed in early boot. Multiple filesystems can be listed separated by colon (:), e.g.
      -MNT /usr:/usr/local

-V  Display version information and exit.

EXAMPLES
A simple example: Build an initrd for a reiserfs root partition:
  mkinitrd -c -m reiserfs Another example: Build an initrd image using Linux 2.6.33.1 kernel modules for a system with an ext3 root partition on /dev/sdb3:
  mkinitrd -c -k 2.6.33.1 -m ext3 -f ext3 -r /dev/sdb3 An example of a single encrypted partition setup:
As a user convenience, the value for the "-r" option may also be specified as "/dev/sda2" in this example:
  mkinitrd -c -k 2.6.33.1 \
           -m ext4:ehci-hcd:uhci-hcd:usbhid \
           -f ext4 -r /dev/mapper/lukssda2 \
           -C /dev/sda2 \
           -l uk Finally, A more complex example:
This one is for a LVM Volume Group (rootvg) comprising of two LVM Physical Volumes, each of which is on a LUKS encrypted partition that will need to be unlocked before the root filesystem (/dev/rootvg/lvroot) can be accessed.
  mkinitrd -c -k 2.6.29.6 \
           -m ext4:ehci-hcd:uhci-hcd:usbhid \
           -f ext4 -r /dev/rootvg/lvroot \
           -L -C /dev/sda2:/dev/sdb2 \
           -l uk If run without options, mkinitrd will rebuild an initrd image using the contents of the $SOURCE_TREE directory, or, if that directory does not exist it will be created and populated, and then mkinitrd will exit. These options are handy for building an initrd mostly by hand. After creating /boot/initrd-tree/, you can add modules and edit files by hand, and then rerun mkinitrd to create the initrd. Once the initrd is created, you'll need to tell your boot loader to load it. If you boot with LILO, you will need to add an initrd line to /etc/lilo.conf. Here's a section of lilo.conf that shows how to set this up:
 # Linux bootable partition config begins
 image = /boot/vmlinuz-generic-2.6.33.1
   initrd = /boot/initrd.gz
   root = /dev/sda3
   label = Linux26331
   read-only
 # Linux bootable partition config ends Note that the line "root = /dev/sda3" is not needed if the root device has been configured in the initrd image. Once you've created the initrd and editing /etc/lilo.conf, you will need to run 'lilo' to write out the changed boot block. The next time you reboot the initrd should be loaded along with the kernel. Have fun!

SEE ALSO
mkinitrd.conf (5)

AUTHOR
Patrick J. Volkerding <volkerdi@slackware.com>