Rebuild initial ramdisk image in Linux server – How-To

You may need to rebuild initial ramdisk image after adding new hardware or software to server.

  • Create backup as shown below;

cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).bak.$(date +%m-%d-%H%M%S).img

  • Use following command to rebuild initramfs

dracut -f -v

  • Make sure /boot/grub2/grub.cfg and /etc/grub2.cfg includes the menu to the new custom initramfs
  • Rebuild grub.cfg;

grub2-mkconfig -o /boot/efi/EFI/seimaxim/grub.cfg

Leave a Reply