2 Disks

Contents of this section

2.1 Summary of Disk Types

I classify boot-related disks into 4 types. The discussion here and throughout this document uses the term "disk" to refer to diskettes unless otherwise specified. Most of the discussion could be equally well applied to hard disks.

A summary of disk types and uses is:

boot

A disk containing a kernel which can be booted. The disk can contain a filesystem and use a boot loader to boot, or it can simply contain the kernel only at the start of the disk. The disk can be used to boot the kernel using a root file system on another disk. This could be useful if you lost your boot loader due to, for example, an incorrect installation attempt.

root

A disk with a file system containing everything required to run a Linux system. It does not necessarily contain either a kernel or a boot loader.

This disk can be used to run the system independently of any other disks, once the kernel has been booted. A special kernel feature allows a separate root disk to be mounted after booting, with the root disk being automatically copied to a ramdisk.

You could use this type of disk to check another disk for corruption without mounting it, or to restore another disk following disk failure or loss of files.

boot/root

A disk which is the same as a root disk, but contains a kernel and a boot loader. It can be used to boot from, and to run the system. The advantage of this type of disk is that is it compact - everything required is on a single disk. However the gradually increasing size of everything means that it won't necessarily always be possbile to fit everything on a single diskette.

utility

A disk which contains a file system, but is not intended to be mounted as a root file system. It is an additional data disk. You would use this type of disk to carry additional utilities where you have too much to fit on your root disk.

The term "utility" only really applies to diskettes, where you would use a utility disk to store additional recovery utility software.

2.2 Boot

Overview

All PC systems start the boot process by executing code in ROM to load the sector from sector 0, cylinder 0 of the boot drive and try and execute it. On most bootable disks, sector 0, cylinder 0 contains either:

If a Linux kernel has been written to a diskette as a raw device, then the first sector will be the first sector of the Linux kernel itself, and this sector will continue the boot process by loading the rest of the kernel and running Linux. For a more detailed description of the boot sector contents, see the documentation in lilo-01.5 or higher.

An alternative method of storing a kernel on a boot disk is to create a filesystem, not as a root filesystem, but simply as a means of installing LILO and thus allowing boot-time command line options to be specified. For example, the same kernel could then be used to boot using a hard disk root filesystem, or a diskette root filesystem. This could be useful if you were trying to rebuild the hard disk filesystem, and wanted to repeatedly test results.

Setting Pointer to Root

The kernel must somehow obtain a pointer to the drive and partititon to be mounted as the root drive. This can be provided in several ways:

There are some alternative ways of issuing the rdev command. Try:

        rdev -?

and it will display command usage.

There is usually no need to configure the root device for boot diskette use, because the kernel currently used to boot from probably already points to the root drive device. The need can arise, howoever, if you obtain a kernel from another machine, for example, from a distribution, or if you want to use the kernel to boot a root diskette. It never hurts to check, though. To use rdev to check the current root device in a kernel file, enter the command:

        rdev -r <filename>

It is possible to change the root device set in a kernel by means other than using rdev. For details, see the FAQ at the end of this document.

Copying Kernel to Boot Diskette

Once the kernel has been configured then it must be copied to the boot diskette.

If the disk is not intended to contain a file system, then the kernel must be copied using the dd command, as follows:

        dd if=<filename> of=<device>

        where   <filename> is the name of the kernel
        and     <device> is the diskette raw device,
                usually /dev/fd0

The seek parameter to the dd command should NOT be used. The file must be copied to start at the boot sector (sector 0, cylinder 0), and omitting the seek parameter will do this.

The output device name varies. Many systems have /dev/fd0 as an alias of one sort or another for the "real" device name for the default diskette drive. For example, where the default drive (i.e. "drive A:" in DOS) is a high density 3 1/2 inch diskette drive, the device name will be /dev/fd0H1440, but usually /dev/fd0 points to the same device.

Where the kernel is to be copied to a boot disk containing a filesystem, then the disk is mounted at a suitable point in a currently-mounted filesystem, then the cp command is used. For example:

        mount -t ext2 /dev/fd0 /mnt
        cp Image /mnt
        umount /mnt

2.3 Root

Overview

A root disk contains a complete working Linux system, but without necessarily including a kernel. In other words, the disk may not be bootable, but once the kernel is running, the root disk contains everything needed to support a full Linux system. To be able to do this, the disk must include the minimum requirements for a Linux system:

Of course, any system only becomes useful when you can run something on it, and a root diskette usually only becomes useful when you can do something like:

2.4 Boot/Root

This is essentially the same as the root disk, with the addition of a kernel and a boot loader such as LILO.

With this configuration, a kernel file is copied to the root file system, and LILO is then run to install a configuration which points to the kernel file on the target disk. At boot time, LILO will boot the kernel from the target disk.

Several files must be copied to the diskette for this method to work. Details of these files and the required LILO configuration, including a working sample, are given below in the section titled "LILO".

RAM Drives and Root Filesystems on Diskette

For a diskette root filesystem to be efficient, you need to be able to run it from a ramdrive, i.e. an emulated disk drive in main memory. This avoids having the system run at a snail's pace, which a diskette would impose.

There is an added benefit from using a ramdrive - the Linux kernel includes an automatic ramdisk root feature, whereby it will, under certain circumstances, automatically copy the contents of a root diskette to a RAM disk, and then switch the root drive to be the RAM disk instead of the diskette. This has two major benefits:

The requirements for this feature to be invoked are:

A RAM disk can be configured into the kernel in several ways:

The easiest of these methods is LILO configuration, because you need to set up a LILO configuration file anyway, so why not add the ramdisk size here?

LILO configuration is briefly described in a section titled "LILO" below, but it is advisable to obtain the latest stable version of LILO from your nearest Linux mirror site, and read the documentation that comes with it.

2.5 Utility

Often one disk is not sufficient to hold all the software you need to be able to perform rescue functions of analysing, repairing and restoring corrupted disk drives. By the time you include tar, gzip e2fsck, fdisk, Ftape and so on, there is enough for a whole new diskette, maybe even more if you want lots of tools.

This means that a rescue set often requires a utility diskette, with a file system containing any extra files required. This file system can then be mounted at a convenient point, such as /usr, on the boot/root system.

Creating a file system is fairly easy, and is described above in the section titled "File Systems" above.

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter