<?xml version="1.0"?>
<article lang="en"><artheader><title>The Linux Bootdisk HOWTO</title><titleabbrev>Bootdisk-HOWTO</titleabbrev><author><firstname>Tom</firstname><surname>Fawcett</surname><affiliation><address format="linespecific">        <email>Bootdisk-HOWTO@linuxdoc.org</email>
        </address></affiliation></author><copyright><year>1995-2002</year><holder>Tom Fawcett</holder></copyright><legalnotice><para> 
      Copyright ent 1995-2002 by Tom Fawcett and Graham Chapman.
      This document may be distributed under the terms set forth in the <ulink url="http://linuxdoc.org/copyright.html">Linux Documentation Project
      License</ulink>.  Please contact the authors if you are unable to get
      the license.
      </para></legalnotice><pubdate>v4.5, January 2002</pubdate><abstract><para> This document describes how to design and build boot/root
      diskettes for Linux.  These disks can be used as rescue disks or
      to test new system components.  You should be reasonably
      familiar with system administration tasks before attempting to
      build a bootdisk.  If you just want a rescue disk to have for
      emergencies, see <xref linkend="premade"></xref>.
      </para></abstract></artheader><sect1><title>Preface</title><important><para> This document may be outdated.  If the date on the title page is
      more than six months ago, please check the <ulink url="http://www.linuxlots.com/~fawcett/Bootdisk-HOWTO/index.html">      Bootdisk-HOWTO homepage</ulink> to see if a more recent version exists.
      </para></important><para>Although this document should be legible in its text form,
    it looks much better in Postscript, PDF or HTML forms because of
    the typographical conventions used.
    </para><sect2><title>Version notes</title><indexterm significance="normal"><primary>kernel</primary><secondary>versions</secondary></indexterm><para>Graham Chapman wrote the original Bootdisk-HOWTO and supported it
      through version 3.1.  Tom Fawcett started as co-author around the time
      kernel v2 was introduced, and he is the document's current maintainer.
      Chapman has disappeared from the Linux community and his whereabouts are
      currently unknown.
      </para><para>This information is intended for Linux on the
      <emphasis>Intel</emphasis> platform.  Much of this information may be
      applicable to Linux on other processors, but I have no first-hand
      experience or information about this.  If you have experience with
      bootdisks on other platforms, please contact me.
     </para></sect2><sect2><title>To do list</title><para>
      <orderedlist inheritnum="ignore" continuation="restarts"><listitem><para> User-mode-linux (<ulink url="             http://user-mode-linux.sourceforge.net/">            http://user-mode-linux.sourceforge.net</ulink>) seems like a great
            way to test out bootdisks without having to reboot your machine
            constantly.  I haven't been able to get it to work.  If anyone has
            been using this consistently with homemade bootdisks, please let
            me know.
            </para></listitem><listitem><para> Re-analyze distribution bootdisks and update the "How the
	    Pros do it" section.  
            </para></listitem><listitem><para>Figure out just how much of the init-getty-login sequence can
	    be simplified, and rip it out.  A few people have said that
	    init can be linked directly to /bin/sh; if so, and if this imposes
	    no great limitations, alter the instructions to do this.
            This would eliminate the need for getty, login, gettydefs, and
            maybe all that PAM and NSS stuff.
            </para></listitem><listitem><para>Go through the 2.4 kernel source code again and write a
	    detailed  explanation of how the boot process and ramdisk-loading
	    process work, in detail.  (If only so that I understand it
	    better.)  There are some issues about initrd and limitations of
	    booting devices (eg flash memory) that I don't understand yet.
            </para></listitem><listitem><para> Delete section that describes how to upgrade existing
	    distribution bootdisks.  This is usually more trouble than it's
	    worth.
            </para></listitem><listitem><para>Replace rdev commands with LILO keywords.
            </para></listitem></orderedlist>
     </para></sect2><sect2><title>Feedback and credits</title><para>I welcome any feedback, good or bad, on the content of this
      document.  I have done my best to ensure that the instructions and
      information herein are accurate and reliable, but I don't know
      everything and I don't keep up on kernel development.  Please let me
      know if you find errors or omissions.  When writing, please indicate the
      version number of the document you're referencing.    Be nice.
      </para><para> We thank the many people who assisted with corrections and
      suggestions.  Their contributions have made it far better than we
      could ever have done alone.
      </para><para>      Send comments and corrections to the author at the email address
      above.  <emphasis>Please read <xref linkend="troubleshooting"></xref>
      before asking me questions</emphasis>.  Do
      <emphasis>not</emphasis> email me disk images.
      </para></sect2><sect2><title>Distribution policy</title><para> Copyright ent 1995-2002 by Tom Fawcett and Graham Chapman.
      This document may be distributed under the terms set forth in the <ulink url="http://linuxdoc.org/copyright.html">Linux Documentation Project
      License</ulink>.  Please contact the authors if you are unable to get
      the license.
      </para><para> This is free documentation.  It is distributed in the hope
      that it will be useful, but <emphasis>without any
      warranty</emphasis>; without even the implied warranty of
      <emphasis>merchantability</emphasis> or <emphasis>fitness for a
      particular purpose</emphasis>.
      </para></sect2></sect1><sect1><title>Introduction</title><para>Linux boot disks are useful in a number of situations, such as testing a
new kernel, recovering from a disk failure (anything from a lost boot
sector to a disk head crash), fixing a disabled system, or upgrading
critical system files safely (such as <filename moreinfo="none">libc.so</filename>).</para><para>There are several ways of obtaining boot disks:

<itemizedlist><listitem><para>Use one from a distribution such as Slackware.  This will at
least allow you to boot.
          </para></listitem><listitem><para>Use a rescue package to set up disks designed to be used
as rescue disks.
          </para></listitem><listitem><para>Learn what is required for each of the types of disk to operate,
then build your own.</para></listitem></itemizedlist>

Some people choose the last option so they can do it themselves.  That way,
if something breaks, they can work out what to do to fix it.  Plus it's a
great way to learn about how a Linux system works.</para><para>This document assumes some basic familiarity with Linux system
administration concepts.  For example, you should know about
directories, filesystems and floppy diskettes.  You should know how to
use <command moreinfo="none">mount</command> and <command moreinfo="none">df</command>.  You should
know what <filename moreinfo="none">/etc/passwd</filename> and
<filename moreinfo="none">fstab</filename> files are for and what they look like.  You
should know that most of the commands in this HOWTO should be run as
root.</para><para>Constructing a bootdisk from scratch can be complicated.  If you
haven't read the Linux FAQ and related documents, such as the Linux
Installation HOWTO and the Linux Installation Guide, you should not be
trying to build boot diskettes.  If you just need a working bootdisk
for emergencies, it is <emphasis>much</emphasis> easier to download a
prefabricated one.  See <xref linkend="premade"></xref>, below, for where to
find these.</para></sect1><sect1><title>Bootdisks and the boot process</title><indexterm significance="normal"><primary>boot process</primary></indexterm><para>A bootdisk is basically a miniature, self-contained Linux system on a
diskette.  It must perform many of the same functions that a complete
full-size Linux system performs.  Before trying to build one you should
understand the basic Linux boot process.  Here we present the basics, which
are sufficient for understanding the rest of this document.  Many details and
alternative options have been omitted.</para><sect2><title>The boot process</title><indexterm significance="normal"><primary>Boot sector</primary></indexterm><indexterm significance="normal"><primary>BIOS</primary></indexterm><indexterm significance="normal"><primary>boot drive</primary></indexterm><para> 

All PC systems start the boot process by executing code in ROM
(specifically, the <emphasis>BIOS</emphasis>) to load the sector from
sector 0, cylinder 0 of the boot drive.  The boot drive is usually the
first floppy drive (designated <filename moreinfo="none">A:</filename> in DOS and
<filename moreinfo="none">/dev/fd0</filename> in Linux).  The BIOS then tries to execute
this sector.  On most bootable disks, sector 0, cylinder 0 contains either:

<itemizedlist><listitem><para>code from a boot loader such as LILO, which locates the kernel,
loads it and executes it to start the boot proper; or
</para></listitem><listitem><para>the start of an operating system kernel, such as Linux.
</para></listitem></itemizedlist>
</para><para>If a Linux kernel has been raw-copied to a diskette, the first sector of the
disk will be the first sector of the Linux kernel itself.  This first sector
will continue the boot process by loading the rest of the kernel from the boot
device.</para><indexterm significance="normal"><primary>root filesystem</primary></indexterm><indexterm significance="normal"><primary>ramdisk</primary></indexterm><indexterm significance="normal"><primary>compressed filesystem</primary></indexterm><para>When the kernel is completely loaded, it initializes device drivers and its
internal data structures.  Once it is completely initialized, it consults a
special location in its image called the <emphasis>ramdisk word</emphasis>.
This word tells it how and where to find its <emphasis>root
filesystem</emphasis>.  A root filesystem is simply a filesystem that will be
mounted as ``<filename moreinfo="none">/</filename>''.  The kernel has to be told where to
look for the root filesystem; if it cannot find a loadable image there, it
halts.</para><para>In some boot situations ent often when booting from a diskette
ent the root filesystem is loaded into a <emphasis>ramdisk</emphasis>,
which is RAM accessed by the system as if it were a disk.  RAM is several
orders of magnitude faster than a floppy disk, so system operation is fast
from a ramdisk.  Also, the kernel can load a <emphasis>compressed
filesystem</emphasis> from the floppy and uncompress it onto the ramdisk,
allowing many more files to be squeezed onto the diskette.  </para><para>Once the root filesystem is loaded and mounted, you see a message like:
<screen width="60" format="linespecific">        VFS: Mounted root (ext2 filesystem) readonly.</screen></para><indexterm significance="normal"><primary>init</primary></indexterm><indexterm significance="normal"><primary>inittab</primary></indexterm><indexterm significance="normal"><primary>sysinit</primary></indexterm><para>Once the system has loaded a root filesystem successfully, it tries to
execute the <filename moreinfo="none">init</filename> program (in <filename moreinfo="none">/bin</filename> or
<filename moreinfo="none">/sbin</filename>).  <filename moreinfo="none">init</filename> reads its
configuration file <filename moreinfo="none">/etc/inittab</filename>, looks for a line
designated <literal moreinfo="none">sysinit</literal>, and executes the named script.  The
<literal moreinfo="none">sysinit</literal> script is usually something like
<filename moreinfo="none">/etc/rc</filename> or <filename moreinfo="none">/etc/init.d/boot</filename>.  This
script is a set of shell commands that set up basic system services, such as
running <command moreinfo="none">fsck</command> on hard disks, loading necessary kernel
modules, initializing swapping, initializing the network, and mounting disks
mentioned in <filename moreinfo="none">/etc/fstab</filename>.</para><indexterm significance="normal"><primary><filename moreinfo="none">/etc/rc.d/</filename></primary></indexterm><para>This script often invokes various other scripts to do modular
initialization.  For example, in the common SysVinit structure, the directory
<filename moreinfo="none">/etc/rc.d/</filename> contains a complex structure of subdirectories
whose files specify how to enable and shut down most system services.  However,
on a bootdisk the sysinit script is often very simple.</para><para>When the sysinit script finishes control returns to <command moreinfo="none">init</command>,
which then enters the <emphasis>default runlevel</emphasis>, specified in
<filename moreinfo="none">inittab</filename> with the <literal moreinfo="none">initdefault</literal> keyword.
The runlevel line usually specifies a program like <command moreinfo="none">getty</command>,
which is responsible for handling commununications through the console and
ttys.  It is the <command moreinfo="none">getty</command> program which prints the familiar
``<prompt moreinfo="none">login:</prompt>'' prompt.  The <command moreinfo="none">getty</command> program in
turn invokes the <command moreinfo="none">login</command> program to handle login validation
and to set up user sessions.</para></sect2><sect2><title>Disk types</title><para>Having reviewed the basic boot process, we can now define various
kinds of disks involved.  We classify disks into four types.  The
discussion here and throughout this document uses the term ``disk'' to
refer to floppy diskettes unless otherwise specified, though most of
the discussion could apply equally well to hard disks.</para><para><variablelist><varlistentry><term>boot</term><listitem><para>A disk containing a kernel which can be booted.  The disk
can be used to boot the kernel, which then may load a root file system on
another disk.  The kernel on a bootdisk usually must be told where to find
its root filesystem.</para><para>Often a bootdisk loads a root filesystem from another diskette, but it is
possible for a bootdisk to be set up to load a hard disk's root filesystem
instead.  This is commonly done when testing a new kernel (in fact,
``<command moreinfo="none">make zdisk</command>'' will create such a bootdisk automatically
from the kernel source code).</para></listitem></varlistentry><varlistentry><term>root</term><listitem><para>A disk with a filesystem containing files
required to run a Linux system.  Such a disk does not necessarily
contain either a kernel or a boot loader.  
<indexterm significance="normal"><primary>root disk</primary></indexterm></para><para>A root disk can be used to run the system independently of any other
disks, once the kernel has been booted.  Usually the root disk is
automatically copied to a ramdisk.  This makes root disk accesses much
faster, and frees up the disk drive for a utility disk.</para></listitem></varlistentry><varlistentry><term>boot/root</term><indexterm significance="normal"><primary>boot/root</primary></indexterm><listitem><para>A disk which contains both the kernel and a root filesystem.  In other
words, it contains everything necessary to boot and run a Linux system
without a hard disk.  The advantage of this type of disk is that is it
compact ent everything required is on a single disk.  However, the gradually
increasing size of everything means that it is increasingly difficult to
fit everything on a single diskette, even with compression.</para></listitem></varlistentry><varlistentry><term>utility</term><listitem><para>A disk which contains a filesystem, 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.
<indexterm significance="normal"><primary>utility diskette</primary></indexterm></para></listitem></varlistentry></variablelist></para><para>In general, when we talk about ``building a bootdisk'' we mean
creating both the boot (kernel) and root (files) portions.  They may
be either together (a single boot/root disk) or separate (boot + root
disks).  The most flexible approach for rescue diskettes is probably
to use separate boot and root diskettes, and one or more utility
diskettes to handle the overflow.</para></sect2></sect1><sect1 id="buildroot"><title>Building a root filesystem</title><para>Creating the root filesystem involves selecting files necessary for the
system to run.  In this section we describe how to build a
<emphasis>compressed root filesystem</emphasis>.  A less common option is to
build an uncompressed filesystem on a diskette that is directly mounted as
root; this alternative is described in <xref linkend="nonramdiskroot"></xref>.</para><sect2><title>Overview</title><para>A root filesystem must contain 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:</para><para>
<itemizedlist><listitem><para>The basic file system structure,</para></listitem><listitem><para>
Minimum set of directories: <filename class="directory" moreinfo="none">/dev</filename>,
<filename class="directory" moreinfo="none">/proc</filename>, 
<filename class="directory" moreinfo="none">/bin</filename>, 
<filename class="directory" moreinfo="none">/etc</filename>, 
<filename class="directory" moreinfo="none">/lib</filename>, 
<filename class="directory" moreinfo="none">/usr</filename>, 
<filename class="directory" moreinfo="none">/tmp</filename>,</para></listitem><listitem><para>Basic set of utilities: <filename moreinfo="none">sh</filename>, <filename moreinfo="none">ls</filename>, <filename moreinfo="none">cp</filename>,
<filename moreinfo="none">mv</filename>, etc.,</para></listitem><listitem><para>Minimum set of config files: <filename moreinfo="none">rc, inittab, fstab</filename>, etc.,</para></listitem><listitem><para>Devices: <filename moreinfo="none">/dev/hd*, /dev/tty*, /dev/fd0</filename>, etc.,</para></listitem><listitem><para>Runtime library to provide basic functions used by utilities.</para></listitem></itemizedlist>
</para><para>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:</para><para>
<itemizedlist><listitem><para>
Check a file system on another drive, for example to check your root file
system on your hard drive, you need to be able to boot Linux from another
drive, as you can with a root diskette system.  Then you can run
<command moreinfo="none">fsck</command> on your original root drive while it is not
mounted.
</para></listitem><listitem><para> Restore all or part of your original root drive from backup using
archive and compression utilities such as <filename moreinfo="none">cpio</filename>,
<filename moreinfo="none">tar</filename>, <filename moreinfo="none">gzip</filename> and
<filename moreinfo="none">ftape</filename>.
</para></listitem></itemizedlist>
</para><para>
We describe how to build a <emphasis>compressed</emphasis> filesystem, so
called because it is compressed on disk and, when booted, is uncompressed onto
a ramdisk.  With a compressed filesystem you can fit many files (approximately
six megabytes) onto a standard 1440K diskette.  Because the filesystem is much
larger than a diskette, it cannot be built on the diskette.  We have to build
it elsewhere, compress it, then copy it to the diskette.</para></sect2><sect2 id="creatingrootfs"><title>Creating the filesystem</title><para>In order to build such a root filesystem, you need a spare device that
is large enough to hold all the files before compression.  You will
need a device capable of holding about four megabytes.  There are
several choices:</para><para>
<itemizedlist><listitem><para> Use a <emphasis>ramdisk</emphasis> (<symbol>DEVICE</symbol> =
<filename moreinfo="none">/dev/ram0</filename>).  In this case, memory is used to simulate
a disk drive.  The ramdisk must be large enough to hold a filesystem of the
appropriate size.  If you use LILO, check your configuration file
(<filename moreinfo="none">/etc/lilo.conf</filename>) for a line like <literal moreinfo="none">RAMDISK =
nnn</literal> which determines the maximum RAM that can be allocated to a
ramdisk.  The default is 4096K, which should be sufficient.  You should
probably not try to use such a ramdisk on a machine with less than 8MB of
RAM.

Check to make sure you have a device like <filename moreinfo="none">/dev/ram0,
/dev/ram</filename> or <filename moreinfo="none">/dev/ramdisk</filename>.  If not, create
<filename moreinfo="none">/dev/ram0</filename> with <command moreinfo="none">mknod</command> (major number
1, minor 0).
</para></listitem><listitem><para>If you have an unused hard disk partition that is large enough (several
megabytes), this is acceptable.
</para></listitem><listitem><para>Use a <emphasis>loopback device</emphasis>, which allows a disk file to be
treated as a device.  Using a loopback device you can create a three
megabyte file on your hard disk and build the filesystem on it.</para><para>Type <command moreinfo="none">man losetup</command> for instructions on using loopback
devices.  If you don't have <command moreinfo="none">losetup</command>, you can get it
along with compatible versions of <command moreinfo="none">mount</command> and
<command moreinfo="none">unmount</command> from the <filename moreinfo="none">util-linux</filename> package
in the directory <ulink url="ftp://ftp.win.tue.nl/pub/linux-local/utils/util-linux/"><filename class="directory" moreinfo="none">ftp://ftp.win.tue.nl/pub/linux/utils/util-linux/</filename></ulink>.</para><para> If you do not have a loop device (<filename moreinfo="none">/dev/loop0</filename>,
<filename moreinfo="none">/dev/loop1</filename>, etc.) on your system, you will have to
create one with ``<command moreinfo="none">mknod /dev/loop0 b 7 0</command>''.  Once you've
installed these special <command moreinfo="none">mount</command> and
<command moreinfo="none">umount</command> binaries, create a temporary file on a hard disk
with enough capacity (eg, <filename moreinfo="none">/tmp/fsfile</filename>).  You can use a
command like:
<screen format="linespecific">	dd if=/dev/zero of=/tmp/fsfile bs=1k count=<varname>nnn</varname></screen>
to create an <varname>nnn</varname>-block file.</para><para>Use the file name in place of <symbol>DEVICE</symbol> below.  When you issue a
mount command you must include the option <option>-o loop</option> to tell
mount to use a loopback device.

