What is initrd image in Linux

initrd provides the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root filesystem and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted.

 

How initrd works

 

initrd provides the capability to load a RAM disk by the bootloader. This RAM disk can then be mounted as the root fileystem and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. Theprevious root (from initrd) is then moved to a directory andcan be subsequently unmounted. initrd is mainly designed to allow system startup to occur  in two phases, where the kernel comes up with a minimum set of compiled-in drivers, and where additional modules are  loaded from initrd.

 

When using initrd, the system typically boots as follows:

 

  1. The boot loader loads the kernel and the initial RAM disk
  1. The kernel converts initrd into a “normal” RAM disk and frees the memory used by initrd
  1. initrd is mounted read-write as root
  1. /linuxrc is executed (this can be any valid executable, including shell scripts; it is run with uid 0 and can do basically everything init can do)
  1. linuxrc mounts the “real” root file system
  1. linuxrc places the root file system at the root directory using the pivot_root system call
  1. The usual boot sequence (e.g. invocation of /sbin/init) is performed on the root file system

8. The initrd file system is removed