Introduction

Sometimes it is necessary to include extra drivers in the boot process. I came across this recently when wanting to switch an older server from ATA to SATA drives. The tool to use for this on CentOS is mkinitrd, which (re)creates the initial RAM disk (initrd) for the boot process.

Prerequisites

  • Create a backup of the current initrd:
    cp /boot/initrd-`uname -r`.img /boot/initrd-`uname -r`.img.bak

Examples

  • Create a new initrd, explicitly including SATA drivers:
    mkinitrd -f --with=sd_mod --with=libata /boot/initrd-`uname -r`.img `uname -r`
    This creates a new initrd in /boot/initrd-`uname -r`.img, explicitly including he sd_mod and libata drivers.
  • However, nowadays mkinitrd is clever enough to work out where your root file system lives, so the default is probably enough:
    mkinitrd -f /boot/initrd-`uname -r`.img `uname -r`
    This creates an initrd where the appropriate drivers are automatically detected.