<indexterm significance="normal"><primary>loopback device</primary></indexterm></para></listitem></itemizedlist></para><para>After you've chosen one of these options, prepare the <symbol>DEVICE</symbol>
with:
<screen width="50" format="linespecific">        dd if=/dev/zero of=<symbol>DEVICE</symbol> bs=1k count=4096</screen></para><para>This command zeroes out the device.</para><important><para>Zeroing the device is critical because the filesystem will be compressed
later, so all unused portions should be filled with zeroes to achieve maximum
compression.  Keep this in mind whenever you move or delete files on the
filesystem.  The filesystem will correctly de-allocate the blocks,
<emphasis>but it will not zero them out again</emphasis>.  If you do a lot of
deletions and copying, your compressed filesystem may end up much larger than
necessary.</para></important><para>
<indexterm significance="normal"><primary>inodes</primary><secondary>allocation on root filesystem</secondary></indexterm>

Next, create the filesystem.  The Linux kernel recognizes two file system
types for root disks to be automatically copied to ramdisk.  These are minix
and ext2, of which ext2 is preferred.  If using ext2, you may find it useful
to use the <literal moreinfo="none">-N</literal> option to specify more inodes than the
default; <literal moreinfo="none">-N 2000</literal> is suggested so that you don't run out of
inodes.  Alternatively, you can save on inodes by removing lots of unnecessary
<filename moreinfo="none">/dev</filename> files.  <command moreinfo="none">mke2fs</command> will by default
create 360 inodes on a 1.44Mb diskette.  I find that 120 inodes is ample on my
current rescue root diskette, but if you include all the devices in
<filename moreinfo="none">/dev</filename> you will easily exceed 360.  Using a compressed root
filesystem allows a larger filesystem, and hence more inodes by default, but
you may still need to either reduce the number of files or increase the number
of inodes.  </para><para>So the command you use will look like:
<screen format="linespecific">        mke2fs -m 0 -N 2000 <symbol>DEVICE</symbol></screen></para><para>(If you're using a loopback device, the disk file you're using should be
supplied in place of this <symbol>DEVICE</symbol>.)</para><indexterm significance="normal"><primary>loopback device</primary></indexterm><para>The <command moreinfo="none">mke2fs</command> command will automatically detect the
space available and configure itself accordingly.  The
``<literal moreinfo="none">-ment0</literal>'' parameter prevents it from reserving space
for root, and hence provides more usable space on the disk.</para><para>Next, mount the device:
<screen format="linespecific">        mount -t ext2 <symbol>DEVICE</symbol> /mnt</screen> 
(You must create a mount point <filename moreinfo="none">/mnt</filename> if it
does not already exist.)  In the remaining sections, all destination
directory names are assumed to be relative to <filename moreinfo="none">/mnt</filename>.</para></sect2><sect2><title>Populating the filesystem</title><para>Here is a reasonable minimum set of directories for your root filesystem
<footnote><para>The directory structure presented here is for root diskette use only.
Real Linux systems have a more complex and disciplined set of policies, called
the <ulink url="http://www.pathname.com/fhs/2.0/fhs-toc.html">Filesystem
Hierarchy Standard</ulink>, for determining where files should go.)</para></footnote>:

<itemizedlist><listitem><para><filename moreinfo="none">/dev</filename> -- Device files, required to perform I/O</para></listitem><listitem><para><filename moreinfo="none">/proc</filename> -- Directory stub required by the
proc filesystem</para></listitem><listitem><para><filename moreinfo="none">/etc</filename> -- System configuration files</para></listitem><listitem><para><filename moreinfo="none">/sbin</filename> -- Critical system binaries</para></listitem><listitem><para><filename moreinfo="none">/bin</filename> -- Essential binaries considered part of the
system</para></listitem><listitem><para><filename moreinfo="none">/lib</filename> -- Shared libraries to provide run-time
support</para></listitem><listitem><para><filename moreinfo="none">/mnt</filename> -- A mount point for maintenance on other
disks</para></listitem><listitem><para><filename moreinfo="none">/usr</filename> -- Additional utilities and applications</para></listitem></itemizedlist></para><para>Three of these directories will be empty on the root filesystem, so they
only need to be created with <command moreinfo="none">mkdir</command>.  The
<filename moreinfo="none">/proc</filename> directory is basically a stub under which the
proc filesystem is placed.  The directories <filename moreinfo="none">/mnt</filename> and
<filename moreinfo="none">/usr</filename> are only mount points for use after the boot/root
system is running.  Hence again, these directories only need to be created.</para><para>The remaining four directories are described in the following sections.</para><sect3><title>/dev</title><indexterm significance="normal"><primary>device (dev) directory</primary></indexterm><para> A <filename moreinfo="none">/dev</filename> directory containing a special file
for all devices to be used by the system is mandatory for any Linux
system.  The directory itself is a normal directory, and can be
created with <literal moreinfo="none">mkdir</literal> in the normal way.  The device
special files, however, must be created in a special way, using the
<command moreinfo="none">mknod</command> command.</para><para> There is a shortcut, though ent copy devices files from your
existing hard disk <filename moreinfo="none">/dev</filename> directory.  The only requirement
is that you copy the device special files using <literal moreinfo="none">-R</literal> option.
This will copy the directory without attempting to copy the contents of the
files.  Be sure to use an <emphasis>upper case <option>R</option></emphasis>.
For example:
<screen format="linespecific">        cp -dpR /dev/fd[01]* /mnt/dev
        cp -dpR /dev/tty[0-6] /mnt/dev</screen>
