Rebuilding the initial ramdisk

From Leo's Notes
Last edited on 6 September 2022, at 21:11.

The initial ramdisk, also known as initrd or initramfs, contains a small filesystem that is used as part of the first stage of the Linux boot process. This filesystem must contain all the necessary files and kernel modules that the kernel needs in order to continue on the boot process. When upgrading a kernel or changing a system's hardware, it may be necessary to rebuild the initrd file so that it contains the appropriate kernel modules.

Rebuilding the initial ramdisk[edit | edit source]

On Red Hat Enterprise Linux 6, 7, 8, 9 or its derivatives, the initrd file resides in the /boot directory and is generated by the dracut utility.

You can re-generate the initrd file for a specific kernel version by running:

# KernelVersion="4.18.0-348.23.1.el8_5.x86_64"
# dracut -f /boot/initramfs-$KernelVersion.img $KernelVersion

See Also[edit | edit source]