What is initrd
Initial RAM disk - temporary filesystem used during boot to load drivers before mounting root
What is initramfs
Initial RAM filesystem - modern replacement for initrd serving the same purpose
Two main initrd management commands
mkinitrd and dracut
Which initrd tool is considered legacy
mkinitrd
Which initrd tool is the modern standard
dracut
mkinitrd syntax
mkinitrd [options] <initrd-image> <kernel-version></kernel-version></initrd-image>
dracut syntax
dracut [options] <initramfs-image> <kernel-version></kernel-version></initramfs-image>
mkinitrd option to load module early
–preload=<module></module>
mkinitrd option to add specific module
–with=<module></module>
mkinitrd option to force image creation
-f
mkinitrd option to disable compression
–nocompress
dracut option to overwrite existing image
–force
dracut option to add specific drivers
–add-drivers
dracut option to exclude drivers
–omit-drivers
dracut option to disable compression
–no-compress
Key advantage of dracut
Dynamically includes only needed drivers and components
Example mkinitrd command
mkinitrd –preload=ext4 –with=usb-storage -f –nocompress /boot/initrd-5.15.0.img 5.15.0
Example dracut command
dracut –force –add-drivers “xfs nvme” –no-compress /boot/initramfs-5.15.0.img 5.15.0
When initrd/initramfs is used
During boot process before mounting real root filesystem
Purpose of initrd/initramfs
Load essential drivers and modules needed to access the root filesystem