assuming that the diskette is mounted at <filename moreinfo="none">/mnt</filename>.  The
<literal moreinfo="none">dp</literal> switches ensure that symbolic links are copied as links,
rather than using the target file, and that the original file attributes are
preserved, thus preserving ownership information.</para><para>If you want to do it the hard way, use <literal moreinfo="none">ls -l</literal> to display the
major and minor device numbers for the devices you want, and create them on
the diskette using <literal moreinfo="none">mknod</literal>.</para><para>However the devices files are created, check that any special devices
you need have been placed on the rescue diskette.  For example,
<literal moreinfo="none">ftape</literal> uses tape devices, so you will need to copy all of
these if you intend to access your floppy tape drive from the bootdisk.</para><para>Note that one inode is required for each device special file, and inodes
can at times be a scarce resource, especially on diskette filesystems.  You'll
need to be selective about the device files you include.  For example, if you
do not have SCSI disks you can safely ignore <literal moreinfo="none">/dev/sd*</literal>; if
you don't intend to use serial ports you can ignore
<literal moreinfo="none">/dev/ttyS*</literal>.  </para><para>If, in building your root filesystem, you get the error <literal moreinfo="none">No
space left on device</literal> but a <literal moreinfo="none">df</literal> command shows space
still available, you have probably run out of inodes.  A <literal moreinfo="none">df
-i</literal> will display inode usage.</para><important><para>Be sure to include the following files from this directory:
<filename moreinfo="none">console</filename>, <filename moreinfo="none">kmem</filename>, <filename moreinfo="none">mem</filename>, <filename moreinfo="none">null</filename>,
<filename moreinfo="none">ram0</filename> and <filename moreinfo="none">tty1</filename>.</para></important></sect3><sect3><title>/etc</title><indexterm significance="normal"><primary>etc directory</primary></indexterm><para>The /etc directory contains configuration files.  What it should contain
depends on what programs you intend to run.
On most systems, these can be divided into three groups:
<orderedlist inheritnum="ignore" continuation="restarts"><listitem><para>Required at all times, <emphasis>e.g.</emphasis> <filename moreinfo="none">rc</filename>,
<filename moreinfo="none">fstab</filename>, <filename moreinfo="none">passwd</filename>.</para></listitem><listitem><para>May be required, but no one is too sure.</para></listitem><listitem><para>Junk that crept in. </para></listitem></orderedlist>
Files which are not essential can usually be identified with the command:
<screen format="linespecific">        ls -ltru</screen>
This lists files in reverse order of date last accessed, so if any
files are not being accessed, they can be omitted from a root diskette.</para><para>On my root diskettes, I have the number of config files down to
15.  This reduces my work to dealing with three sets of files:
<orderedlist inheritnum="ignore" continuation="restarts"><listitem><para>The ones I must configure for a boot/root system:
<orderedlist inheritnum="ignore" continuation="restarts"><listitem><para><filename moreinfo="none">rc.d/*</filename> -- system startup and run level change scripts</para></listitem><listitem><para><filename moreinfo="none">fstab</filename> -- list of file systems to be mounted </para></listitem><listitem><para><filename moreinfo="none">inittab</filename> -- parameters for the
<command moreinfo="none">init</command> process, the first process started at boot time.</para></listitem><listitem><para><filename moreinfo="none">gettydefs</filename> -- parameters for the
<command moreinfo="none">init</command> process, the first process started at boot time.</para></listitem></orderedlist></para></listitem><listitem><para>The ones I should tidy up for a boot/root system:
<orderedlist inheritnum="ignore" continuation="restarts"><listitem><para><filename moreinfo="none">passwd</filename> -- Critical list of users, home directories, etc.</para></listitem><listitem><para><filename moreinfo="none">group</filename> -- user groups. 
<indexterm significance="normal"><primary>user groups</primary></indexterm></para></listitem><listitem><para><filename moreinfo="none">shadow</filename> -- passwords of users.  You may not have this.
<indexterm significance="normal"><primary>shadow passwords</primary></indexterm></para></listitem><listitem><para><filename moreinfo="none">termcap</filename> -- the terminal capability database.</para></listitem></orderedlist></para><para>If security is important, <filename moreinfo="none">passwd</filename> and
<filename moreinfo="none">shadow</filename> should be pruned to avoid copying user passwords
off the system, and so that unwanted logins are rejected when you boot from
diskette.</para><indexterm significance="normal"><primary>restoring files</primary></indexterm><para><indexterm significance="normal"><primary>shadow passwords</primary></indexterm>
<indexterm significance="normal"><primary><filename moreinfo="none">passwd</filename></primary></indexterm>
Be sure that <filename moreinfo="none">passwd</filename> contains at least
<literal moreinfo="none">root</literal>.  If you intend other users to login, be sure their
home directories and shells exist.</para><para><filename moreinfo="none">termcap</filename>, the terminal database, is typically several
hundred kilobytes.  The version on your boot/root diskette should be pruned
down to contain only the terminal(s) you use, which is usually just the
<literal moreinfo="none">linux</literal> or <literal moreinfo="none">linux-console</literal> entry.</para></listitem><listitem><para>The rest.  They work at the moment, so I leave them alone.</para></listitem></orderedlist></para><para>Out of this, I only really have to configure two files, and what they
should contain is surprisingly small.

<itemizedlist><listitem><para><filename moreinfo="none">rc</filename> should contain:
<programlisting format="linespecific">        #!/bin/sh       
        /bin/mount -av
        /bin/hostname Kangaroo</programlisting>

Be sure it is executable, be sure it has a "#!" line at the top, and be sure
any absolute filenames are correct.  You don't really need to run
<command moreinfo="none">hostname</command> ent it just looks nicer if you do.
</para></listitem><listitem><para><filename moreinfo="none">fstab</filename> should contain at least:
<programlisting format="linespecific">        /dev/ram0       /               ext2    defaults
        /dev/fd0        /               ext2    defaults
        /proc           /proc           proc    defaults</programlisting>
<indexterm significance="normal"><primary><filename moreinfo="none">fstab</filename></primary></indexterm>
You can copy entries from your existing <filename moreinfo="none">fstab</filename>, but you
should not automatically mount any of your hard disk partitions; use the
<literal moreinfo="none">noauto</literal> keyword with them.  Your hard disk may be damaged
or dead when the bootdisk is used.</para></listitem></itemizedlist></para><para>Your <filename moreinfo="none">inittab</filename> should be changed so that its
<literal moreinfo="none">sysinit</literal> line runs <filename moreinfo="none">rc</filename> or whatever
basic boot script will be used.  Also, if you want to ensure that users on
serial ports cannot login, comment out all the entries for
<filename moreinfo="none">getty</filename> which include a <filename moreinfo="none">ttys</filename> or
<filename moreinfo="none">ttyS</filename> device at the end of the line.  Leave in the
<filename moreinfo="none">tty</filename> ports so that you can login at the console.</para><indexterm significance="normal"><primary><filename moreinfo="none">inittab</filename></primary></indexterm><indexterm significance="normal"><primary><filename moreinfo="none">sysinit</filename></primary></indexterm><indexterm significance="normal"><primary><filename moreinfo="none">rc</filename></primary></indexterm><para>A minimal <filename moreinfo="none">inittab</filename> file looks like this:

<programlisting format="linespecific">        id:2:initdefault:
        si::sysinit:/etc/rc
        1:2345:respawn:/sbin/getty 9600 tty1
        2:23:respawn:/sbin/getty 9600 tty2</programlisting> 

The <filename moreinfo="none">inittab</filename> file defines what the system will run in
various states including startup, move to multi-user mode, etc.  
Check carefully the filenames mentioned in <filename moreinfo="none">inittab</filename>; if
<literal moreinfo="none">init</literal> cannot find the program mentioned the bootdisk will
hang, and you may not even get an error message.</para><indexterm significance="normal"><primary>hardcoded locations</primary></indexterm><para>Note that some programs cannot be moved elsewhere because other programs have
hardcoded their locations.  For example, on my system,
<filename moreinfo="none">/etc/shutdown</filename> has hardcoded in it
<filename moreinfo="none">/etc/reboot</filename>.  If I move <filename moreinfo="none">reboot</filename> to
<filename moreinfo="none">/bin/reboot</filename>, and then issue a <literal moreinfo="none">shutdown</literal>
command, it will fail because it cannot find the <literal moreinfo="none">reboot</literal>
file.</para><indexterm significance="normal"><primary>etc directory</primary></indexterm><para>For the rest, just copy all the text files in your
<filename moreinfo="none">/etc</filename> directory, plus all the executables in your
<filename moreinfo="none">/etc</filename> directory that you cannot be sure you do not need.
As a guide, consult the sample listing in <xref linkend="listings"></xref>.  Probably
it will suffice to copy only those files, but systems differ a great deal, so
you cannot be sure that the same set of files on your system is equivalent to
the files in the list.  The only sure method is to start with
<literal moreinfo="none">inittab</literal> and work out what is required.</para><para>Most systems now use an <filename moreinfo="none">/etc/rc.d/</filename> directory
containing shell scripts for different run levels.  The minimum is a single
<filename moreinfo="none">rc</filename> script, but it may be simpler just to copy
<filename moreinfo="none">inittab</filename> and the <filename moreinfo="none">/etc/rc.d</filename>
directory from your existing system, and prune the shell scripts in the
<filename moreinfo="none">rc.d</filename> directory to remove processing not relevent to a
diskette system environment.</para></sect3><sect3><title>/bin and /sbin</title><indexterm significance="normal"><primary>bin directory</primary></indexterm><indexterm significance="normal"><primary>sbin directory</primary></indexterm><para>
The <filename moreinfo="none">/bin</filename> directory is a convenient place for extra
utilities you need to perform basic operations, utilities such as
<command moreinfo="none">ls</command>, <command moreinfo="none">mv</command>, <command moreinfo="none">cat</command> and
<command moreinfo="none">dd</command>.  See <xref linkend="listings"></xref> for an example list
of files that go in a <command moreinfo="none">/bin</command> and
<filename moreinfo="none">/sbin</filename> directories.  It does not include any of the
utilities required to restore from backup, such as <command moreinfo="none">cpio</command>,
<command moreinfo="none">tar</command> and <command moreinfo="none">gzip</command>.  That is because I
place these on a separate utility diskette, to save space on the boot/root
diskette.  Once the boot/root diskette is booted, it is copied to the
ramdisk leaving the diskette drive free to mount another diskette, the
utility diskette.  I usually mount this as <filename moreinfo="none">/usr</filename>.</para><para> Creation of a utility diskette is described below in <xref linkend="utilitydisk"></xref>.  It is probably desirable to maintain a copy of the
same version of backup utilities used to write the backups so you don't
waste time trying to install versions that cannot read your backup tapes.</para><important><para>Be sure to include the following programs: <filename moreinfo="none">init</filename>,
<filename moreinfo="none">getty</filename> or equivalent, <filename moreinfo="none">login</filename>, <filename moreinfo="none">mount</filename>, some
shell capable of running your rc scripts, a link from <filename moreinfo="none">sh</filename> to the
shell.</para></important><indexterm significance="normal"><primary>init</primary></indexterm><indexterm significance="normal"><primary>getty</primary></indexterm><indexterm significance="normal"><primary>login</primary></indexterm><indexterm significance="normal"><primary>sh</primary></indexterm><indexterm significance="normal"><primary>shells</primary></indexterm></sect3><sect3><title>/lib</title><indexterm significance="normal"><primary>library (lib) directory</primary></indexterm><indexterm significance="normal"><primary>libraries</primary></indexterm><para>In <filename moreinfo="none">/lib</filename> you place necessary shared libraries and
loaders.  If the necessary libraries are not found in your
<filename moreinfo="none">/lib</filename> directory then the system will be unable to boot.
If you're lucky you may see an error message telling you why.</para><para><indexterm significance="normal"><primary><filename moreinfo="none">libc.so</filename></primary></indexterm>
Nearly every program requires at least the <filename moreinfo="none">libc</filename>
library, <filename moreinfo="none">libc.so.</filename><emphasis>N</emphasis>, where
<emphasis>N</emphasis> is the current version number.  Check your
<filename moreinfo="none">/lib</filename> directory.  The file
<filename moreinfo="none">libc.so.N</filename> is usually a symlink to a filename with a
complete version number:</para><para>
<screen width="82" format="linespecific">% ls -l /lib/libc*
-rwxr-xr-x   1 root     root      4016683 Apr 16 18:48 libc-2.1.1.so*
lrwxrwxrwx   1 root     root           13 Apr 10 12:25 libc.so.6 -ent libc-2.1.1.so*</screen>
</para><para> In this case, you want <filename moreinfo="none">libc-2.1.1.so</filename>.  To find
other libraries you should go through all the binaries you plan to include
and check their dependencies with <command moreinfo="none">ldd</command>.  For example:

<screen width="70" format="linespecific">        % ldd /sbin/mke2fs
        libext2fs.so.2 =ent /lib/libext2fs.so.2 (0x40014000)
        libcomenterr.so.2 =ent /lib/libcomenterr.so.2 (0x40026000)
        libuuid.so.1 =ent /lib/libuuid.so.1 (0x40028000)
        libc.so.6 =ent /lib/libc.so.6 (0x4002c000)
        /lib/ld-linux.so.2 =ent /lib/ld-linux.so.2 (0x40000000)</screen>
Each file on the right-hand side is required.  The file may be a symbolic
link.</para><para> Note that some libraries are <emphasis>quite large</emphasis> and
will not fit easily on your root filesystem.  For example, the
<filename moreinfo="none">libc.so</filename> listed above is about 4 meg.  You will
probably need to strip libraries when copying them to your root filesystem.
See <xref linkend="slimfast"></xref> for instructions.</para><indexterm significance="normal"><primary>loaders</primary></indexterm><para>In <filename moreinfo="none">/lib</filename> you must also include a loader for the libraries.
The loader will be either <filename moreinfo="none">ld.so</filename> (for A.OUT libraries,
which are no longer common) or <filename moreinfo="none">ld-linux.so</filename> (for
ELF libraries).  Newer versions of <command moreinfo="none">ldd</command> tell you exactly
which loader is needed, as in the example above, but older versions may not.
If you're unsure which you need, run the <command moreinfo="none">file</command> command on
the library.  For example:
<screen width="80" format="linespecific">% file /lib/libc.so.4.7.2 /lib/libc.so.5.4.33 /lib/libc-2.1.1.so
/lib/libc.so.4.7.2: Linux/i386 demand-paged executable (QMAGIC), stripped
/lib/libc.so.5.4.33: ELF 32-bit LSB shared object, Intel 80386, version 1, stripped
/lib/libc-2.1.1.so: ELF 32-bit LSB shared object, Intel 80386, version 1, not stripped</screen>
The <literal moreinfo="none">QMAGIC</literal> indicates that <literal moreinfo="none">4.7.2</literal> is for
A.OUT libraries, and <literal moreinfo="none">ELF</literal> indicates that
<literal moreinfo="none">5.4.33</literal> and <literal moreinfo="none">2.1.1</literal> are for ELF.

<indexterm significance="normal"><primary>ELF</primary></indexterm></para><para>Copy the specific loader(s) you need to the root filesystem you're building.
Libraries and loaders should be checked <emphasis>carefully</emphasis> against
the included binaries.  If the kernel cannot load a necessary library, the
kernel may hang with no error message.</para></sect3></sect2><sect2 id="pamandnss"><title>Providing for PAM and NSS</title><para>Your system may require dynamically loaded libraries that are not visible to
<filename moreinfo="none">ldd</filename>.  If you don't provide for these, you may have
trouble logging in or using your bootdisk.</para><sect3><title>PAM (Pluggable Authentication Modules)</title><para>If your system uses PAM (Pluggable Authentication Modules), you must make some
provision for it on your bootdisk.  Briefly, PAM is a sophisticated modular
method for authenticating users and controlling their access to services.  An
easy way to determine if your system uses PAM is run <filename moreinfo="none">ldd</filename>
on your <filename moreinfo="none">login</filename> executable; if the output includes
<filename moreinfo="none">libpam.so</filename>, you need PAM.</para><para>Fortunately, security is usually of no concern with bootdisks since
anyone who has physical access to a machine can usually do anything they
want anyway.  Therefore, you can effectively disable PAM by creating a
simple <filename moreinfo="none">/etc/pam.conf</filename> file in your root filesystem that
looks like this:
<programlisting format="linespecific">OTHER   auth       optional     /lib/security/pamentpermit.so
OTHER   account    optional     /lib/security/pamentpermit.so
OTHER   password   optional     /lib/security/pamentpermit.so
OTHER   session    optional     /lib/security/pamentpermit.so</programlisting>

Also copy the file <filename moreinfo="none">/lib/security/pamentpermit.so</filename> to
your root filesystem.  This library is only about 8K so it imposes minimal
overhead.</para><para>This configuration allows anyone complete access to the files and
services on your machine.  If you care about security on your bootdisk for
some reason, you'll have to copy some or all of your hard disk's PAM setup to
your root filesystem.  Be sure to read the PAM documentation carefully, and
copy any libraries needed in <filename moreinfo="none">/lib/security</filename> onto your root
filesystem.</para><para>You must also include <filename moreinfo="none">/lib/libpam.so</filename> on your bootdisk.
But you already know this since you ran ldd on
<filename moreinfo="none">/bin/login</filename>, which showed this dependency.</para></sect3><sect3><title>NSS (Name Service Switch)</title><para>If you are using glibc (aka libc6), you will have to make provisions
for name services or you will not be able to login.  The file
<filename moreinfo="none">/etc/nsswitch.conf</filename> controls database lookups for
various servies.  If you don't plan to access services from the
network (eg, DNS or NIS lookups), you need only prepare a simple
<filename moreinfo="none">nsswitch.conf</filename> file that looks like this:
<programlisting format="linespecific">     passwd:     files 
     shadow:     files 
     group:      files 
     hosts:      files
     services:   files
     networks:   files
     protocols:  files
     rpc:        files
     ethers:     files
     netmasks:   files     
     bootparams: files
     automount:  files 
     aliases:    files
     netgroup:   files
     publickey:  files</programlisting>

This specifies that every service be provided only by local files.
You will also need to include
<filename moreinfo="none">/lib/libnssentfiles.so.</filename><emphasis>X</emphasis>,
where <emphasis>X</emphasis> is 1 for glibc 2.0 and 2 for glibc 2.1.
This library will be loaded dynamically to handle the file lookups.</para><para>If you plan to access the network from your bootdisk, you may want to create a
more elaborate <filename moreinfo="none">nsswitch.conf</filename> file.  See the
<filename moreinfo="none">nsswitch</filename> man page for details.  You must include a file
<filename moreinfo="none">/lib/libnssent</filename><emphasis>service</emphasis><filename moreinfo="none">.so.1</filename>
for each <emphasis>service</emphasis> you specify.</para></sect3></sect2><sect2><title>Modules</title><indexterm significance="normal"><primary>modules</primary></indexterm><para> If you have a modular kernel, you must consider which modules you
may want to load from your bootdisk after booting.  You might want to
include <command moreinfo="none">ftape</command> and <command moreinfo="none">zftape</command> modules if
your backup tapes are on floppy tape, modules for SCSI devices if you have
them, and possibly modules for PPP or SLIP support if you want to access
the net in an emergency.</para><para>These modules may be placed in <filename moreinfo="none">/lib/modules</filename>.  You should also
include <command moreinfo="none">insmod</command>, <command moreinfo="none">rmmod</command> and <command moreinfo="none">lsmod</command>.  Depending on whether you
want to load modules automatically, you might also include <command moreinfo="none">modprobe</command>,
<command moreinfo="none">depmod</command> and <command moreinfo="none">swapout</command>.  If you use
<command moreinfo="none">kerneld</command>, include it along
with <filename moreinfo="none">/etc/conf.modules</filename>.</para><para>However, the main advantage to using modules is that you can move non-critical
modules to a utility disk and load them when needed, thus using less space on
your root disk.  If you may have to deal with many different devices, this
approach is preferable to building one huge kernel with many drivers built in.</para><important><para>In order to boot a compressed ext2 filesystem, you must have ramdisk and
ext2 support built-in.  <emphasis>They cannot be supplied as
modules.</emphasis></para></important></sect2><sect2><title>Some final details</title><para> Some system programs, such as <command moreinfo="none">login</command>, complain if
the file <filename moreinfo="none">/var/run/utmp</filename> and the directory
<filename moreinfo="none">/var/log</filename> do not exist.  So:</para><screen width="60" format="linespecific">        mkdir -p /mnt/var/entlog,runent
        touch /mnt/var/run/utmp</screen><para>Finally, after you have set up all the libraries you need, run
<command moreinfo="none">ldconfig</command> to remake <filename moreinfo="none">/etc/ld.so.cache</filename> on
the root filesystem.  The cache tells the loader where to find the libraries.
You can do this with:
<screen width="60" format="linespecific">        ldconfig -r /mnt</screen>
<indexterm significance="normal"><primary><filename moreinfo="none">ldconfig</filename></primary></indexterm>
<indexterm significance="normal"><primary><filename moreinfo="none">ld.so.cache</filename></primary></indexterm></para></sect2><sect2 id="wrappingitup"><title>Wrapping it up</title><para>When you have finished constructing the root filesystem, unmount it, copy it
to a file and compress it:
<screen width="50" format="linespecific">        umount /mnt
        dd if=<symbol>DEVICE</symbol> bs=1k | gzip -v9 ent rootfs.gz</screen>

When this finishes you will have a file <filename moreinfo="none">rootfs.gz</filename>.  This
is your compressed root filesystem.  You should check its size to make sure it
will fit on a diskette; if it doesn't you'll have to go back and remove some
files.  Some suggestions for reducing root filesystem size appear in <xref linkend="slimfast"></xref>.</para></sect2></sect1><sect1><title>Choosing a kernel</title><indexterm significance="normal"><primary>kernel, choosing</primary></indexterm><para>At this point you have a complete compressed root filesystem.  The next step
is to build or select a kernel.  In most cases it would be possible to copy
your current kernel and boot the diskette from that.  However, there may be
cases where you wish to build a separate one.</para><para>One reason is size.  If you are building a single boot/root diskette, the
kernel will be one of the largest files on the diskette so you will have to
reduce the size of the kernel as much as possible.  To reduce kernel size,
build it with the minumum set of facilities necessary to support the desired
system.  This means leaving out everything you don't need.  Networking is a
good thing to leave out, as well as support for any disk drives and other
devices which you don't need when running your boot/root system.  As stated
before, your kernel <emphasis>must</emphasis> have ramdisk and ext2 support
built into it.</para><para> Having worked out a minimum set of facilities to include in a kernel,
you then need to work out what to add back in.  Probably the most common uses
for a boot/root diskette system would be to examine and restore a corrupted
root file system, and to do this you may need kernel support.  For example, if
your backups are all held on tape using Ftape to access your tape drive, then,
if you lose your current root drive and drives containing Ftape, then you will
not be able to restore from your backup tapes.  You will have to reinstall
Linux, download and reinstall <command moreinfo="none">ftape</command>, and then try to read
your backups.</para><para>The point here is that, whatever I/O support you have added to your kernel to
support backups should also be added into your boot/root kernel.</para><indexterm significance="normal"><primary>kernel, building from source</primary></indexterm><para>The procedure for actually building the kernel is described in the
documentation that comes with the kernel.  It is quite easy to follow, so
start by looking in <filename moreinfo="none">/usr/src/linux</filename>.  If you have trouble
building a kernel, you should probably not attempt to build boot/root
systems anyway.  Remember to compress the kernel with ``<command moreinfo="none">make zImage</command>''.</para></sect1><sect1><title>Putting them together: Making the diskette(s)</title><para>At this point you have a kernel and a compressed root filesystem.  If you are
making a boot/root disk, check their sizes to make sure they will both fit on
one disk.  If you are making a two disk boot+root set, check the root
filesystem to make sure it will fit on a single diskette.</para><para> You should decide whether to use LILO to boot the bootdisk kernel.
The alternative is to copy the kernel directly to the diskette and boot
without LILO.  The advantage of using LILO is that it enables you to supply
some parameters to the kernel which may be necessary to initialize your
hardware (Check the file <filename moreinfo="none">/etc/lilo.conf</filename> on your
system.  If it exists and has a line like
``<literal moreinfo="none">append=...</literal>'', you probably need this feature).  The
disadvantage of using LILO is that building the bootdisk is more
complicated and takes slightly more space.  You will have to set up a small
separate filesystem, which we shall call the <emphasis>kernel
filesystem</emphasis>, where you transfer the kernel and a few other files
that LILO needs.</para><indexterm significance="normal"><primary>lilo filesystem</primary></indexterm><indexterm significance="normal"><primary><filename moreinfo="none">lilo.conf</filename></primary></indexterm><indexterm significance="normal"><primary>kernel</primary><secondary>parameters</secondary></indexterm><para> If you are going to use LILO, read on; if you are going to transfer
the kernel directly, skip ahead to <xref linkend="transferringwithoutlilo"></xref>.</para><sect2 id="transferringwithlilo"><title>Transferring the kernel with LILO</title><para>First, make sure you have a recent version of LILO.</para><para>You must create a small configuration file for LILO.
It should look like this:
<programlisting format="linespecific">        boot      =/dev/fd0
        install   =/boot/boot.b
        map       =/boot/map
        read-write
        backup    =/dev/null
        compact
        image     = KERNEL
        label     = Bootdisk
        root      =/dev/fd0</programlisting>
For an explanation of these parameters, see LILO's user documentation.  You
will probably also want to add an <literal moreinfo="none">append=...</literal> line to
this file from your hard disk's <filename moreinfo="none">/etc/lilo.conf</filename> file.</para><para>Save this file as <filename moreinfo="none">bdlilo.conf</filename>.</para><para> You now have to create a small filesystem, which we shall call a
<emphasis>kernel filesystem</emphasis>, to distinguish it from the root
filesystem.</para><para>First, figure out how large the filesystem should be.  Take the size of your
kernel in blocks (the size shown by ``<command moreinfo="none">ls -s KERNEL</command>'') and
add 50.  Fifty blocks is approximately the space needed for inodes plus other
files.  You can calculate this number exactly if you want to, or just use 50.
If you're creating a two-disk set, you may as well overestimate the space since
the first disk is only used for the kernel anyway.  Call this number
<literal moreinfo="none">KERNELentBLOCKS</literal>.</para><para>Put a floppy diskette in the drive (for simplicity we'll assume
<filename moreinfo="none">/dev/fd0</filename>) and create an ext2 kernel filesystem on it:
<screen width="50" format="linespecific">        mke2fs -N 24 -m 0 /dev/fd0 KERNELentBLOCKS</screen>

<indexterm significance="normal"><primary>inodes</primary><secondary>allocation</secondary></indexterm>

The ``<literal moreinfo="none">-N 24</literal>'' specifies 24 inodes, which is all you should
need for this filesystem.  Next, mount the filesystem, remove the
<filename moreinfo="none">lost+found</filename> directory, and create <filename moreinfo="none">dev</filename>
and <filename moreinfo="none">boot</filename> directories for LILO: 
<screen format="linespecific">        mount -o dev /dev/fd0 /mnt
        rm -rf /mnt/lost+found
        mkdir /mnt/entboot,devent</screen></para><para>Next, create devices <filename moreinfo="none">/dev/null</filename> and
<filename moreinfo="none">/dev/fd0</filename>.  Instead of looking up the device numbers, you
can just copy them from your hard disk using <literal moreinfo="none">-R</literal>:
<screen format="linespecific">        cp -R /dev/{null,fd0} /mnt/dev</screen> 
LILO needs a copy of its boot loader, <filename moreinfo="none">boot.b</filename>, which
you can take from your hard disk.  It is usually kept in the
<filename moreinfo="none">/boot</filename> directory.
<screen format="linespecific">        cp /boot/boot.b /mnt/boot</screen>
Finally, copy in the LILO configuration file you created in the last section,
along with your kernel.  Both can be put in the root directory:
<screen format="linespecific">        cp bdlilo.conf KERNEL /mnt</screen>
Everything LILO needs is now on the kernel filesystem, so you are ready to run
it.  LILO's <literal moreinfo="none">-r</literal> flag is used for installing the boot loader on some other
root:
<screen format="linespecific">        lilo -v -C bdlilo.conf -r /mnt</screen>

LILO should run without error, after which the kernel filesystem
should look something like this: 
<screen width="75" format="linespecific">total 361
  1 entrwentrententrentent   1 root     root          176 Jan 10 07:22 bdlilo.conf
  1 drwxrentxrentx   2 root     root         1024 Jan 10 07:23 boot/
  1 drwxrentxrentx   2 root     root         1024 Jan 10 07:22 dev/
358 entrwentrententrentent   1 root     root       362707 Jan 10 07:23 vmlinuz
boot:
total 8
  4 entrwentrententrentent   1 root     root         3708 Jan 10 07:22 boot.b
  4 entrwententententententent   1 root     root         3584 Jan 10 07:23 map
dev:
total 0
  0 brwentrententententent   1 root     root       2,   0 Jan 10 07:22 fd0
  0 crwentrententrentent   1 root     root       1,   3 Jan 10 07:22 null           </screen></para><indexterm significance="normal"><primary>kernel</primary><secondary>filesystem</secondary></indexterm><para>Do not worry if the file sizes are slightly different from yours.</para><para>Now leave the diskette in the drive and go to <xref linkend="settingramdiskword"></xref>.</para></sect2><sect2 id="transferringwithoutlilo"><title>Transferring the kernel without LILO</title><para>If you are <emphasis>not</emphasis> using LILO, transfer the kernel to the
bootdisk with <command moreinfo="none">dd</command>:
<screen width="50" format="linespecific">        % dd if=KERNEL of=/dev/fd0 bs=1k
        353+1 records in
        353+1 records out</screen>

In this example, <command moreinfo="none">dd</command> wrote 353 complete records + 1
partial record, so the kernel occupies the first 354 blocks of the
diskette.  Call this number <literal moreinfo="none">KERNELentBLOCKS</literal> and
remember it for use in the next section.</para><para>Finally, set the root device to be the diskette itself, then set the
root to be loaded read/write:
<screen format="linespecific">        rdev /dev/fd0 /dev/fd0
        rdev -R /dev/fd0 0</screen>

<indexterm significance="normal"><primary>rdev</primary></indexterm>

Be careful to use a capital <literal moreinfo="none">-R</literal> in the second
<command moreinfo="none">rdev</command> command.</para></sect2><sect2 id="settingramdiskword"><title>Setting the ramdisk word</title><para> 
Inside the kernel image is the <emphasis>ramdisk word</emphasis> that
specifies where the root filesystem is to be found, along with other
options.  The word can be accessed and set via the <command moreinfo="none">rdev</command>
command, and its contents are interpreted as follows:
  <informaltable><tgroup cols="2" align="left"><colspec colname="bit" colwidth="1in" align="right"></colspec><colspec colname="descrip" align="left"></colspec><thead><row><entry>Bit field</entry><entry>Description</entry></row></thead><tbody><row><entry>0-10</entry><entry>Offset to start of ramdisk, in 1024 byte blocks</entry></row><row><entry>11-13</entry><entry>unused</entry></row><row><entry>14</entry><entry>Flag indicating that ramdisk is to be loaded</entry></row><row><entry>15</entry><entry>Flag indicating to prompt before loading rootfs</entry></row></tbody></tgroup></informaltable></para><para>If bit 15 is set, on boot-up you will be prompted to place a new floppy
diskette in the drive.  This is necessary for a two-disk boot set.</para><para>There are two cases, depending on whether you are building a single
boot/root diskette or a double ``boot+root'' diskette set.</para><orderedlist inheritnum="ignore" continuation="restarts"><listitem><para> If you are building a single disk, the compressed root filesystem
will be placed right after the kernel, so the offset will be the first free
block (which should be the same as
<literal moreinfo="none">KERNELentBLOCKS</literal>).  Bit 14 will be set to 1, and bit
15 will be zero.

For example, say you're building a single disk and the root filesystem will
begin at block 253 (decimal).  The ramdisk word value should be 253
(decimal) with bit 14 set to 1 and bit 15 set to 0.  To calculate the value
you can simply add the decimal values.  253 + (2ent14) = 253 + 16384 =
16637.  If you don't quite understand where this number comes from, plug it
into a scientific calculator and convert it to binary,</para></listitem><listitem><para>If you are building a two-disk set, the root filesystem will begin at
block zero of the second disk, so the offset will be zero.  Bit 14 will be
set to 1 and bit 15 will be 1.  The decimal value will be
2ent14 + 2ent15 = 49152 in this case.</para></listitem></orderedlist><indexterm significance="normal"><primary>ramdisk word</primary></indexterm><indexterm significance="normal"><primary>rdev</primary></indexterm><para>After carefully calculating the value for the ramdisk word, set it with
<command moreinfo="none">rdev -r</command>.  Be sure to use the
<emphasis>decimal</emphasis> value.  If you used LILO, the argument to
<command moreinfo="none">rdev</command> here should be the <emphasis>mounted kernel
path</emphasis>,
e.g. <filename moreinfo="none">/mnt/vmlinuz</filename>; if you copied the kernel with
<command moreinfo="none">dd</command>, instead
use the floppy device name (<emphasis>e.g.,</emphasis> <filename moreinfo="none">/dev/fd0</filename>).
<screen format="linespecific">        rdev -r KERNELentORentFLOPPYentDRIVE  VALUE</screen></para><para>If you used LILO, unmount the diskette now.</para><important><para>Do not believe what the rdev/ramsize manpage says about ramdisk
   size.
    The manpage is obsolete.  As of kernel 2.0 or so, the ramdisk word no
    longer determines the ramdisk size; the word is instead interpreted
    according to the table at the beginning of section <xref linkend="settingramdiskword"></xref>.   For a detailed
    explanation, see the documentation file <ulink url="file:/usr/src/linux/Documentation/ramdisk.txt">ramdisk.txt</ulink> or
    <ulink url="http://www.linuxhq.com/kernel/v2.4/doc/ramdisk.txt.html"></ulink>. 

   </para></important></sect2><sect2><title>Transferring the root filesystem</title><para>The last step is to transfer the root filesystem.</para><para>
<itemizedlist><listitem><para> If the root filesystem will be placed on the
<emphasis>same</emphasis> disk as the kernel, transfer it using
<command moreinfo="none">dd</command> with the <option>seek</option> option, which
specifies how many blocks to skip:
<screen format="linespecific">        dd if=rootfs.gz of=/dev/fd0 bs=1k seek=<emphasis>KERNELentBLOCKS</emphasis></screen></para></listitem><listitem><para>If the root filesystem will be placed on a <emphasis>second</emphasis>
disk, remove the first diskette, put the second diskette in the drive, then
transfer the root filesystem to it:
<screen format="linespecific">        dd if=rootfs.gz of=/dev/fd0 bs=1k</screen></para></listitem></itemizedlist>
</para><para>Congratulations, you are done!  </para><important><para>You should always test a bootdisk before putting it aside for an emergency.
If it fails to boot, read on.</para></important></sect2></sect1><sect1 id="troubleshooting"><title>Troubleshooting, or The Agony of Defeat</title><indexterm significance="normal"><primary>Troubleshooting</primary></indexterm><para>When building bootdisks, the first few tries often will not boot.  The general
approach to building a root disk is to assemble components from your existing
system, and try and get the diskette-based system to the point where it displays
messages on the console.  Once it starts talking to you, the battle is half over
because you can see what it is complaining about, and you can fix individual
problems until the system works smoothly.  If the system just hangs with no
explanation, finding the cause can be difficult.  The recommended procedure for
investigating the problem where the system will not talk to you is as follows:</para><para>
<itemizedlist><listitem><para>You may see a message like this:
<screen format="linespecific">Kernel panic: VFS: Unable to mount root fs on XX:YY</screen>
This is a common problem and it has only a few causes.  First, check the device
<emphasis>XX:YY</emphasis> against the list of device codes in
<filename moreinfo="none">/usr/src/linux/Documentation/devices.txt</filename>.  If it is
incorrect, you probably didn't do an <command moreinfo="none">rdev -R</command>, or you did it
on the wrong image.  If the device code is correct, then check carefully the
device drivers compiled into your kernel.  Make sure it has floppy disk, ramdisk
and ext2 filesystem support built-in.</para></listitem><listitem><para>If you see many errors like:
<screen format="linespecific">endentrequest: I/O error, dev 01:00 (ramdisk), sector NNN</screen>
This is an I/O error from the ramdisk driver, usually because the kernel is
trying to write beyond the end of the device.  The ramdisk is too small to hold
the root filesystem.  Check your bootdisk kernel's initialization messages for a
line like:
<screen format="linespecific">        Ramdisk driver initialized : 16 ramdisks of 4096K size</screen>
Check this size against the <emphasis>uncompressed</emphasis> size of
the root filesystem.  If the ramdisks aren't large enough, make them
larger.</para></listitem><listitem><para>Check that the root disk actually contains the directories you think
it does.  It is easy to copy at the wrong level so that you end up
with something like <filename moreinfo="none">/rootdisk/bin</filename> instead of
<filename moreinfo="none">/bin</filename> on your root diskette.
</para></listitem><listitem><para>Check that there is a <filename moreinfo="none">/lib/libc.so</filename> with the same link that
appears in your <filename moreinfo="none">/lib</filename> directory on your hard disk.
</para></listitem><listitem><para>Check that any symbolic links in your <filename moreinfo="none">/dev</filename>
directory in your existing system also exist on your root diskette
filesystem, where those links are to devices which you have included
in your root diskette.  In particular,
<filename moreinfo="none">/dev/console</filename> links are essential in many cases.</para><indexterm significance="normal"><primary>device (dev) directory</primary></indexterm></listitem><listitem><para>Check that you have included <filename moreinfo="none">/dev/tty1, /dev/null, /dev/zero,
/dev/mem, /dev/ram</filename> and <filename moreinfo="none">/dev/kmem</filename> files.
</para></listitem><listitem><para>Check your kernel configuration -- support for all resources
required up to login point must be built in, not modules.  
So <emphasis>ramdisk and ext2 support must be built-in</emphasis>.
</para></listitem><listitem><para>Check that your kernel root device and ramdisk settings are correct. </para></listitem></itemizedlist></para><para>Once these general aspects have been covered, here are some more
specific files to check:  

<orderedlist inheritnum="ignore" continuation="restarts"><listitem><para>Make sure <command moreinfo="none">init</command> is included as
<filename moreinfo="none">/sbin/init</filename> or <filename moreinfo="none">/bin/init</filename>.
Make sure it is executable.</para></listitem><listitem><para>Run <command moreinfo="none">ldd init</command> to check init's libraries.  Usually
this is just <filename moreinfo="none">libc.so</filename>, but check anyway.  Make
sure you included the necessary libraries and loaders.</para></listitem><listitem><para>Make sure you have the right loader for your libraries --
<filename moreinfo="none">ld.so</filename> for a.out or <filename moreinfo="none">ld-linux.so</filename>
for ELF.
<indexterm significance="normal"><primary>loaders</primary></indexterm></para></listitem><listitem><para>Check the <filename moreinfo="none">/etc/inittab</filename> on your bootdisk filesystem for
the calls to <command moreinfo="none">getty</command> (or some <command moreinfo="none">getty</command>-like
program, such as <command moreinfo="none">agetty</command>, <command moreinfo="none">mgetty</command> or
<command moreinfo="none">gettyentps</command>).  Double-check these against your hard
disk <filename moreinfo="none">inittab</filename>.  Check the man pages of the program you use
to make sure these make sense.  <filename moreinfo="none">inittab</filename> is possibly the
trickiest part because its syntax and content depend on the init program used
and the nature of the system.  The only way to tackle it is to read the man
pages for <command moreinfo="none">init</command> and <filename moreinfo="none">inittab</filename> and work
out exactly what your existing system is doing when it boots.  Check to make
sure <filename moreinfo="none">/etc/inittab</filename> has a system initialisation entry.
This should contain a command to execute the system initialization script,
which must exist.
</para></listitem><listitem><para> As with <command moreinfo="none">init</command>, run <command moreinfo="none">ldd</command> on your
<command moreinfo="none">getty</command> to see what it needs, and make sure the necessary
library files and loaders were included in your root filesystem.
</para></listitem><listitem><para>Be sure you have included a shell program (e.g., <command moreinfo="none">bash</command> or
<command moreinfo="none">ash</command>)
capable of running all of your rc scripts.
<indexterm significance="normal"><primary>shells</primary></indexterm></para></listitem><listitem><para>If you have a <filename moreinfo="none">/etc/ld.so.cache</filename> file on your rescue disk,
remake it.</para></listitem></orderedlist>
</para><para>If <command moreinfo="none">init</command> starts, but you get a message like:  
<screen width="80" format="linespecific">        Id xxx respawning too fast: disabled for 5 minutes  </screen>
it is coming from <command moreinfo="none">init</command>, usually indicating that
<command moreinfo="none">getty</command> or <command moreinfo="none">login</command> is dying as soon as it
starts up.  Check the <command moreinfo="none">getty</command> and <command moreinfo="none">login</command>
executables and the libraries they depend upon.  Make sure the invocations in
<filename moreinfo="none">/etc/inittab</filename> are correct.  If you get strange messages
from <command moreinfo="none">getty</command>, it may mean the calling form in
<filename moreinfo="none">/etc/inittab</filename> is wrong.</para><para> If you get a login prompt, and you enter a valid login name but the
system prompts you for another login name immediately, the problem may be
with PAM or NSS.  See <xref linkend="pamandnss"></xref>.  The problem may also be
that you use shadow passwords and didn't copy
<filename moreinfo="none">/etc/shadow</filename> to your bootdisk.</para><para> If you try to run some executable, such as <command moreinfo="none">df</command>, which
is on your rescue disk but you yields a message like: <literal moreinfo="none">df: not
found</literal>, check two things: (1) Make sure the directory containing the
binary is in your PATH, and (2) make sure you have libraries (and loaders) the
program needs.  </para></sect1><sect1 id="slimfast"><title>Reducing root filesystem size</title><para>
One of the main problems with building bootdisks is getting everything to fit
into one (or even two) diskettes.  Even when files are compressed this can be
very difficult, because Linux system components keep growing.  Here are some
common techniques used to make everything fit.</para><sect2><title>Increase the diskette density</title><para>By default, floppy diskettes are formatted at 1440K, but higher density
formats are possible.  Whether you can boot from higher density
disks depends mostly on your BIOS.
<filename moreinfo="none">fdformat</filename> will format disks for
the following sizes: 1600K, 1680K, 1722K, 1743K, 1760K, 1840K, and 1920K.  
See the <command moreinfo="none">fdformat</command> man page and
<filename moreinfo="none">/usr/src/linux/Documentation/devices.txt</filename>.</para><para> But what diskette densities/geometries will your machine support?  Here
are some (lightly edited) answers from Alain Knaff, the author of fdutils.</para><blockquote><para>This is more an issue of the BIOS rather than the physical format of the disk.
If the BIOS decides that any sector number greater than 18 is bad, then
there is not much we can do.  Indeed, short of disassembling the BIOS, trial
and error seems to be the only way to find out.  However, if the BIOS supports
ED disks (extra density: 36 sectors/track and 2.88MB), there's a chance that
1722K disks are supported as well.</para><para>Superformatted disks with more than 21 sectors/track are likely not bootable:
indeed, those use sectors of non-standard sizes (1024 bytes in a sector
instead of 512, for example), and are likely not bootable.  It should however
be possible to write a special bootsector program to work around this.  If I
remember correctly, the DOS 2m utility has such a beast, as does OS/2's XDF
utilities.</para><para>Some BIOSes artificially claim that any sector number greater than 18
must be in error.  As 1722K disks use sector numbers up to 21, these
would not be bootable.  The best way to test would be to format a test
DOS or syslinus disk as 1722K and make it bootable.  If you use LILO,
don't use the option linear (or else LILO would assume that the disk
is the default 18 sectors/track, and the disk will fail to boot even
if supported by the BIOS).</para></blockquote></sect2><sect2><title>Replace common utilities with BusyBox</title><para> Much root filesystem space is consumed by common GNU system utilities
such as <literal moreinfo="none">cat, chmod, cp, dd, df</literal>, etc.  The
<emphasis>BusyBox</emphasis> project was designed to provide minimal
replacements for these common system utilities.  BusyBox supplies one single
monolithic executable file, <literal moreinfo="none">/bin/busybox</literal>, about 150K, which
implements the functions of these utilities.  You then create symlinks from
different utilities to this executable; busybox sees how it was called and
invokes the correct code.  BusyBox even includes a basic shell.

BusyBox is available in binary packages for many distributions, and source
code is available from <ulink url="http://www.busybox.net/">the BusyBox
site</ulink>.

</para></sect2><sect2><title>Use an alternate shell</title><para> Some of the popular shells for Linux, such as <command moreinfo="none">bash</command>
and <command moreinfo="none">tcsh</command>, are large and require many libraries.  If you
don't use the BusyBox shell, you should still consider replacing your shell
anyway.  Some light-weight alternatives are <command moreinfo="none">ash</command>,
<command moreinfo="none">lsh</command>, <command moreinfo="none">kiss</command> and <command moreinfo="none">smash</command>,
which are much smaller and require few (or no) libraries.  Most of these
replacement shells are available from <ulink url="http://www.ibiblio.org/pub/Linux/system/shells/"><filename class="directory" moreinfo="none">http://www.ibiblio.org/pub/Linux/system/shells/</filename></ulink>.  Make sure any shell you use is capable of running
commands in all the <filename moreinfo="none">rc</filename> files you include on your
bootdisk.

<indexterm significance="normal"><primary>shells</primary></indexterm> 
</para></sect2><sect2><title>Strip libraries and binaries</title><para> Many libraries and binaries are distributed with debugging information.
Running <command moreinfo="none">file</command> on these files will tell you ``<literal moreinfo="none">not
stripped</literal>'' if so.
<indexterm significance="normal"><primary>libraries</primary></indexterm> When copying binaries to
your root filesystem, it is good practice to use: <screen format="linespecific">      objcopy --strip-all FROM TO</screen>

<indexterm significance="normal"><primary>libraries</primary><secondary>stripping</secondary></indexterm>
<indexterm significance="normal"><primary><filename moreinfo="none">strip</filename></primary></indexterm>
<indexterm significance="normal"><primary><filename moreinfo="none">objcopy</filename></primary></indexterm>

<important><para>When copying libraries, be sure to use <option>strip-debug</option> instead of
<option>strip-all</option>.</para></important>
</para></sect2><sect2><title>Move files to a utility disk</title><para> If some of your binaries are not needed immediately to boot or login,
you can move them to a utility disk.  See <xref linkend="utilitydisk"></xref> for
details.  You may also consider moving modules to a utility disk as well.

<indexterm significance="normal"><primary>utility diskette</primary></indexterm>
</para></sect2></sect1><sect1><title>Miscellaneous topics</title><sect2 id="nonramdiskroot"><title>Non-ramdisk root filesystems</title><indexterm significance="normal"><primary>ramdisk</primary></indexterm><para><xref linkend="buildroot"></xref> gave instructions for building a compressed root
filesystem which is loaded to ramdisk when the system boots.  This method
has many advantages so it is commonly used.  However, some systems with
little memory cannot afford the RAM needed for this, and they must use root
filesystems mounted directly from the diskette.</para><para>Such filesystems are actually easier to build than compressed root filesystems
because they can be built on a diskette rather than on some other device, and
they do not have to be compressed.  We will outline the procedure as it
differs from the instructions above.  If you choose to do this, keep in mind
that you will have <emphasis>much less space</emphasis> available.</para><para>
<orderedlist inheritnum="ignore" continuation="restarts"><listitem><para>Calculate how much space you will have available for root files.

If you are building a single boot/root disk, you must fit all blocks for the
kernel plus all blocks for the root filesystem on the one disk.
</para></listitem><listitem><para>Using <command moreinfo="none">mke2fs</command>, create a root filesystem on a diskette of the
appropriate size.
</para></listitem><listitem><para>Populate the filesystem as described above.  
</para></listitem><listitem><para>When done, unmount the filesystem and transfer it to a disk file 
but <emphasis>do not compress it</emphasis>.
</para></listitem><listitem><para>Transfer the kernel to a floppy diskette, as described above.  When
calculating the ramdisk word, <emphasis>set bit 14 to zero</emphasis>, to indicate that the
root filesystem is not to be loaded to ramdisk.  Run the <command moreinfo="none">rdev</command>'s as
described.
<indexterm significance="normal"><primary>ramdisk word</primary></indexterm>
<indexterm significance="normal"><primary>rdev</primary></indexterm>
</para></listitem><listitem><para>Transfer the root filesystem as before.
</para></listitem></orderedlist>
</para><para> There are several shortcuts you can take.  If you are building a
two-disk set, you can build the complete root filesystem directly on the
second disk and you need not transfer it to a hard disk file and then back.
Also, if you are building a single boot/root disk and using LILO, you can
build a <emphasis>single</emphasis> filesystem on the entire disk,
containing the kernel, LILO files and root files, and simply run LILO as
the last step.</para></sect2><sect2 id="utilitydisk"><title>Building a utility disk</title><indexterm significance="normal"><primary>utility diskette</primary></indexterm><para>Building a utility disk is relatively easy -- simply create a filesystem
on a formatted disk and copy files to it.  To use it with a bootdisk,
mount it manually after the system is booted.</para><para>In the instructions above, we mentioned that the utility disk could be
mounted as <filename moreinfo="none">/usr</filename>.  In this case, binaries could be placed into a
<filename moreinfo="none">/bin</filename> directory on your utility disk, so that placing
<filename moreinfo="none">/usr/bin</filename> in your path will access them.  Additional libraries
needed by the binaries are placed in <filename moreinfo="none">/lib</filename> on the utility disk.</para><para>There are several important points to keep in mind when designing a utility
disk:</para><para>
<orderedlist inheritnum="ignore" continuation="restarts"><listitem><para>Do not place critical system binaries or libraries onto the utility
disk, since it will not be mountable until after the system has booted.
</para></listitem><listitem><para>You cannot access a floppy diskette and a floppy tape drive
simultaneously.  This means that if you have a floppy tape drive, you will not
be able to access it while your utility disk is mounted.
</para></listitem><listitem><para>Access to files on the utility disk will be slow.
</para></listitem></orderedlist>
</para><para><xref linkend="utilitylist"></xref> shows a sample of files on a utility disk.
Here are some ideas for files you may find useful: programs for examining
and manipulating disks (<command moreinfo="none">format, fdisk</command>) and filesystems
(<command moreinfo="none">mke2fs, fsck, debugfs, isofs.o</command>), a lightweight text
editor (<command moreinfo="none">elvis, jove</command>), compression and archive utilities
(<command moreinfo="none">gzip, bzip, tar, cpio, afio</command>), tape utilities
(<command moreinfo="none">mt, ftmt, tob, taper</command>), communications utilities
(<command moreinfo="none">ppp.o, slip.o, minicom</command>) and utilities for devices
(<command moreinfo="none">setserial, mknod</command>).</para></sect2></sect1><sect1 id="pros"><title>How the pros do it</title><para>You may notice that the bootdisks used by major distributions such as
Slackware, RedHat or Debian seem more sophisticated than what is described
in this document.  Professional distribution bootdisks are based on the
same principles outlined here, but employ various tricks because their
bootdisks have additional requirements.  First, they must be able to work
with a wide variety of hardware, so they must be able to interact with the
user and load various device drivers.  Second, they must be prepared to
work with many different installation options, with varying degrees of
automation.  Finally, distribution bootdisks usually combine installation
and rescue capabilities.</para><indexterm significance="normal"><primary>initial ramdisk (initrd)</primary></indexterm><para>Some bootdisks use a feature called <emphasis>initrd</emphasis>
(<emphasis>initial ramdisk</emphasis>).  This feature was introduced
around 2.0.x and allows a kernel to boot in two phases.  When the
kernel first boots, it loads an initial ramdisk image from the boot
disk.  This initial ramdisk is a root filesystem containing a program
that runs before the real root fs is loaded.  This program usually
inspects the environment and/or asks the user to select various boot
options, such as the device from which to load the real rootdisk.  It
typically loads additional modules not built in to the kernel.  When
this initial program exits, the kernel loads the real root image and
booting continues normally.  For further information on
<command moreinfo="none">initrd</command>, see your local file <ulink url="file:/usr/src/linux/Documentation/initrd.txt"><filename moreinfo="none">/usr/src/linux/Documentation/initrd.txt</filename></ulink>
and <ulink url="ftp://elserv.ffm.fgan.de/pub/linux/loadlin-1.6/initrd-example.tgz"><filename moreinfo="none">ftp://elserv.ffm.fgan.de/pub/linux/loadlin-1.6/initrd-example.tgz</filename></ulink></para><para>The following are summaries of how each distribution's installation
disks seem to work, based on inspecting their filesystems and/or
source code.  We do not guarantee that this information is completely
accurate, or that they have not changed since the versions noted.</para><para> Slackware (v.3.1) uses a straightforward LILO boot similar to what
is described in <xref linkend="transferringwithlilo"></xref>.  The
Slackware bootdisk prints a bootup message (ent<literal moreinfo="none">Welcome to the
Slackware Linux bootkernel disk!</literal>ent) using LILO's
<literal moreinfo="none">message</literal> parameter.  This instructs the user to enter a
boot parameter line if necessary.  After booting, a root filesystem is
loaded from a second disk.  The user invokes a <command moreinfo="none">setup</command>
script which starts the installation.  Instead of using a modular kernel,
Slackware provides many different kernels and depends upon the user to
select the one matching his or her hardware requirements.</para><para> RedHat (v.4.0) also uses a LILO boot.  It loads a compressed ramdisk
on the first disk, which runs a custom <command moreinfo="none">init</command> program.
This program queries for drivers then loads additional files from a
supplemental disk if necessary.</para><para> Debian (v.1.3) is probably the most sophisticated of the
installation disk sets.  It uses the SYSLINUX loader to arrange various
load options, then uses an <literal moreinfo="none">initrd</literal> image to guide the
user through installation.  It appears to use both a customized
<command moreinfo="none">init</command> and a customized shell.</para></sect1><sect1 id="cd-roms"><title>Creating bootable CD-ROMs</title><note><para>This section was contributed by Rizwan Mohammed Darwe
      (<literal moreinfo="none">rizwan AT clovertechnologies dot com</literal>)
     </para></note><para>This section assumes that you are familiar with the process and workings of
writing CDs in linux.  Consider this to be a quick reference to include the
ability to boot the CD which you will burn.  The CD-Writing-HOWTO should give you
an in-depth reference.</para><sect2><title>What is El Torito?</title><para>For the x86 platform, many BIOS's have begun to support bootable CDs.
The patches for mkisofs is based on the standard called "El Torito".
Simply put, El Torito is a specification that says how a cdrom should 
be formatted such that you can directly boot from it.</para><para> The "El Torito" spec says that <emphasis>any</emphasis> cdrom drive
should work (SCSI or EIDE) as long as the BIOS supports El Torito.  So far
this has only been tested with EIDE drives because none of the SCSI
controllers that has been tested so far appears to support El Torito.  The
motherboard definately has to support El Torito.  How do you know if your
motherboard supports "El Torito"?  Well, the ones that support it let you
choose booting from hard disk, Floppy, Network or CDROM.  </para></sect2><sect2><title>How it Works</title><para> The El Torito standard works by making the CD drive appear, through
BIOS calls, to be a normal floppy drive.  This way you simply put any floppy
size image (exactly 1440k for a 1.44 meg floppy) somewhere in the ISO
filesystem.  In the headers of the ISO fs you place a pointer to this image.
The BIOS will then grab this image from the CD and for all purposes it acts as
if it were booting from the floppy drive.  This allows a working LILO boot
disk, for example, to simply be used as is.  </para><para>Roughly speaking, the first 1.44 (or 2.88 if supported) Mbytes of the
CD-ROM contains a floppy-disk image supplied by you. This image is treated
like a floppy by the BIOS and booted from.  (As a consequence, while booting
from this virtual floppy, your original drive A:
(<filename moreinfo="none">/dev/fd0</filename>) may not be accessible, but you can try with
<filename moreinfo="none">/dev/fd1</filename>).  </para></sect2><sect2><title>How to make it work</title><para>First create a file, say "boot.img", which is an exact image of the bootable 
floppy-disk which you want to boot via the CD-ROM.  This must be an 1.44 MB 
bootable floppy-disk.  The command below will do this
<screen format="linespecific">	dd if=/dev/fd0 of=boot.img bs=10k count=144</screen>
assuming the floppy is in the A: drive.</para><para>Place this image somewhere in the hierarchy which will be the source
for the iso9660 filesystem. It is a good idea to put all boot related
files in their own directory ("boot/" under the root of the iso9660 fs,
for example).</para><para>One caveat -- Your boot floppy <emphasis>must</emphasis> load any initial
ramdisk via LILO, not the kernel ramdisk driver!  This is because once the
linux kernel starts up, the BIOS emulation of the CD as a floppy disk is
circumvented and will fail.  LILO will load the initial ramdisk using BIOS
disk calls, so the emulation works as designed.</para><para> 
The El Torito specification requires a "boot catalog" to be created as
well.  This is a 2048 byte file which is of no interest except it is required.
The patchwork done by the author of mkisofs will cause it to automatically
create the boot catalog, but you must specify where the boot catalog will go
in the iso9660 filesystem.  Usually it is a good idea to put it in the same
place as the boot image, and a name like <filename moreinfo="none">boot.catalog</filename>
seems appropriate.</para><para>So we have our boot image in the file <filename moreinfo="none">boot.img</filename>,
and we are going to put it in the directory <filename class="directory" moreinfo="none">boot/</filename> under the root of the iso9660 filesystem.
We will have the boot catalog go in the same directory with the name
<filename moreinfo="none">boot.catalog</filename>.  The command to create the iso9660 fs in
the file <filename moreinfo="none">bootcd.iso</filename> is then:

<screen format="linespecific">mkisofs -r -b boot/boot.img -c boot/boot.catalog -o bootcd.iso .</screen>

The <option>-b</option> option specifies the boot image to be used (note the
path is relative to the root of the iso9660 disk), and the <option>-c</option>
option is for the boot catalog file.  The <option>-r</option> option will make
approptiate file ownerships and modes (see the <filename moreinfo="none">mkisofs</filename>
manpage). The "."  in the end says to take the source from the current
directory.  </para><para>Now burn the CD with the usual cdrecord command and it is ready to boot.</para></sect2><sect2><title>Create Win9x Bootable CD-Roms</title><para>The first step is to get hold of the bootable image used by the source
CD.  But you cannot simply mount the CD under linux and dd the first 1440k to
a floppy disk or to a file like <filename moreinfo="none">boot.img</filename>.  Instead you
simply boot with the source CD-ROM.  </para><para>When you boot the Win98 CD you are dropped to A: prompt which is the
actual ramdisk.  And D: or Z: is where all the installables are residing.  By
using the diskcopy command of dos copy the A: image into the actual floppy
drive which is now B:  The command below will do this.
<screen format="linespecific">diskcopy A: B: </screen>

It works just like dd.  You can try booting from this newly created disk to
test if the booting process is similar to that of the source CD.  Then the
usual dd of this floppy to a file like boot.img and then rest is as usual.</para></sect2></sect1><sect1><title>Frequently Asked Question (FAQ) list</title><qandaset defaultlabel="qanda"><qandaentry><question><para><emphasis>I boot from my boot/root disks and nothing happens. What do I
do?</emphasis></para></question><answer><para>See <xref linkend="troubleshooting"></xref>, above.</para></answer></qandaentry><qandaentry><question><para><emphasis>How does the Slackware/Debian/RedHat bootdisk work?</emphasis></para></question><answer><para>See <xref linkend="pros"></xref>, above.</para></answer></qandaentry><qandaentry><question><para><emphasis>How do I use higher-density (ent 1440K) diskettes?  How do I figure out
which densities will work with my diskette drive?</emphasis></para></question><answer><para>See Section <xref linkend="slimfast"></xref>, above, for the comments by Alain Knaff
on this subject.  His is the most authoritative answer I know of.</para></answer></qandaentry><qandaentry><question><para><emphasis>How do I increase the size of my ramdisks?</emphasis></para></question><answer><para>This probably should be explained better in the text, but I'll put an answer
here for the time being.</para><para>First, <emphasis>do not</emphasis> attempt to use the <literal moreinfo="none">rdev</literal>
or <literal moreinfo="none">ramsize</literal> commands to do this, no matter what their
documentation says.  The ramdisk word no longer determines the size of
ramdisks.</para><para>Second, keep in mind that ramdisks are actually dynamic; when you set a
ramdisk size you aren't allocating any memory, you're just setting the limit
of how large it can grow.  Don't be afraid to set these fairly large (eg, 8 or
even 16 meg).  The RAM space is not actually consumed until you need it.
You can set these limits in one of several ways.  </para><para><orderedlist inheritnum="ignore" continuation="restarts"><listitem><para>Use the <literal moreinfo="none">ramdiskentsize=NNN</literal> command line
parameter.  You can either enter this manually or use a command like
<literal moreinfo="none">append="ramdiskentsize=NNN"</literal> with LILO.</para></listitem><listitem><para>If you're using LILO, you can use a kernel option like
<literal moreinfo="none">ramdisk=8192K</literal> in the <literal moreinfo="none">lilo.conf</literal> file.</para></listitem><listitem><para>Change the kernel configuration option
<literal moreinfo="none">CONFIG_BLK_DEV_RAM_SIZE</literal> and recompile your kernel.</para></listitem></orderedlist></para></answer></qandaentry><qandaentry><question><para><emphasis>How do I make bootable CD-ROMs?  </emphasis></para></question><answer><para>See section <xref linkend="cd-roms"></xref>.</para></answer></qandaentry><qandaentry><question><para><emphasis>How do I make bootable LS-120 disks?</emphasis></para></question><answer><para>Since I don't have an LS-120 drive, the following information is summarized
from <ulink url="http://www.linuxrouter.org/floppy.shtml"> information
provided by Dave Cinege</ulink> from the Linux Router Project.</para><para>
The LS-120 is an IDE floppy drive.  It is compatible with both standard 3.5"
disks and the new 120MB disks.  As of Linux v2.0.31 there is full support.  To
be able to boot from these you must have a BIOS that specifically allows the
LS-120 to be treated as drive 0 (whereas IDE devices normally start at 80).
If you do not have BIOS support, you can purchase a small IDE FloppyMAX card
from Promise Technologies to overcome this deficiency.</para><para>
The kernel boot loader does not like the LS-120, and instantly dies.  Also 2m
disks do not like it and will not boot.  1.44MB through 1.74MB disks will work
fine.  SYSLINUX works with the 120MB disks as of v1.32.  You would better off
partitioning the disk and using ext2 or minix, instead of SYSLINUX unless you
need MS-DOS compatibility.</para><para>LILO does work fine with 120MB disks. Here is a sample lilo.conf: 
<screen format="linespecific">        boot=/dev/hda
        compact
        disk=/dev/hda bios=0
        install=/floppy/boot.b
        map=/floppy/map
        image=/floppy/linux
        label=Linux
        append="load_ramdisk=1"
        initrd=/floppy/root.bin
        ramdisk=8192</screen>
The line "disk=/dev/hda bios=0" is what does the trick to make it boot the
LS-120.</para></answer></qandaentry><qandaentry><question><para><emphasis>How can I make a boot disk with a XYZ driver?</emphasis></para></question><answer><para>The easiest way is to obtain a Slackware kernel from your nearest Slackware
mirror site. Slackware kernels are generic kernels which atttempt to
include drivers for as many devices as possible, so if you have a SCSI or
IDE controller, chances are that a driver for it is included in the
Slackware kernel.</para><para>Go to the <filename moreinfo="none">a1</filename> directory and select either IDE or SCSI
kernel depending on the type of controller you have. Check the xxxxkern.cfg
file for the selected kernel to see the drivers which have been included in
that kernel. If the device you want is in that list, then the corresponding
kernel should boot your computer. Download the xxxxkern.tgz file and copy
it to your boot diskette as described above in the section on making boot
disks.</para><indexterm significance="normal"><primary>device drivers</primary></indexterm><para> You must then check the root device in the kernel, using the command
<command moreinfo="none">rdev zImage</command>.  If this is not the same as the root device
you want, use <command moreinfo="none">rdev</command> to change it.  For example, the kernel I
tried was set to <filename moreinfo="none">/dev/sda2</filename>, but my root SCSI partition is
<filename moreinfo="none">/dev/sda8</filename>.  To use a root diskette, you would have to use
the command <command moreinfo="none">rdev zImage /dev/fd0</command>.</para><para>If you want to know how to set up a Slackware root disk as well, that's
outside the scope of this HOWTO, so I suggest you check the Linux Install
Guide or get the Slackware distribution.  See the section in this HOWTO titled
``References''.</para></answer></qandaentry><qandaentry><question><para><emphasis>How do I update my root diskette with new files?</emphasis></para></question><answer><para>
<indexterm significance="normal"><primary>root
filesystems</primary><secondary>updating</secondary></indexterm>

The easiest way is to copy the filesystem from the rootdisk back to the
<symbol>DEVICE</symbol> you used (from <xref linkend="creatingrootfs"></xref>, above).
Then mount the filesystem and make the changes.  You have to remember where
your root filesystem started and how many blocks it occupied:
<screen width="80" format="linespecific">        dd if=/dev/fd0 bs=1k skip=ROOTBEGIN count=BLOCKS | gunzip ent <symbol>DEVICE</symbol>
        mount -t ext2 <symbol>DEVICE</symbol> /mnt</screen>
After making the changes, proceed as before (in <xref linkend="wrappingitup"></xref>) and transfer the root filesystem back to the disk.
You should not have to re-transfer the kernel or re-compute the ramdisk word
if you do not change the starting position of the new root filesystem.</para></answer></qandaentry><qandaentry><question><para><emphasis>How do I remove LILO so that I can use DOS to boot again?</emphasis></para></question><indexterm significance="normal"><primary>Master Boot Record (MBR)</primary></indexterm><indexterm significance="normal"><primary>LILO</primary><secondary>removing</secondary></indexterm><answer><para>This is not really a Bootdisk topic, but it is asked often.  Within Linux, you 
can run:
<screen width="60" format="linespecific">        /sbin/lilo -u</screen></para><para> You can also use the <command moreinfo="none">dd</command> command to copy the
backup saved by LILO to the boot sector.  Refer to the LILO documentation
if you wish to do this.</para><para>Within DOS and Windows you can use the DOS command:
<screen width="80" format="linespecific">        FDISK /MBR</screen>
MBR stands for Master Boot Record.  This command replaces the boot sector
with a clean DOS one, without affecting the partition table.  Some purists
disagree with this, but even the author of LILO, Werner Almesberger,
suggests it.  It is easy, and it works.</para></answer></qandaentry><qandaentry><question><para><emphasis>How can I boot if I've lost my kernel <emphasis>and</emphasis>
my boot disk?</emphasis></para></question><answer><para>If you don't have a boot disk standing by, probably the easiest method is
to obtain a Slackware kernel for your disk controller type (IDE or SCSI) as
described above for ``How do I make a boot disk with a XXX driver?''.  You
can then boot your computer using this kernel, then repair whatever damage
there is.</para><para> The kernel you get may not have the root device set to the disk type
and partition you want. For example, Slackware's generic SCSI kernel has
the root device set to <filename moreinfo="none">/dev/sda2</filename>, whereas my root
Linux partition happens to be <filename moreinfo="none">/dev/sda8</filename>.  In this case
the root device in the kernel will have to be changed.</para><para>You can still change the root device and ramdisk settings in the kernel
even if all you have is a kernel, and some other operating system,
such as DOS.</para><para> <command moreinfo="none">rdev</command> changes kernel settings by changing the
values at fixed offsets in the kernel file, so you can do the same if you
have a hex editor available on whatever systems you do still have running
-- for example, Norton Utilities Disk Editor under DOS.  You then need to
check and if necessary change the values in the kernel at the following
offsets:

<indexterm significance="normal"><primary>ramdisk word</primary></indexterm>
<indexterm significance="normal"><primary>rdev</primary></indexterm>

<screen width="80" format="linespecific">HEX     DEC  DESCRIPTION
0x01F8  504  Low byte of RAMDISK word
0x01F9  505  High byte of RAMDISK word
0x01FC  508  Root minor device number - see below
0X01FD  509  Root major device number - see below</screen></para><para>The interpretation of the ramdisk word was described in <xref linkend="settingramdiskword"></xref>, above.</para><para>The major and minor device numbers must be set to the device you want to mount
your root filesystem on. Some useful values to select from are:
<screen width="80" format="linespecific">DEVICE          MAJOR MINOR
/dev/fd0            2     0   1st floppy drive
/dev/hda1           3     1   partition 1 on 1st IDE drive
/dev/sda1           8     1   partition 1 on 1st SCSI drive
/dev/sda8           8     8   partition 8 on 1st SCSI drive</screen>
Once you have set these values then you can write the file to a diskette
using either Norton Utilities Disk Editor, or a program called
<command moreinfo="none">rawrite.exe</command>.  This program is included in all
distributions.  It is a DOS program which writes a file to the ``raw''
disk, starting at the boot sector, instead of writing it to the file
system.  If you use Norton Utilities you must write the file to a physical
disk starting at the beginning of the disk.</para></answer></qandaentry><qandaentry><question><para><emphasis>How can I make extra copies of boot/root diskettes?</emphasis></para></question><answer><para>Because magnetic media may deteriorate over time, you should keep several
copies of your rescue disk, in case the original is unreadable.</para><para> 
The easiest way of making copies of any diskettes, including
bootable and utility diskettes, is to use the <command moreinfo="none">dd</command> command
to copy the contents of the original diskette to a file on your hard drive,
and then use the same command to copy the file back to a new diskette.
Note that you do not need to, and should not, mount the diskettes, because
<command moreinfo="none">dd</command> uses the raw device interface.</para><para>To copy the original, enter the command:
<screen width="60" format="linespecific">        dd if=<symbol>DEVICENAME</symbol> of=<symbol>FILENAME</symbol></screen>

where <symbol>DEVICENAME</symbol> is the device name of the diskette drive and
<symbol>FILENAME</symbol> is the name of the (hard-disk) output file.  Omitting the
<literal moreinfo="none">count</literal> parameter causes <command moreinfo="none">dd</command> to copy the
whole diskette (2880 blocks if high-density).</para><para>To copy the resulting file back to a new diskette, insert the new
diskette and enter the reverse command:
<screen width="60" format="linespecific">        dd if=<symbol>FILENAME</symbol> of=<symbol>DEVICENAME</symbol></screen></para><para>Note that the above discussion assumes that you have only one diskette
drive. If you have two of the same type, you can copy diskettes using a
command like:
<screen width="60" format="linespecific">        dd if=/dev/fd0 of=/dev/fd1</screen></para></answer></qandaentry><qandaentry><question><para><emphasis>How can I boot without typing in entahaxxxx=nn,nn,nnent every time?</emphasis></para></question><answer><para>
<indexterm significance="normal"><primary>kernel</primary><secondary>parameters</secondary></indexterm>

Where a disk device cannot be autodetected it is necessary to supply the
kernel with a command device parameter string, such as:
<screen width="60" format="linespecific">        aha152x=0x340,11,3,1</screen>

This parameter string can be supplied in several ways using LILO:
<itemizedlist><listitem><para>By entering it on the command line every time the system is booted via
LILO.  This is boring, though.</para></listitem><listitem><para>By using LILO's <literal moreinfo="none">lock</literal> keyword to make it store the
command line as the default command line, so that LILO will use the same
options every time it boots.</para></listitem><listitem><para>By using the <literal moreinfo="none">append=</literal> statement in the LILO config file.
Note that the parameter string must be enclosed in quotes.</para></listitem></itemizedlist></para><para> For example, a sample command line using the above parameter string
would be:
<screen width="60" format="linespecific">        zImage  aha152x=0x340,11,3,1 root=/dev/sda1 lock</screen></para><para> This would pass the device parameter string through, and also ask
the kernel to set the root device to <filename moreinfo="none">/dev/sda1</filename> and
save the whole command line and reuse it for all future boots.</para><para>A sample APPEND statement is:
<screen width="60" format="linespecific">        APPEND = entaha152x=0x340,11,3,1ent</screen></para><para> Note that the parameter string must <emphasis>not</emphasis> be
enclosed in quotes on the command line, but it <emphasis>must</emphasis> be
enclosed in quotes in the <literal moreinfo="none">APPEND</literal> statement.</para><para> Note also that for the parameter string to be acted on, the kernel
must contain the driver for that disk type.  If it does not, then there is
nothing listening for the parameter string, and you will have to rebuild
the kernel to include the required driver.  For details on rebuilding the
kernel, go to  <filename moreinfo="none">/usr/src/linux</filename> and read the README, and
read the Linux FAQ and Installation HOWTO.  Alternatively you could obtain
a generic kernel for the disk type and install that.</para><para>Readers are strongly urged to read the LILO documentation before
experimenting with LILO installation.  Incautious use of the
<literal moreinfo="none">BOOT</literal> statement can damage partitions.</para></answer></qandaentry><qandaentry><question><para><emphasis>At boot time, I get error ent<literal moreinfo="none">A: cannot execute
B</literal>ent. Why?</emphasis></para></question><answer><para><indexterm significance="normal"><primary>hardcoded locations</primary></indexterm>
There are several cases of program names being hardcoded in various utilities.
These cases do not occur everywhere, but they may explain why an executable
apparently cannot be found on your system even though you can see that it is
there.  You can find out if a given program has the name of another hardcoded
by using the <command moreinfo="none">strings</command> command and piping the output
through <command moreinfo="none">grep</command>.</para><para>Known examples of hardcoding are:

<itemizedlist><listitem><para><command moreinfo="none">shutdown</command> in some versions has
<filename moreinfo="none">/etc/reboot</filename> hardcoded, so <command moreinfo="none">reboot</command>
must be placed in the <filename moreinfo="none">/etc</filename> directory.</para></listitem><listitem><para><command moreinfo="none">init</command> has caused problems for at least one person, with the
kernel being unable to find <command moreinfo="none">init</command>.</para></listitem></itemizedlist></para><para> To fix these problems, either move the programs to the correct
directory, or change configuration files
(e.g. <filename moreinfo="none">inittab</filename>) to point to the correct directory.  If
in doubt, put programs in the same directories as they are on your hard
disk, and use the same <filename moreinfo="none">inittab</filename> and
<filename moreinfo="none">/etc/rc.d</filename> files as they appear on your hard disk.</para></answer></qandaentry><qandaentry><question><para><emphasis>My kernel has ramdisk support, but initializes ramdisks of 0K.  Why?</emphasis></para></question><answer><para>Where this occurs, a kernel message like this will appear as the kernel is
booting: <indexterm significance="normal"><primary>ramdisk</primary></indexterm>
<screen width="60" format="linespecific">        Ramdisk driver initialized : 16 ramdisks of 0K size</screen></para><para>This is probably because the size has been set to 0 by kernel parameters at
boot time.  This could possibly be because of an overlooked LILO configuration
file parameter:
<screen width="60" format="linespecific">    ramdisk= 0</screen></para><para>This was included in sample LILO configuration files in some older
distributions, and was put there to override any previous kernel setting.  If
you have such a line, remove it.</para><para>Note that if you attempt to use a ramdisk of 0 size, the
behaviour can be unpredictable, and can result in kernel panics.</para></answer></qandaentry></qandaset></sect1><appendix><title>Resources and pointers</title><para>When retrieving a package, always get the latest version unless you have
good reasons for not doing so.</para><sect1 id="premade" xreflabel="Appendix A.1"><title>Pre-made Bootdisks</title><para>These are sources for distribution bootdisks.  <emphasis>Please use one of
the mirror sites to reduce the load on these machines.</emphasis>

<itemizedlist><listitem><para> <ulink url="http://distro.ibiblio.org/pub/Linux/distributions/slackware/bootdsks.144/">Slackware bootdisks</ulink>,
<ulink url="http://distro.ibiblio.org/pub/Linux/distributions/slackware/rootdsks/">rootdisks</ulink> 

and <ulink url="http://www.slackware.com/getslack/">Slackware mirror sites</ulink></para></listitem><listitem><para> <ulink url="ftp://ftp.redhat.com/pub/redhat/linux/current/en/os/i386/images/">RedHat bootdisks</ulink> and <ulink url="http://www.redhat.com/mirrors.html">Red Hat mirror sites</ulink>
</para></listitem><listitem><para> <ulink url="ftp://ftp.debian.org/debian/dists/stable/main/disks-i386/current/">Debian bootdisks</ulink> and <ulink url="ftp://ftp.debian.org/debian/README.mirrors.html">Debian mirror sites</ulink>
</para></listitem><listitem><para><ulink url="http://www.linux-mandrake.com/en/ftp.php3">Mandrake
downloads</ulink></para></listitem></itemizedlist>
</para><para>
In addition to the distribution bootdisks, the following rescue disk
images are available.  Unless otherwise specified, these are available in
the directory
<ulink url="http://www.ibiblio.org/pub/Linux/system/recovery/!INDEX.html"><filename moreinfo="none">http://www.ibiblio.org/pub/Linux/system/recovery/!INDEX.html</filename></ulink></para><para>
<itemizedlist><listitem><para><literal moreinfo="none">RIP</literal> is a boot/rescue system which comes in several
versions: one that fits on a 1.44M floppy diskette and one that fits on a
CD-ROM.  It has large file support and many utility programs for disk
maintenance and rescue.  It has support for ext2, ext3, iso9660, msdos, ntfs,
reiserfs, ufs and vfat.  RIP is available from 
<ulink url="http://www.tux.org/pub/people/kent-robotti/looplinux/rip/index.html">http://www.tux.org/pub/people/kent-robotti/looplinux/rip/index.html</ulink></para></listitem><listitem><para><literal moreinfo="none">tomsrtbt</literal>, by Tom Oehser, is a single-disk boot/root disk
based on kernel 2.0, with a large set of features and support programs.  It
supports IDE, SCSI, tape, network adaptors, PCMCIA and more.  About 100
utility programs and tools are included for fixing and restoring disks.
The package also includes scripts for disassembling and reconstructing the
images so that new material can be added if necessary.</para></listitem><listitem><para><literal moreinfo="none">rescue02</literal>, by John Comyns, is a rescue disk based on kernel
1.3.84, with support for IDE and Adaptec 1542 and NCR53C7,8xx.  It uses ELF
binaries but it has enough commands so that it can be used on any system.
There are modules that can be loaded after booting for all other SCSI
cards.  It probably won't work on systems with 4 mb of ram since it uses a
3 mb ram disk.</para></listitem><listitem><para><literal moreinfo="none">resqueentdisk-2.0.22</literal>, by Sergei Viznyuk, is a
full-featured boot/root disk based on kernel 2.0.22 with built-in
support for IDE, many difference SCSI controllers, and ELF/AOUT.  Also
includes many modules and useful utilities for repairing and restoring
a hard disk.</para></listitem><listitem><para><ulink url="http://www.ibiblio.org/pub/Linux/system/recovery/images"><literal moreinfo="none">cramdisk</literal> images</ulink>, based on the 2.0.23 kernel,
available for 4 meg and 8 meg machines.  They include math emulation and
networking (PPP and dialin script, NE2000, 3C509), or support for the
parallel port ZIP drive.  These diskette images will boot on a 386 with 4MB
RAM.  MSDOS support is included so you can download from the net to a DOS
partition.</para></listitem></itemizedlist>
</para></sect1><sect1><title>Rescue packages</title><para> Several packages for creating rescue disks are available on
www.ibiblio.org.  With these packages you specify a set of files for inclusion
and the software automates (to varying degrees) the creation of a bootdisk.
See <ulink url="http://www.ibiblio.org/pub/Linux/system/recovery/!INDEX.html"><filename moreinfo="none">http://www.ibiblio.org/pub/Linux/system/recovery/!INDEX.html</filename></ulink>
for more information.  <emphasis>Check the file dates carefully</emphasis>.
Some of these packages have not been updated in several years and will not
support the creation of a compressed root filesystem loaded into ramdisk.  To
the best of our knowledge, <ulink url="http://www.linuxlots.com/~fawcett/yard/index.html">Yard</ulink> is the only
package that will.</para></sect1><sect1><title>LILO -- the Linux loader</title><para>Written by Werner Almesberger.  Excellent boot loader, and the documentation
includes information on the boot sector contents and the early stages of the
boot process.</para><para>Ftp from <ulink url="ftp://tsx-11.mit.edu/pub/linux/packages/lilo/">ftp://tsx-11.mit.edu/pub/linux/packages/lilo/</ulink>.  It is also
available on Metalab and mirrors.</para></sect1><sect1><title>Ramdisk usage</title><indexterm significance="normal"><primary>ramdisk</primary></indexterm><para>An excellent description of the how the ramdisk code works may be found
with the documentation supplied with the Linux kernel.  See
<filename moreinfo="none">/usr/src/linux/Documentation/ramdisk.txt</filename>.  It is
written by Paul Gortmaker and includes a section on creating a compressed
ramdisk.</para></sect1><sect1><title>The Linux boot process</title><indexterm significance="normal"><primary>boot process</primary></indexterm><para>For more detail on the Linux boot process, here are some pointers:

<itemizedlist><listitem><para>The <ulink url="http://linuxdoc.org/LDP/sag/index.html"><citetitle>Linux
System Administrators' Guide</citetitle></ulink> has a section on booting.</para></listitem><listitem><para>The <ulink url="http://www.ibiblio.org/pub/Linux/system/boot/lilo/lilo-t-21.ps.gz">LILO ``Technical overview''</ulink> has the definitive technical, low-level
description of the boot process, up to where the kernel is started.</para></listitem><listitem><para> The source code is the ultimate guide.  Below are some kernel
files related to the boot process.  If you have the Linux kernel source code,
you can find these under <filename moreinfo="none">/usr/src/linux</filename> on your machine;
alternatively, Shigio Yamaguchi (shigio at tamacom.com) has a very nice <ulink url="http://www.tamacom.com/tour/linux/index.html">hypertext kernel
browser</ulink> for reading kernel source files.  Here are some relevant files
to look at:
                                                                   
<variablelist><varlistentry><term><filename moreinfo="none">arch/i386/boot/bootsect.S</filename> and
<filename moreinfo="none">setup.S</filename></term><listitem><para>Contain assembly code for the bootsector itself.</para></listitem></varlistentry><varlistentry><term><filename moreinfo="none">arch/i386/boot/compressed/misc.c</filename></term><listitem><para>Contains code for uncompressing the kernel.</para></listitem></varlistentry><varlistentry><term><filename moreinfo="none">arch/i386/kernel/</filename></term><listitem><para>Directory containing kernel initialization code.
<filename moreinfo="none">setup.c</filename> defines the ramdisk word.</para></listitem></varlistentry><varlistentry><term><filename moreinfo="none">drivers/block/rd.c</filename></term><listitem><para>Contains the ramdisk driver. The procedures
<command moreinfo="none">rdentload</command> and <command moreinfo="none">rdentloadentimage</command> load blocks from a device into a
ramdisk.  The procedure
<command moreinfo="none">identifyentramdiskentimage</command> determines what
kind of filesystem is found and whether it is compressed.</para></listitem></varlistentry></variablelist>
</para></listitem></itemizedlist>
</para></sect1></appendix><appendix><title>LILO boot error codes</title><indexterm significance="normal"><primary>LILO</primary><secondary>error codes</secondary></indexterm><para>Questions about these codes are asked so often on Usenet that we include
them here as a public service.  This summary is excerpted from Werner
Almsberger's <ulink url="http://www.ibiblio.org/pub/Linux/system/boot/lilo/lilo-u-21.ps.gz">LILO User Documentation</ulink>.</para><para> When LILO loads itself, it displays the word
<literal moreinfo="none">LILO</literal>.  Each letter is printed before or after performing
some specific action.  If LILO fails at some point, the letters printed so
far can be used to identify the problem.</para><informaltable><tgroup cols="2" align="left"><colspec colname="output" colwidth="1in" align="left"></colspec><colspec colname="descrip" align="left"></colspec><thead><row><entry>Output</entry><entry>Problem</entry></row></thead><tbody><row><entry>(nothing)</entry><entry>            No part of LILO has been loaded.  LILO either isn't installed or
            the partition on which its boot sector is located isn't active.
            </entry></row><row><entry>L</entry><entry>            The first stage boot loader has been loaded and started, but it
            can't load the second stage boot loader.  The two-digit error
            codes indicate the type of problem. (See also section ``Disk error
            codes''.)  This condition usually indicates a media failure or a
            geometry mismatch (e.g. bad disk parameters).
            </entry></row><row><entry>LI</entry><entry>            The first stage boot loader was able to load the second stage boot
            loader, but has failed to execute it. This can either be caused by
            a geometry mismatch or by moving <filename moreinfo="none">/boot/boot.b
           </filename>
            without running the map installer.
            </entry></row><row><entry>LIL</entry><entry>            The second stage boot loader has been started, but it can't load
            the descriptor table from the map file. This is typically caused
            by a media failure or by a geometry mismatch.
            </entry></row><row><entry>LIL?</entry><entry>            The second stage boot loader has been loaded at an incorrect
            address. This is typically caused by a subtle geometry mismatch or
            by moving <filename moreinfo="none">/boot/boot.b</filename> without running the
            map installer.
            </entry></row><row><entry>LIL-</entry><entry>            The descriptor table is corrupt. This can either be caused by a
            geometry mismatch or by moving /boot/map without running the map
            installer.
            </entry></row><row><entry>LILO</entry><entry>            All parts of LILO have been successfully loaded. 
            </entry></row></tbody></tgroup></informaltable><para>If the BIOS signals an error when LILO is trying to load a boot image, the
respective error code is displayed.  These codes range from
<literal moreinfo="none">0x00</literal> through <literal moreinfo="none">0xbb</literal>.  See the LILO User
Guide for an explanation of these.</para></appendix><appendix id="listings"><title>Sample root filesystem listings</title><indexterm significance="normal"><primary>root filesystem</primary></indexterm><para><screen width="80" format="linespecific">/:
drwxententxententx   2 root     root         1024 Nov  1 15:39 bin
drwxententxententx   2 root     root         4096 Nov  1 15:39 dev
drwxententxententx   3 root     root         1024 Nov  1 15:39 etc
drwxententxententx   4 root     root         1024 Nov  1 15:39 lib
drwxententxententx   5 root     root         1024 Nov  1 15:39 mnt
drwxententxententx   2 root     root         1024 Nov  1 15:39 proc
drwxententxententx   2 root     root         1024 Nov  1 15:39 root
drwxententxententx   2 root     root         1024 Nov  1 15:39 sbin
drwxententxententx   2 root     root         1024 Nov  1 15:39 tmp
drwxententxententx   7 root     root         1024 Nov  1 15:39 usr
drwxententxententx   5 root     root         1024 Nov  1 15:39 var

/bin:
-rwxententxententx   1 root     root        62660 Nov  1 15:39 ash
-rwxententxententx   1 root     root         9032 Nov  1 15:39 cat
-rwxententxententx   1 root     root        10276 Nov  1 15:39 chmod
-rwxententxententx   1 root     root         9592 Nov  1 15:39 chown
-rwxententxententx   1 root     root        23124 Nov  1 15:39 cp
-rwxententxententx   1 root     root        23028 Nov  1 15:39 date
-rwxententxententx   1 root     root        14052 Nov  1 15:39 dd
-rwxententxententx   1 root     root        14144 Nov  1 15:39 df
-rwxententxententx   1 root     root        69444 Nov  1 15:39 egrep
-rwxententxententx   1 root     root          395 Nov  1 15:39 false
-rwxententxententx   1 root     root        69444 Nov  1 15:39 fgrep
-rwxententxententx   1 root     root        69444 Nov  1 15:39 grep
-rwxententxententx   3 root     root        45436 Nov  1 15:39 gunzip
-rwxententxententx   3 root     root        45436 Nov  1 15:39 gzip
-rwxententxententx   1 root     root         8008 Nov  1 15:39 hostname
-rwxententxententx   1 root     root        12736 Nov  1 15:39 ln
-rwsententxententx   1 root     root        15284 Nov  1 15:39 login
-rwxententxententx   1 root     root        29308 Nov  1 15:39 ls
-rwxententxententx   1 root     root         8268 Nov  1 15:39 mkdir
-rwxententxententx   1 root     root         8920 Nov  1 15:39 mknod
-rwxententxententx   1 root     root        24836 Nov  1 15:39 more
-rwsententxententx   1 root     root        37640 Nov  1 15:39 mount
-rwxententxententx   1 root     root        12240 Nov  1 15:39 mt
-rwxententxententx   1 root     root        12932 Nov  1 15:39 mv
-r-xententxententx   1 root     root        12324 Nov  1 15:39 ps
-rwxententxententx   1 root     root         5388 Nov  1 15:39 pwd
-rwxententxententx   1 root     root        10092 Nov  1 15:39 rm
lrwxrwxrwx   1 root     root            3 Nov  1 15:39 sh -ent ash
-rwxententxententx   1 root     root        25296 Nov  1 15:39 stty
-rwsententxententx   1 root     root        12648 Nov  1 15:39 su
-rwxententxententx   1 root     root         4444 Nov  1 15:39 sync
-rwxententxententx   1 root     root        19712 Nov  1 15:39 touch
-rwxententxententx   1 root     root          395 Nov  1 15:39 true
-rwsententxententx   1 root     root        19084 Nov  1 15:39 umount
-rwxententxententx   1 root     root         5368 Nov  1 15:39 uname
-rwxententxententx   3 root     root        45436 Nov  1 15:39 zcat

/dev:
lrwxrwxrwx   1 root     root            6 Nov  1 15:39 cdrom -ent cdu31a
brwentrwentrentent   1 root     root      15,   0 May  5  1998 cdu31a
crwententententententent   1 root     root       4,   0 Nov  1 15:29 console
crwentrwentrwent   1 root     uucp       5,  64 Sep  9 19:46 cua0
crwentrwentrwent   1 root     uucp       5,  65 May  5  1998 cua1
crwentrwentrwent   1 root     uucp       5,  66 May  5  1998 cua2
crwentrwentrwent   1 root     uucp       5,  67 May  5  1998 cua3
brwentrwentententent   1 root     floppy     2,   0 Aug  8 13:54 fd0
brwentrwentententent   1 root     floppy     2,  36 Aug  8 13:54 fd0CompaQ
brwentrwentententent   1 root     floppy     2,  84 Aug  8 13:55 fd0D1040
brwentrwentententent   1 root     floppy     2,  88 Aug  8 13:55 fd0D1120
brwentrwentententent   1 root     floppy     2,  12 Aug  8 13:54 fd0D360
brwentrwentententent   1 root     floppy     2,  16 Aug  8 13:54 fd0D720
brwentrwentententent   1 root     floppy     2, 120 Aug  8 13:55 fd0D800
brwentrwentententent   1 root     floppy     2,  32 Aug  8 13:54 fd0E2880
brwentrwentententent   1 root     floppy     2, 104 Aug  8 13:55 fd0E3200
brwentrwentententent   1 root     floppy     2, 108 Aug  8 13:55 fd0E3520
brwentrwentententent   1 root     floppy     2, 112 Aug  8 13:55 fd0E3840
brwentrwentententent   1 root     floppy     2,  28 Aug  8 13:54 fd0H1440
brwentrwentententent   1 root     floppy     2, 124 Aug  8 13:55 fd0H1600
brwentrwentententent   1 root     floppy     2,  44 Aug  8 13:55 fd0H1680
brwentrwentententent   1 root     floppy     2,  60 Aug  8 13:55 fd0H1722
brwentrwentententent   1 root     floppy     2,  76 Aug  8 13:55 fd0H1743
brwentrwentententent   1 root     floppy     2,  96 Aug  8 13:55 fd0H1760
brwentrwentententent   1 root     floppy     2, 116 Aug  8 13:55 fd0H1840
brwentrwentententent   1 root     floppy     2, 100 Aug  8 13:55 fd0H1920
lrwxrwxrwx   1 root     root            7 Nov  1 15:39 fd0H360 entent fd0D360
lrwxrwxrwx   1 root     root            7 Nov  1 15:39 fd0H720 entent fd0D720
brwentrwentententent   1 root     floppy     2,  52 Aug  8 13:55 fd0H820
brwentrwentententent   1 root     floppy     2,  68 Aug  8 13:55 fd0H830
brwentrwentententent   1 root     floppy     2,   4 Aug  8 13:54 fd0d360
brwentrwentententent   1 root     floppy     2,   8 Aug  8 13:54 fd0h1200
brwentrwentententent   1 root     floppy     2,  40 Aug  8 13:54 fd0h1440
brwentrwentententent   1 root     floppy     2,  56 Aug  8 13:55 fd0h1476
brwentrwentententent   1 root     floppy     2,  72 Aug  8 13:55 fd0h1494
brwentrwentententent   1 root     floppy     2,  92 Aug  8 13:55 fd0h1600
brwentrwentententent   1 root     floppy     2,  20 Aug  8 13:54 fd0h360
brwentrwentententent   1 root     floppy     2,  48 Aug  8 13:55 fd0h410
brwentrwentententent   1 root     floppy     2,  64 Aug  8 13:55 fd0h420
brwentrwentententent   1 root     floppy     2,  24 Aug  8 13:54 fd0h720
brwentrwentententent   1 root     floppy     2,  80 Aug  8 13:55 fd0h880
brwentrwentententent   1 root     disk       3,   0 May  5  1998 hda
brwentrwentententent   1 root     disk       3,   1 May  5  1998 hda1
brwentrwentententent   1 root     disk       3,   2 May  5  1998 hda2
brwentrwentententent   1 root     disk       3,   3 May  5  1998 hda3
brwentrwentententent   1 root     disk       3,   4 May  5  1998 hda4
brwentrwentententent   1 root     disk       3,   5 May  5  1998 hda5
brwentrwentententent   1 root     disk       3,   6 May  5  1998 hda6
brwentrwentententent   1 root     disk       3,  64 May  5  1998 hdb
brwentrwentententent   1 root     disk       3,  65 May  5  1998 hdb1
brwentrwentententent   1 root     disk       3,  66 May  5  1998 hdb2
brwentrwentententent   1 root     disk       3,  67 May  5  1998 hdb3
brwentrwentententent   1 root     disk       3,  68 May  5  1998 hdb4
brwentrwentententent   1 root     disk       3,  69 May  5  1998 hdb5
brwentrwentententent   1 root     disk       3,  70 May  5  1998 hdb6
crwentrententententent   1 root     kmem       1,   2 May  5  1998 kmem
crwentrententententent   1 root     kmem       1,   1 May  5  1998 mem
lrwxrwxrwx   1 root     root           12 Nov  1 15:39 modem entent ttyS1
lrwxrwxrwx   1 root     root           12 Nov  1 15:39 mouse entent psaux
crwentrwentrwent   1 root     root       1,   3 May  5  1998 null
crwxrwxrwx   1 root     root      10,   1 Oct  5 20:22 psaux
brwentrententententent   1 root     disk       1,   1 May  5  1998 ram
brwentrwentententent   1 root     disk       1,   0 May  5  1998 ram0
brwentrwentententent   1 root     disk       1,   1 May  5  1998 ram1
brwentrwentententent   1 root     disk       1,   2 May  5  1998 ram2
brwentrwentententent   1 root     disk       1,   3 May  5  1998 ram3
brwentrwentententent   1 root     disk       1,   4 May  5  1998 ram4
brwentrwentententent   1 root     disk       1,   5 May  5  1998 ram5
brwentrwentententent   1 root     disk       1,   6 May  5  1998 ram6
brwentrwentententent   1 root     disk       1,   7 May  5  1998 ram7
brwentrwentententent   1 root     disk       1,   8 May  5  1998 ram8
brwentrwentententent   1 root     disk       1,   9 May  5  1998 ram9
lrwxrwxrwx   1 root     root            4 Nov  1 15:39 ramdisk entent ram0
<emphasis role="bold">***  I have only included devices for the IDE partitions I use.
***  If you use SCSI, then use the /dev/sdXX devices instead.</emphasis>
crwententententententent   1 root     root       4,   0 May  5  1998 tty0
crwentwententententent   1 root     tty        4,   1 Nov  1 15:39 tty1
crwententententententent   1 root     root       4,   2 Nov  1 15:29 tty2
crwententententententent   1 root     root       4,   3 Nov  1 15:29 tty3
crwententententententent   1 root     root       4,   4 Nov  1 15:29 tty4
crwententententententent   1 root     root       4,   5 Nov  1 15:29 tty5
crwententententententent   1 root     root       4,   6 Nov  1 15:29 tty6
crwententententententent   1 root     root       4,   7 May  5  1998 tty7
crwententententententent   1 root     tty        4,   8 May  5  1998 tty8
crwententententententent   1 root     tty        4,   9 May  8 12:57 tty9
crwentrwentrwent   1 root     root       4,  65 Nov  1 12:17 ttyS1
crwentrwentrwent   1 root     root       1,   5 May  5  1998 zero

/etc:
entrwententententententent   1 root     root          164 Nov  1 15:39 conf.modules
entrwententententententent   1 root     root          668 Nov  1 15:39 fstab
entrwententententententent   1 root     root           71 Nov  1 15:39 gettydefs
entrwententententententent   1 root     root          389 Nov  1 15:39 group
entrwententententententent   1 root     root          413 Nov  1 15:39 inittab
entrwententententententent   1 root     root           65 Nov  1 15:39 issue
entrwentrententrentent   1 root     root          746 Nov  1 15:39 ld.so.cache
entrwententententententent   1 root     root           32 Nov  1 15:39 motd
entrwententententententent   1 root     root          949 Nov  1 15:39 nsswitch.conf
drwxententxententx   2 root     root         1024 Nov  1 15:39 pam.d
entrwententententententent   1 root     root          139 Nov  1 15:39 passwd
entrwententententententent   1 root     root          516 Nov  1 15:39 profile
entrwxententxententx   1 root     root          387 Nov  1 15:39 rc
entrwententententententent   1 root     root           55 Nov  1 15:39 shells
entrwententententententent   1 root     root          774 Nov  1 15:39 termcap
entrwententententententent   1 root     root           78 Nov  1 15:39 ttytype
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 utmp entent ../var/run/utmp
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 wtmp entent ../var/log/wtmp

/etc/pam.d:
entrwententententententent   1 root     root          356 Nov  1 15:39 other

/lib:
entrwxrentxrentx   1 root     root        45415 Nov  1 15:39 ldent2.0.7.so
lrwxrwxrwx   1 root     root           11 Nov  1 15:39 ldentlinux.so.2 entent ldent2.0.7.so
entrwxrentxrentx   1 root     root       731548 Nov  1 15:39 libcent2.0.7.so
lrwxrwxrwx   1 root     root           13 Nov  1 15:39 libc.so.6 entent libcent2.0.7.so
lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libcomenterr.so.2 entent libcomenterr.so.2.0
entrwxrentxrentx   1 root     root         6209 Nov  1 15:39 libcomenterr.so.2.0
entrwxrentxrentx   1 root     root       153881 Nov  1 15:39 libcryptent2.0.7.so
lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libcrypt.so.1 entent libcryptent2.0.7.so
entrwxrentxrentx   1 root     root        12962 Nov  1 15:39 libdlent2.0.7.so
lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libdl.so.2 entent libdlent2.0.7.so
lrwxrwxrwx   1 root     root           16 Nov  1 15:39 libext2fs.so.2 entent libext2fs.so.2.4
entrwxrentxrentx   1 root     root        81382 Nov  1 15:39 libext2fs.so.2.4
entrwxrentxrentx   1 root     root        25222 Nov  1 15:39 libnslent2.0.7.so
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 libnsl.so.1 entent libnslent2.0.7.so
entrwxententxententx   1 root     root       178336 Nov  1 15:39 libnssentfilesent2.0.7.so
lrwxrwxrwx   1 root     root           21 Nov  1 15:39 libnssentfiles.so.1 entent libnssentfilesent2.0.7.so
lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libpam.so.0 entent libpam.so.0.64
entrwxrentxrentx   1 root     root        26906 Nov  1 15:39 libpam.so.0.64
lrwxrwxrwx   1 root     root           19 Nov  1 15:39 libpamentmisc.so.0 entent libpamentmisc.so.0.64
entrwxrentxrentx   1 root     root         7086 Nov  1 15:39 libpamentmisc.so.0.64
entrentxrentxrentx   1 root     root        35615 Nov  1 15:39 libproc.so.1.2.6
lrwxrwxrwx   1 root     root           15 Nov  1 15:39 libpwdb.so.0 entent libpwdb.so.0.54
entrwentrentrententent   1 root     root       121899 Nov  1 15:39 libpwdb.so.0.54
lrwxrwxrwx   1 root     root           19 Nov  1 15:39 libtermcap.so.2 entent libtermcap.so.2.0.8
entrwxrentxrentx   1 root     root        12041 Nov  1 15:39 libtermcap.so.2.0.8
entrwxrentxrentx   1 root     root        12874 Nov  1 15:39 libutilent2.0.7.so
lrwxrwxrwx   1 root     root           16 Nov  1 15:39 libutil.so.1 entent libutilent2.0.7.so
lrwxrwxrwx   1 root     root           14 Nov  1 15:39 libuuid.so.1 entent libuuid.so.1.1
entrwxrentxrentx   1 root     root         8039 Nov  1 15:39 libuuid.so.1.1
drwxententxententx   3 root     root         1024 Nov  1 15:39 modules
drwxententxententx   2 root     root         1024 Nov  1 15:39 security

/lib/modules:
drwxententxententx   4 root     root         1024 Nov  1 15:39 2.0.35

/lib/modules/2.0.35:
drwxententxententx   2 root     root         1024 Nov  1 15:39 block
drwxententxententx   2 root     root         1024 Nov  1 15:39 cdrom

/lib/modules/2.0.35/block:
drwxentententententent   1 root     root         7156 Nov  1 15:39 loop.o

/lib/modules/2.0.35/cdrom:
drwxentententententent   1 root     root        24108 Nov  1 15:39 cdu31a.o

/lib/security:
entrwxententxententx   1 root     root         8771 Nov  1 15:39 pamentpermit.so

<emphasis role="bold">***  Directory stubs for mounting</emphasis>
/mnt:
drwxententxententx   2 root     root         1024 Nov  1 15:39 cdrom
drwxententxententx   2 root     root         1024 Nov  1 15:39 floppy

/proc:

/root:
entrwententententententent   1 root     root          176 Nov  1 15:39 .bashrc
entrwententententententent   1 root     root          182 Nov  1 15:39 .cshrc
entrwxententxententx   1 root     root          455 Nov  1 15:39 .profile
entrwententententententent   1 root     root         4014 Nov  1 15:39 .tcshrc

/sbin:
entrwxententxententx   1 root     root        23976 Nov  1 15:39 depmod
entrwxententxententx   2 root     root       274600 Nov  1 15:39 e2fsck
entrwxententxententx   1 root     root        41268 Nov  1 15:39 fdisk
entrwxententxententx   1 root     root         9396 Nov  1 15:39 fsck
entrwxententxententx   2 root     root       274600 Nov  1 15:39 fsck.ext2
entrwxententxententx   1 root     root        29556 Nov  1 15:39 getty
entrwxententxententx   1 root     root         6620 Nov  1 15:39 halt
entrwxententxententx   1 root     root        23116 Nov  1 15:39 init
entrwxententxententx   1 root     root        25612 Nov  1 15:39 insmod
entrwxententxententx   1 root     root        10368 Nov  1 15:39 kerneld
entrwxententxententx   1 root     root       110400 Nov  1 15:39 ldconfig
entrwxententxententx   1 root     root         6108 Nov  1 15:39 lsmod
entrwxententxententx   2 root     root        17400 Nov  1 15:39 mke2fs
entrwxententxententx   1 root     root         4072 Nov  1 15:39 mkfs
entrwxententxententx   2 root     root        17400 Nov  1 15:39 mkfs.ext2
entrwxententxententx   1 root     root         5664 Nov  1 15:39 mkswap
entrwxententxententx   1 root     root        22032 Nov  1 15:39 modprobe
lrwxrwxrwx   1 root     root            4 Nov  1 15:39 reboot entent halt
entrwxententxententx   1 root     root         7492 Nov  1 15:39 rmmod
entrwxententxententx   1 root     root        12932 Nov  1 15:39 shutdown
lrwxrwxrwx   1 root     root            6 Nov  1 15:39 swapoff entent swapon
entrwxententxententx   1 root     root         5124 Nov  1 15:39 swapon
lrwxrwxrwx   1 root     root            4 Nov  1 15:39 telinit entent init
entrwxententxententx   1 root     root         6944 Nov  1 15:39 update

/tmp:

/usr:
drwxententxententx   2 root     root         1024 Nov  1 15:39 bin
drwxententxententx   2 root     root         1024 Nov  1 15:39 lib
drwxententxententx   3 root     root         1024 Nov  1 15:39 man
drwxententxententx   2 root     root         1024 Nov  1 15:39 sbin
drwxententxententx   3 root     root         1024 Nov  1 15:39 share
lrwxrwxrwx   1 root     root           10 Nov  1 15:39 tmp entent ../var/tmp

/usr/bin:
entrwxententxententx   1 root     root        37164 Nov  1 15:39 afio
entrwxententxententx   1 root     root         5044 Nov  1 15:39 chroot
entrwxententxententx   1 root     root        10656 Nov  1 15:39 cut
entrwxententxententx   1 root     root        63652 Nov  1 15:39 diff
entrwxententxententx   1 root     root        12972 Nov  1 15:39 du
entrwxententxententx   1 root     root        56552 Nov  1 15:39 find
entrentxententxententx   1 root     root         6280 Nov  1 15:39 free
entrwxententxententx   1 root     root         7680 Nov  1 15:39 head
entrwxententxententx   1 root     root         8504 Nov  1 15:39 id
entrentsrentxrentx   1 root     bin          4200 Nov  1 15:39 passwd
entrwxententxententx   1 root     root        14856 Nov  1 15:39 tail
entrwxententxententx   1 root     root        19008 Nov  1 15:39 tr
entrwxententxententx   1 root     root         7160 Nov  1 15:39 wc
entrwxententxententx   1 root     root         4412 Nov  1 15:39 whoami

/usr/lib:
lrwxrwxrwx   1 root     root           17 Nov  1 15:39 libncurses.so.4 entent libncurses.so.4.2
entrwentrentrententent   1 root     root       260474 Nov  1 15:39 libncurses.so.4.2

/usr/sbin:
entrentxententxententx   1 root     root        13684 Nov  1 15:39 fuser
entrwxententxententx   1 root     root         3876 Nov  1 15:39 mklost+found

/usr/share:
drwxententxententx   4 root     root         1024 Nov  1 15:39 terminfo

/usr/share/terminfo:
drwxententxententx   2 root     root         1024 Nov  1 15:39 l
drwxententxententx   2 root     root         1024 Nov  1 15:39 v

/usr/share/terminfo/l:
entrwententententententent   1 root     root         1552 Nov  1 15:39 linux
entrwententententententent   1 root     root         1516 Nov  1 15:39 linuxentm
entrwententententententent   1 root     root         1583 Nov  1 15:39 linuxentnic

/usr/share/terminfo/v:
entrwententententententent   2 root     root         1143 Nov  1 15:39 vt100
entrwententententententent   2 root     root         1143 Nov  1 15:39 vt100entam

/var:
drwxententxententx   2 root     root         1024 Nov  1 15:39 log
drwxententxententx   2 root     root         1024 Nov  1 15:39 run
drwxententxententx   2 root     root         1024 Nov  1 15:39 tmp

/var/log:
entrwententententententent   1 root     root            0 Nov  1 15:39 wtmp

/var/run:
entrwententententententent   1 root     root            0 Nov  1 15:39 utmp

/var/tmp:</screen></para></appendix><appendix id="utilitylist"><title>Sample utility disk directory listing</title><indexterm significance="normal"><primary>utility diskette</primary></indexterm><para><screen width="80" format="linespecific">total 579
entrwxrentxrentx   1 root     root        42333 Jul 28 19:05 cpio
entrwxrentxrentx   1 root     root        32844 Aug 28 19:50 debugfs
entrwxrentxrentx   1 root     root       103560 Jul 29 21:31 elvis
entrwxrentxrentx   1 root     root        29536 Jul 28 19:04 fdisk
entrwentrentrententent   1 root     root       128254 Jul 28 19:03 ftape.o
entrwxrentxrentx   1 root     root        17564 Jul 25 03:21 ftmt
entrwxrentxrentx   1 root     root        64161 Jul 29 20:47 grep
entrwxrentxrentx   1 root     root        45309 Jul 29 20:48 gzip
entrwxrentxrentx   1 root     root        23560 Jul 28 19:04 insmod
entrwxrentxrentx   1 root     root          118 Jul 28 19:04 lsmod
lrwxrwxrwx   1 root     root            5 Jul 28 19:04 mt entent mtentst
entrwxrentxrentx   1 root     root         9573 Jul 28 19:03 mtentst
lrwxrwxrwx   1 root     root            6 Jul 28 19:05 rmmod entent insmod
entrwxrentxrentx   1 root     root       104085 Jul 28 19:05 tar
lrwxrwxrwx   1 root     root            5 Jul 29 21:35 vi entent elvis</screen></para></appendix></article>

