Last-modified: 2 Oct 95
-----BEGIN PGP SIGNED MESSAGE-----
*** The Linux Bootdisk HOWTO is posted automatically by the Linux
*** HOWTO coordinator, Greg Hankins <gr...@sunsite.unc.edu>. Please
*** direct any comments or questions about this HOWTO to the author,
*** Graham Chapman <grah...@zeta.org.au>.
- --- BEGIN Linux Bootdisk HOWTO part 1/2 ---
The Linux Bootdisk HOWTO
Graham Chapman, grah...@zeta.org.au
v1.02, 25 June 1995
This document describes how to create Linux boot, boot/root and util-
ity maintenance disks. These disks could be used as rescue disks or to
test new kernels.
1.1. Why Build Boot Disks?
Linux boot disks are useful in a number of situations, such as:
o Testing a new kernel.
o Recovering from disk or system failure. Such a failure could be
anything from a lost boot sector to a disk head crash.
There are several ways of producing boot disks:
o Use one from a distribution such as Slackware. This will at least
allow you to boot.
o Use a rescue package to set up disks designed to be used as rescue
o Learn what is required for each of the various types of disk to
operate, then build your own.
I originally chose the last option - learn how it works so that you
can do it yourself. That way, if something breaks, you can work out
what to do to fix it. Plus you learn a lot about how Linux works along
the way. Once I understood how it all worked, then I changed to using
the Bootkit rescue package to maintain my boot disks.
Experienced Linux users may find little of use in this document.
However users new to Linux system administration who wish to protect
against root disk loss and other mishaps may find it useful.
A note on versions - this document has been updated to support the
following packages and versions:
o Linux 1.2.0
o LILO 0.15
Copyright (c) Graham Chapman 1995.
Permission is granted for this material to be freely used and
distributed, provided the source is acknowledged. No warranty of any
kind is provided. You use this material at your own risk.
1.2. Feedback and Credits
I welcome any feedback, good or bad, on the content of this document.
Please let me know if you find any errors or omissions.
I thank the following people for correcting errors and providing
useful suggestions for improvement:
Grant R. Bowman
1.3. Change History
v1.02, 25 June 1995
o Add: FAQ question on oversize ramdisk filesystems.
o Add: if using mkfs, use the -i option.
o Add: can use cp as well as dd to copy to raw disk.
o Chg: correct explanation of /dev/fd0 vs /dev/fd0H1440.
o Chg: use "zImage" terminology to conform to standard usage.
o Add: mke2fs -m 0 will provide more usable disk space.
o Add: re-run LILO if the kernel has changed.
o Add: move rescue packages to new section under "References".
o Add: new rescue packages Bootkit and CatRescue.
o Add: FAQ question on cannot execute errors.
o Add: shell scripts are samples only - I now use Bootkit.
o Chg: stop using < and > in command examples - too confusing.
o Chg: sample directory listings are now of diskettes, not model.
o Chg: use more consistent terminology with ramdisks.
v1.01, 6 February 1995
o Fix: DO NOT cp kernel_filename /dev/fd0 - this will overwrite any
file system on the diskette.
o Fix: Put LILO boot.b and map files on target disk.
o Add: -dp flags to cp commands to avoid problems.
o Chg: restructure to try to improve readability.
o Add: can now use ext2 filesystem on root diskettes.
o Chg: can now separate boot and root diskettes.
o Add: credits section in Introduction.
o Add: FAQ.
v1.0, 2 January 1995
o Converted to conform to HOWTO documentation standards.
o Added new section - Change History.
o Various minor corrections.
v0.10, 1 November 1994 Original version, labelled "draft".
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:
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.
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 after
a disk failure or loss of files.
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
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
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
o code from a boot loader such as LILO, which locates the kernel,
loads it and executes it to start the boot proper.
o the start of an operating system kernel, such as Linux.
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.
2.2.2. 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:
o By setting ROOT_DEV = devicename in the Linux kernel makefile and
rebuilding the kernel (for advice on how to rebuild the kernel,
read the Linux FAQ and look in /usr/src/linux). Comments in the
Linux makefile describe the valid values for devicename.
o By running the rdev utility:
rdev filename devicename
This will set the root device of the kernel contained in filename to
be devicename. For example:
rdev zImage /dev/sda1
This sets the root device in the kernel in zImage to the first parti-
tion on the first SCSI drive.
There are some alternative ways of issuing the rdev command. Try:
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 is probably a good idea to check the current root drive
setting, just in case it is wrong. To get rdev to check the current
root device in a kernel file, enter the command:
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
2.2.3. Copying Kernel to Boot Diskette
Once the kernel has been configured then it must be copied to the boot
The commands described below (and throughout the HOWTO) assume that
the diskettes have been formatted. If not, then use fdformat to format
the diskettes before continuing.
If the disk is not intended to contain a file system, then the kernel
can be copied using the dd command, as follows:
dd if=infilename of=devicename
where infilename is the name of the kernel
read more »