The main motivation for implementing initrd was to allow for modular kernel configuration at system installation.
A possible system installation scenario is as follows:
1. The loader program boots from floppy or other media with a minimal kernel (e.g. support for /dev/ram", "/dev/initrd", and the ext2 file-system) and loads " /dev/initrd"withagzippedversionoftheinitialfile-system.
2. The executable /linuxrc determines what is needed to (1) mount the normal root file-system (i.e. device type, device drivers, file system) and (2) the distribution media (e.g. CD-ROM, network, tape, ...). This can be done by asking the user, by auto-probing, or by using a hybrid approach.
3. The executable /linuxrc loads the necessary modules from the initial root file-system.
4. The executable /linuxrc creates and populates the root file system. (At this stage the normal root file system does not have to be a completed system yet.)
5. The executable /linuxrc" sets "/proc/sys/kernel/real-root-dev, unmount /proc", " the normal root file system and any other file systems it has mounted, and then terminates.
6. The kernel then mounts the normal root file system.
7. Now that the file system is accessible and intact, the boot loader can be installed.
8. The boot loader is configured to load into /dev/initrd a file system with the set of modules that was used to bring up the system. (e.g. Device /dev/ram0 can be modified, then unmounted, and finally, the image is written from /dev/ram0 to a file.)
9. The system is now bootable and additional installation tasks can be performed.
The key role of /dev/initrd in the above is to re-use the configuration data during normal system operation without requiring initial kernel selection, a large generic kernel or, recompiling the kernel.
A second scenario is for installations where Linux runs on systems with different hardware configurations in a single administrative network. In such cases, it may be desirable to use only a small set of kernels (ideally only one) and to keep the system-specific part of configuration information as small as possible. In this case, create a common file with all needed modules. Then, only the the /linuxrc file or a file executed by /linuxrc would be different.
A third scenario is more convenient recovery disks. Because information like the location of the root file-system partition is not needed at boot time, the system loaded from /dev/initrd can use a dialog and/or auto-detection followed by a possible sanity check.
Last but not least, Linux distributions on CD-ROM may use initrd for easy installation from the CD-ROM. The distribution can use LOADLIN to directly load /dev/initrd from CD-ROM without the need of any floppies. The distribution could also use a LILO boot floppy and then bootstrap a bigger ram disk via /dev/initrd" from the CD-ROM."
The /dev/initrd is a read-only block device assigned major number 1 and minor number 250. Typically /dev/initrd is owned by root.disk with mode 0400 (read access by root only). If the Linux system does not have /dev/initrd already created, it can be created with the following commands:
mknod -m 400 /dev/initrd b 1 250
chown root:disk /dev/initrd
Also, support for both "RAM disk" and "Initial RAM disk" (e.g. CONFIG_BLK_DEV_RAM=y" and "CONFIG_BLK_DEV_INITRD=y ) support must be compiled directly into the Linux kernel to use /dev/initrd"." When using /dev/initrd", " the RAM disk driver cannot be loaded as a module.
chown(1), mknod(1), ram(4), freeramdisk(8), rdev(8),