4.8 initrd: Using a RAM Disk
Modern Linux
distributions use a modular kernel, which allows modules to be added
without requiring that the kernel be rebuilt. If your root
filesystem is on a device whose driver
is a module (as is frequently true of SCSI disks), you can use the
initrd facility, which provides a
two-stage boot process, to first
set up a temporary root filesystem in a
RAM disk containing the modules you need to add (e.g., the SCSI
driver) and then load the modules and mount the real root filesystem.
The RAM disk containing the temporary filesystem is the special
device file /dev/initrd.
Similarly, you need to use a RAM disk if your root partition uses the
ext3 filesystem and ext3 was not
compiled into the kernel image. In that case, the ext3 module must be
loaded with initrd.
Before you can use initrd, both
RAM disk support (CONFIG_BLK_DEV_RAM=y) and initial RAM disk
support (CONFIG_BLK_DEV_INITRD=y)
must be compiled into the Linux kernel. Then you need to prepare the
normal root filesystem and create the RAM disk image. Your Linux
distribution may have utilities to do some of the setup for you; for
example, the Red Hat distribution comes with the mkinitrd command, which builds the initrd image. For detailed information, see
the initrd manpage and the file
initrd.txt (the path may vary, but is usually
something like
/usr/src/linux/Documentation/initrd.txt).
Once your Linux system has been set up for initrd, you can do one of the following,
depending on which boot loader you are using:
If you are using LILO, add the initrd option to the appropriate image
section: image=/vmlinuz
initrd=/boot/initrd # The file to load as the contents of /dev/initrd
... Run the /sbin/lilo command, and you
can reboot with initrd.
If you are using GRUB, add the initrd option to the kernel line of the
configuration file boot entry, or to the kernel command if you are booting from the
command-line interface: kernel /vmlinuz-2.4.18-14 ro root=LABEL=/ hdc=ide-scsi
initrd /initrd-2.4.18-14.img
If you are using
Loadlin, add the initrd option to the command line: loadlin c:\linux\vmlinuz initrd=c:\linux\initrd
|