$linuxjunkies
>

dracut(8)

dracut generates a bootable initramfs image for the Linux kernel.

UbuntuDebianFedoraArch

Synopsis

dracut [OPTION]... [<image>] [<kernel-version>]

Description

dracut creates an initramfs (initial RAM filesystem) that is loaded by the bootloader before the main kernel. It includes kernel modules, drivers, and init scripts needed to boot the system, mount the root filesystem, and hand control to the main init system.

The generated initramfs is essential for systems with modular kernels, LVM, RAID, encrypted partitions, or complex storage configurations. dracut automatically detects most hardware and dependencies, but can be customized via configuration files and command-line options.

Common options

FlagWhat it does
-f, --forceOverwrite existing initramfs image without confirmation
-o, --omit MODULEOmit a dracut module from the initramfs (e.g., plymouth, crypt)
-a, --add MODULEAdd a dracut module to the initramfs
-m, --modulesSpecify modules to include; overrides auto-detection
--hostonlyInclude only drivers and modules for detected hardware (faster boot, less portable)
--no-hostonlyBuild a generic initramfs for any hardware (larger, more compatible)
-H, --hostonly-cmdlineInclude kernel command-line parameters detected at build time
-l, --listList the contents of an existing initramfs image
-v, --verboseIncrease verbosity; show detailed build process
-N, --no-hostonly-default-device-modulesDon't add hostonly device modules unless explicitly required
--kver VERSIONSpecify kernel version; defaults to current running kernel
--reproducibleCreate reproducible initramfs (fixed timestamps, no randomness)

Examples

Generate initramfs for the current kernel, overwriting if it exists

dracut -f

Create initramfs for kernel version 5.15.0-generic at a custom path

dracut -f /boot/initramfs-custom.img 5.15.0-generic

Build a hardware-specific initramfs for faster boot on this machine

dracut --hostonly -f

Generate initramfs without crypt and lvm modules (for unencrypted, non-LVM systems)

dracut -o crypt -o lvm -f

Explicitly include crypt and lvm modules even if not auto-detected

dracut -a crypt -a lvm -f

List the first 20 files in an existing initramfs image

dracut -l /boot/initramfs-5.15.0.img | head -20

Build with verbose output and show which modules are being added

dracut -v -f 2>&1 | grep -i 'adding modules'

Create a hardware-optimized, reproducible initramfs for consistent builds

dracut --reproducible --hostonly -f

Related commands