LinuxCommandLibrary

mkinitramfs

creates an initial ramdisk image for Linux

TLDR

Generate initramfs for current kernel

$ mkinitramfs -o [/boot/initrd.img]
copy
Generate for specific kernel
$ mkinitramfs -o [/boot/initrd.img-5.10.0] [5.10.0-generic]
copy
Verbose output
$ mkinitramfs -v -o [/boot/initrd.img]
copy
Keep temporary files
$ mkinitramfs -k -o [/boot/initrd.img]
copy

SYNOPSIS

mkinitramfs [options] -o outfile [version]

DESCRIPTION

mkinitramfs creates an initial ramdisk image (initramfs) for Linux. The initramfs contains essential drivers and scripts needed to mount the root filesystem during boot.
This tool is Debian/Ubuntu specific; other distributions use different tools.

PARAMETERS

-o file

Output file.
-d confdir
Config directory.
-k
Keep temporary directory.
-v
Verbose output.
-c compress
Compression method.

CONFIGURATION

$ /etc/initramfs-tools/
├── initramfs.conf
├── modules
├── hooks/
└── scripts/
copy

CAVEATS

Debian/Ubuntu specific (use mkinitcpio on Arch, dracut on Fedora). Must match kernel version. Requires root privileges.

HISTORY

mkinitramfs is part of initramfs-tools developed for Debian-based systems, replacing the older initrd system with a more flexible initramfs approach.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community