Interview Prep/Linux/Boot Process & Kernel

What is the initramfs and why is it needed?

AdvancedConceptBoot Process & Kernel
Answer

In one line: The initramfs is a small temporary filesystem loaded into memory at boot. It contains just enough tools and drivers to find and mount your real root disk.

Why it's needed — a simple analogy: to open a locked cupboard you need the key, but the key is inside the cupboard. The initramfs is the spare key kept outside. The kernel needs drivers to read the root disk, but those drivers live on the root disk. So a small copy of the needed drivers is packed into the initramfs and loaded into memory first.

This matters most when the root disk uses:

  • LVM (logical volumes)
  • Software RAID
  • Disk encryption (LUKS)
  • Network storage (NFS, iSCSI)

Example — rebuild the initramfs after a storage or driver change:

sudo update-initramfs -u      # Ubuntu/Debian
sudo dracut -f                # RHEL/CentOS/Rocky
lsinitramfs /boot/initrd.img-$(uname -r) | head   # see what's inside (Ubuntu)

Real-world symptom: if the initramfs is missing a driver, the boot stops with an error like "cannot find root device" and drops you into an emergency shell.

All Linux questions Roadmap: Linux

More on Boot Process & Kernel