Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124

Explaining why Linux made the switch from initrd to the newer initramfs
While fixing some boot-related issues on my system, one thing caught my eye: Linux still uses the legacy initrd name as a pointer to the more modern initial file system, the initramfs introduced in 2005. I thought it would be a good idea to explain why Linux made the switch to initramfs. In this post, I’ll try to compare both these systems.
An init file system is a temporary file system that is used by the Linux kernel during the boot process to load the essential kernel modules/drivers and scripts required to mount the actual root file system and start the system.
The bootloader loads both the kernel (vmlinuz) and the initial file system into the RAM (located at /boot) and then passes a pointer to the kernel to point to the initial file system. The first thing that the kernel does after the handover from the bootloader to the kernel is complete is to uncompress itself (vmlinuz) and then start executing the instructions in the init file system.
A question can arise: Why is it even required? And this is the core paradox or the “Chicken and egg problem”. To continue the boot process, the root file system needs to be mounted. To mount the root file system, the kernel needs access to the disks, and to read the disk, disk drivers are required, which are stored on the disk the kernel is trying to access.
The kernel is not supplied with everything already baked into it directly. Doing so would make the code difficult to maintain and the boot process slower. And because there can be different types of hardware, providing support for each type of hardware is practically not possible. Therefore, a separate initial root file system is provided with all the required ingredients.
The initial file system packs everything that the kernel requires in a single source, speeding the boot process. The following are the resources that such an initial file system supplies:
Once the kernel comes into control, it starts to run instructions from the initial file system, loads the required kernel modules, reads the disk, locates the real root file system, and then switches from the initial file system to the real file system. After the switch is made to the actual root file system, the initial file system is discarded, and the real root file system is in control.
Enough talking about the initial file system, and providing a high-level working, now let’s dig a little deeper and understand how these two work differently and make a comparison.
| Aspect | initrd (Initial RAM Disk) | initramfs (Initial RAM Filesystem) |
|---|---|---|
| Era | Linux 2.2 / 2.4 (legacy) | Linux 2.6+ (current) |
| Purpose | Temporary root filesystem during early boot | Same purpose, redesigned |
| On-disk format | Compressed block device image | Compressed cpio archive |
| Internal FS | ext2 (usually) | None (extracted into tmpfs) |
| How kernel uses it | Creates RAM disk and mounts it as / | Unpacks directly into RAM |
| Requires mount | Yes | No |
| Root FS type | ramdisk block device | tmpfs |
| Size | Fixed at creation time | Dynamic (grows as needed) |
| Boot script | /linuxrc | /init |
| Root switch method | pivot_root | switch_root |
| Device handling | Static /dev nodes | Dynamic (usually udev) |
| Module loading | insmod (often manual) | modprobe |
| Userspace tools | Very minimal | More flexible |
| Error handling | Limited | Much better |
| Kernel support status | Obsolete | Actively supported |
| Still used today | No (emulated only) | Yes (standard) |