next up previous contents
Next: Making Diskette Images without Up: Linux Boot Loaders Compared Previous: Example Installations   Contents

Subsections


RAM Disks

The Linux kernel needs to mount a root file system before it can execute any processes. For rescue diskettes and CD's it is often quite natural to load the root file system into a RAM disk at boot time and mount the root file system on the RAM disk. This has the following advantages:

Living without a RAM disk

For a Linux installation on a hard disk it is quite natural not to use a RAM disk, but for a Linux installation that is booted from a diskette (without depending on a root file system elsewhere) there is only one valid reason not to use a RAM disk: you don't have enough RAM for the RAM disk. As a rule of thumb, if you have less than 6-8MB of RAM. you will probably need to boot without a RAM disk, though it can be achieved with 4MB if you really strip things down.

If you boot from a diskette without a RAM disk, with the root file system on a diskette, the kernel will always prompt for an extra diskette, so the kernel and the root file systems can live on separate diskettes. The root file system cannot be compressed. It is of course possible to put both on a single diskette. In that case the boot diskette contains the root file system and in that root file system the kernel lives, as would be the case with most hard disk installations. On the boot diskette you need to install a boot loader that can live inside that file system, which rules out SYSLINUX, but both GRUB and LILO should do.

Installing Linux on a machine from diskette without a RAM disk is a tricky process, which involves the following steps:

RAM disk devices

A RAM disk is just another block device, except that the buffers are never written to a real device, so the data exists only in RAM. The standard kernel comes with 16 RAM disk devices. Initially no memory is allocated to a RAM disk, but buffers will be added dynamically as data is written to it. The maximum size of a RAM disk is 4MB by default and can be modified at boot time with the ramdisk_size command line option. In LILO you could add the following command to the configuration file to double the size:

append ramdisk_size=8192
Note that this specifies a maximum size, smaller RAM disks take less space.

See the kernel source file drivers/block/rd.c how the RAM disk is initialized. There are three possibilities:

Loading a RAM disk at boot time

The feature to load a RAM disk from a diskette at boot time has existed almost from the beginning (it existed in 1992). Since then, some features have been added or modified. It is possible to load a RAM disk image from the boot diskette at a specific offset and to load it from a different diskette.

There are two ways to specify the RAM disk parameters.

It is possible to put a file system on the first part of the diskette (and install LILO there) and to use the rest of the diskette for the compressed RAM disk image. Use a size argument to the mkfs command to specify the number of blocks for the file system.

It is also possible to put a (non-compressed) file system on the boot diskette and load the entire boot diskette as a RAM disk at boot time. Even the kernel, the LILO second stage boot loader and the map file would be loaded into the RAM disk. Advantage is that the same diskette can be used with or without a RAM disk.

The initial RAM disk

The initial RAM disk is loaded by the boot loader. There are two uses for the initial RAM disk:

There is no reason why you should not be able to install an initial RAM disk from a second diskette, but most boot loaders do not support this. This is a limitation of the boot loader, not of Linux. Using the pause command, GRUB can do this, as the following part of a configuration file shows:

title Linux with RAM disk on separate diskette
kernel (fd0)/boot/vmlinuz 
pause Insert the second diskette.
initrd (fd0)/boot/initrd.gz


next up previous contents
Next: Making Diskette Images without Up: Linux Boot Loaders Compared Previous: Example Installations   Contents
Lennart Benschop 2003-05-29