add directory study

This commit is contained in:
gohigh
2024-02-19 00:25:23 -05:00
parent b1306b38b1
commit f3774e2f8c
4001 changed files with 2285787 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
<HTML>
<HEAD>
<TITLE>The Linux Bootdisk HOWTO: Introduction</TITLE>
</HEAD>
<BODY>
<IMG SRC="prev.gif" ALT="Previous">
<A HREF="Bootdisk-HOWTO-2.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc1"><IMG SRC="toc.gif" ALT="Contents"></A>
<HR>
<H2><A NAME="s1">1. Introduction</A></H2>
<H2><A NAME="ss1.1">1.1 Why Build Boot Disks?</A></H2>
<P>Linux boot disks are useful in a number of situations, such as:
<UL>
<LI>Testing a new kernel.</LI>
<LI>Recovering from disk or system failure. Such a failure could be
anything from a lost boot sector to a disk head crash.</LI>
</UL>
</P>
<P>There are several ways of producing boot disks:
<UL>
<LI>Use one from a distribution such as Slackware. This will at
least allow you to boot.</LI>
<LI>Use a rescue package to set up disks designed to be used
as rescue disks.</LI>
<LI>Learn what is required for each of the various types of disk
to operate, then build your own.</LI>
</UL>
</P>
<P>I originally chose the last option - learn how it works so that you
can do it yourself. That way, if something breaks, you can work out
what to do to fix it. Plus you learn a lot about how Linux works along
the way. Once I understood how it all worked, then I changed to using
the Bootkit rescue package to maintain my boot disks.</P>
<P>Experienced Linux users may find little of use in this
document. However users new to Linux system administration who
wish to protect against root disk loss and other mishaps may find
it useful.</P>
<P>A note on versions - this document has been updated to support the
following packages and versions:
<UL>
<LI>Linux 1.2.0</LI>
<LI>LILO 0.15</LI>
</UL>
</P>
<P>Copyright (c) Graham Chapman 1995.</P>
<P>Permission is granted for this material to be freely
used and distributed, provided the source is acknowledged.
No warranty of any kind is provided. You use this material
at your own risk.</P>
<H2><A NAME="ss1.2">1.2 Feedback and Credits</A></H2>
<P>I welcome any feedback, good or bad, on the content of this document.
Please let me know if you find any errors or omissions.</P>
<P>I thank the following people for correcting errors and providing
useful suggestions for improvement:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
Randolph Bentson
Grant R. Bowman
Scott Burkett
Bruce Elliot
HARIGUCHI Youichi
Bjxrn-Helge Mevik
Dwight Spencer
Cameron Spitzer
Johannes Stille
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H2><A NAME="ss1.3">1.3 Change History</A></H2>
<P>v1.02, 25 June 1995
<UL>
<LI>Add: FAQ question on oversize ramdisk filesystems.</LI>
<LI>Add: if using mkfs, use the -i option.</LI>
<LI>Add: can use cp as well as dd to copy to raw disk.</LI>
<LI>Chg: correct explanation of /dev/fd0 vs /dev/fd0H1440.</LI>
<LI>Chg: use "zImage" terminology to conform to standard usage.</LI>
<LI>Add: mke2fs -m 0 will provide more usable disk space.</LI>
<LI>Add: re-run LILO if the kernel has changed.</LI>
<LI>Add: move rescue packages to new section under "References".</LI>
<LI>Add: new rescue packages Bootkit and CatRescue. </LI>
<LI>Add: FAQ question on <CODE>cannot execute</CODE> errors.</LI>
<LI>Add: shell scripts are samples only - I now use Bootkit.</LI>
<LI>Chg: stop using &lt; and &gt; in command examples - too confusing.</LI>
<LI>Chg: sample directory listings are now of diskettes, not model.</LI>
<LI>Chg: use more consistent terminology with ramdisks.</LI>
</UL>
v1.01, 6 February 1995
<UL>
<LI>Fix: DO NOT cp kernel_filename /dev/fd0 - this
will overwrite any file system on the diskette.</LI>
<LI>Fix: Put LILO boot.b and map files on target disk.</LI>
<LI>Add: -dp flags to cp commands to avoid problems.</LI>
<LI>Chg: restructure to try to improve readability.</LI>
<LI>Add: can now use ext2 filesystem on root diskettes.</LI>
<LI>Chg: can now separate boot and root diskettes.</LI>
<LI>Add: credits section in Introduction.</LI>
<LI>Add: FAQ.</LI>
</UL>
</P>
<P>v1.0, 2 January 1995
<UL>
<LI>Converted to conform to HOWTO documentation standards.</LI>
<LI>Added new section - Change History.</LI>
<LI>Various minor corrections.</LI>
</UL>
</P>
<P>v0.10, 1 November 1994
Original version, labelled "draft".</P>
<HR>
<IMG SRC="prev.gif" ALT="Previous">
<A HREF="Bootdisk-HOWTO-2.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc1"><IMG SRC="toc.gif" ALT="Contents"></A>
</BODY>
</HTML>

View File

@@ -0,0 +1,376 @@
<HTML>
<HEAD>
<TITLE>The Linux Bootdisk HOWTO: Disks</TITLE>
</HEAD>
<BODY>
<A HREF="Bootdisk-HOWTO-1.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-3.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc2"><IMG SRC="toc.gif" ALT="Contents"></A>
<HR>
<H2><A NAME="s2">2. Disks</A></H2>
<H2><A NAME="ss2.1">2.1 Summary of Disk Types</A></H2>
<P>I classify boot-related disks into 4 types. The discussion here
and throughout this document uses the term "disk" to refer to
diskettes unless otherwise specified. Most of the discussion could
be equally well applied to hard disks. </P>
<P>A summary of disk types and uses is:
<DL>
<DT><B>boot</B><DD><P>A disk containing a kernel which can be booted. The disk
can contain a filesystem and use a boot loader to boot, or it can
simply contain the kernel only at the start of the disk.
The disk can be used to boot the kernel using a root
file system on another disk. This could be useful if you lost your
boot loader due to, for example, an incorrect installation attempt.</P>
<DT><B>root</B><DD><P>A disk with a file system containing everything
required to run a Linux system. It does not necessarily contain
either a kernel or a boot loader.</P>
<P>This disk can be used to run the system independently of any other
disks, once the kernel has been booted. A special kernel feature
allows a separate root disk to be mounted after booting, with the
root disk being automatically copied to a ramdisk.</P>
<P>You could use this type of disk to check another disk for corruption
without mounting it, or to restore another disk after a disk failure or
loss of files.</P>
<DT><B>boot/root</B><DD><P>A disk which is the same as a root disk, but
contains a kernel and a boot loader. It can be used to boot from,
and to run the system. The advantage of this type of disk is
that is it compact - everything required is on a single disk.
However the gradually increasing size of everything means that
it won't necessarily always be possbile to fit everything on a single
diskette.</P>
<DT><B>utility</B><DD><P>A disk which contains a file system, but is not
intended to be mounted as a root file system. It is an additional
data disk. You would use this type of disk to carry additional
utilities where you have too much to fit on your root disk.</P>
<P>The term "utility" only really applies to diskettes, where you would
use a utility disk to store additional recovery utility software.</P>
</DL>
</P>
<H2><A NAME="ss2.2">2.2 Boot</A></H2>
<H3>Overview</H3>
<P>All PC systems start the boot process by executing code in ROM to load
the sector from sector 0, cylinder 0 of the boot drive and try and
execute it. On most bootable disks, sector 0, cylinder 0 contains either:
<UL>
<LI>code from a boot loader such as LILO, which locates the kernel,
loads it and executes it to start the boot proper.</LI>
<LI>the start of an operating system kernel, such as Linux.</LI>
</UL>
</P>
<P>If a Linux kernel has been written to a diskette as a raw device,
then the first sector will be the first sector of the Linux kernel
itself, and this sector will continue the boot process by loading
the rest of the kernel and running Linux. For a more detailed
description of the boot sector contents, see the documentation
in lilo-01.5 or higher.</P>
<P>An alternative method of storing a kernel on a boot disk is to create
a filesystem, not as a root filesystem, but simply as a means of
installing LILO and thus allowing boot-time command line options
to be specified. For example, the same kernel could then be used
to boot using a hard disk root filesystem, or a diskette root
filesystem. This could be useful if you were trying to rebuild
the hard disk filesystem, and wanted to repeatedly test results.</P>
<H3>Setting Pointer to Root</H3>
<P>The kernel must somehow obtain a pointer to the drive and partititon to
be mounted as the root drive. This can be provided
in several ways:
<UL>
<LI>By setting <CODE>ROOT_DEV = devicename</CODE> in the Linux kernel makefile
and rebuilding the kernel (for advice on how to rebuild the kernel,
read the Linux FAQ and look in <CODE>/usr/src/linux</CODE>). Comments in the
Linux makefile describe the valid values for <CODE>devicename</CODE>.</LI>
<LI>By running the rdev utility:
<BLOCKQUOTE><CODE>
<PRE>
rdev filename devicename
</PRE>
</CODE></BLOCKQUOTE>
This will set the root device of the kernel contained in <CODE>filename</CODE>
to be <CODE>devicename</CODE>. For example:
<BLOCKQUOTE><CODE>
<PRE>
rdev zImage /dev/sda1
</PRE>
</CODE></BLOCKQUOTE>
This sets the root device in the kernel in zImage to the first partition on
the first SCSI drive.</LI>
</UL>
</P>
<P>There are some alternative ways of issuing the rdev command. Try:
<BLOCKQUOTE><CODE>
<PRE>
rdev -h
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>and it will display command usage.</P>
<P>There is usually no need to configure the root device for
boot diskette use, because the kernel currently used to boot from
probably already points to the root drive device. The need can
arise, howoever, if you obtain a kernel from another machine,
for example, from a distribution, or if you want to use the kernel
to boot a root diskette. It is probably a good idea to check the
current root drive setting, just in case it is wrong. To get
rdev to check the current root device in a kernel file, enter
the command:
<BLOCKQUOTE><CODE>
<PRE>
rdev &lt;filename&gt;
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>It is possible to change the root device set in a kernel by means other
than using rdev. For details, see the FAQ at the end of this document.</P>
<H3>Copying Kernel to Boot Diskette</H3>
<P>Once the kernel has been configured then it must be copied to the
boot diskette. </P>
<P>The commands described below (and throughout the HOWTO) assume that
the diskettes have been formatted. If not, then use fdformat to format
the diskettes before continuing.</P>
<P>If the disk is not intended to contain a file system, then the kernel
can be copied using the dd command, as follows:
<BLOCKQUOTE><CODE>
<PRE>
dd if=infilename of=devicename
where infilename is the name of the kernel
and devicename is the diskette raw device,
usually /dev/fd0
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>The cp command can also be used:
<BLOCKQUOTE><CODE>
<PRE>
cp filename devicename
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>For example:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
dd if=zImage of=/dev/fd0
or
cp zImage /dev/fd0
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>The seek parameter to the dd command should NOT be used. The file
must be copied to start at the boot sector (sector 0, cylinder 0),
and omitting the seek parameter will do this.</P>
<P>The output device name to be used is usually <CODE>/dev/fd0</CODE> for
the primary diskette drive (i.e. drive "A:" in DOS), and <CODE>/dev/fd1</CODE>
for the secondary. These device names will cause the kernel to
autodetect the attributes of the drives. Drive attributes can
be specified to the kernel by using other device names: for
example <CODE>/dev/fd0H1440</CODE> specifies a high density 1.44 Mb
drive. It is rare to need to use these specific device names.</P>
<P>Where the kernel is to be copied to a boot disk containing a filesystem,
then the disk is mounted at a suitable point in a currently-mounted
filesystem, then the cp command is used. For example:
<BLOCKQUOTE><CODE>
<PRE>
mount -t ext2 /dev/fd0 /mnt
cp zImage /mnt
umount /mnt
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Note that for almost all operations in this HOWTO, the user should be
operating as the superuser.</P>
<H2><A NAME="ss2.3">2.3 Root</A></H2>
<H3>Overview</H3>
<P>A root disk contains a complete working Linux system, but without
necessarily including a kernel. In other words, the disk may not
be bootable, but once the kernel is running, the root disk contains
everything needed to support a full Linux system. To be able to
do this, the disk must include the minimum requirements for a
Linux system:
<UL>
<LI>File system.</LI>
<LI>Minimum set of directories - dev, proc, bin, etc, lib, usr, tmp.</LI>
<LI>Basic set of utilities - bash (to run a shell), ls, cp etc.</LI>
<LI>Minimum set of config files - rc, inittab, fstab etc.</LI>
<LI>Runtime library to provide basic functions used by utilities.</LI>
</UL>
</P>
<P>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:
<UL>
<LI>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 fsck on your
original root drive while it is not mounted.</LI>
<LI>Restore all or part of your original root drive from backup
using archive/compression utilities including cpio, tar,
gzip and ftape.</LI>
</UL>
</P>
<H2><A NAME="ss2.4">2.4 Boot/Root </A></H2>
<P>This is essentially the same as the root disk, with the
addition of a kernel and a boot loader such as LILO.</P>
<P>With this configuration, a kernel file is copied to the root file
system, and LILO is then run to install a configuration which
points to the kernel file on the target disk. At boot time, LILO
will boot the kernel from the target disk.</P>
<P>Several files must be copied to the diskette for this method to
work. Details of these files and the required LILO configuration,
including a working sample, are given below in the section
titled "LILO".</P>
<H3>RAM Disks and Root Filesystems on Diskette</H3>
<P>For a diskette root filesystem to be efficient, you need to be able to run
it from a ramdisk, i.e. an emulated disk drive in main memory.
This avoids having the system run at a snail's pace, which a
diskette would impose. The Ftape HOWTO states that a ramdisk will
be required when using Ftape because Ftape requires exclusive use of
the diskette controller.</P>
<P>There is an added benefit from using a ramdisk - the Linux kernel
includes an automatic ramdisk root feature, whereby it will, under
certain circumstances, automatically copy the contents of a
root diskette to a ramdisk, and then switch the root drive
to be the ramdisk instead of the diskette. This has two major
benefits:
<UL>
<LI>The system runs a lot faster.</LI>
<LI>The diskette drive is freed up to allow other diskettes
to be used on a single-diskette drive system.</LI>
</UL>
</P>
<P>The requirements for this feature to be invoked are:
<UL>
<LI>The file system on the diskette drive must be either a minix
or an ext2 file system. The ext2 file system is generally the preferred
file system to use. Note that if you have a Linux kernel earlier
than 1.1.73, then you should see the comments in the section
titled "File Systems" to see whether your kernel will
support ext2. If your kernel is old then you may have to use
minix. This will not cause any significant problems.</LI>
<LI>A ramdisk must be configured into the kernel, and it must
be at least as big as the diskette drive.</LI>
</UL>
</P>
<P>A ramdisk can be configured into the kernel in several ways:
<UL>
<LI>By uncommenting the RAMDISK macro in the Linux kernel
makefile, so that it reads:
<BLOCKQUOTE><CODE>
<PRE>
RAMDISK = -DRAMDISK=1440
</PRE>
</CODE></BLOCKQUOTE>
to define a ramdisk of 1440 1K blocks, the size of a
high-density diskette.</LI>
<LI>By running the rdev utility, available on most Linux
systems. This utility displays or sets values for several
things in the kernel, including the desired size for a
ramdisk. To configure a ramdisk of 1440 blocks into a
kernel in a file named zImage, enter:
<BLOCKQUOTE><CODE>
<PRE>
rdev -r zImage 1440
</PRE>
</CODE></BLOCKQUOTE>
this might change in the future, of course. To see what
your version of rdev does, enter the command:
<BLOCKQUOTE><CODE>
<PRE>
rdev -h
</PRE>
</CODE></BLOCKQUOTE>
and it should display its options.</LI>
<LI>By using the boot loader package LILO to configure it into
your kernel at boot time. This can be done using the
LILO configuration parameter:
<BLOCKQUOTE><CODE>
<PRE>
ramdisk = 1440
</PRE>
</CODE></BLOCKQUOTE>
to request a ramdisk of 1440 1K blocks at boot time.</LI>
<LI>By interrupting a LILO automatic boot and adding ramdisk=1440
to the command line. For example, such a command line might be:
<BLOCKQUOTE><CODE>
<PRE>
zImage ramdisk=1440
</PRE>
</CODE></BLOCKQUOTE>
See the section on LILO for more details.</LI>
<LI>By editing the kernel file and altering the values near the
start of the file which record the ramdisk size. This is definitely a
last resort, but can be done. See the FAQ near the end of this
document for more details.</LI>
</UL>
</P>
<P>The easiest of these methods is LILO configuration, because you
need to set up a LILO configuration file anyway, so why not add the
ramdisk size here?</P>
<P>LILO configuration is briefly described in a section titled "LILO"
below, but it is advisable to obtain the latest stable version of
LILO from your nearest Linux mirror site, and read the documentation
that comes with it.</P>
<P>Ramdisks can be made larger than the size of a diskette, and made to
contain a filesystem as large as the ramdisk. This can be
useful to load all the software required for rescue work onto a single
high-performance ramdisk. The method of doing this is described in
the FAQ section under the question "How can I create an oversize
ramdisk filesystem?"</P>
<H2><A NAME="ss2.5">2.5 Utility</A></H2>
<P>Often one disk is not sufficient to hold all the software you need
to be able to perform rescue functions of analysing, repairing and
restoring corrupted disk drives. By the time you include tar, gzip
e2fsck, fdisk, Ftape and so on, there is enough for a whole new
diskette, maybe even more if you want lots of tools.</P>
<P>This means that a rescue set often requires a utility diskette,
with a file system containing any extra files required. This file
system can then be mounted at a convenient point, such as /usr, on
the boot/root system.</P>
<P>Creating a file system is fairly easy, and is described in
the section titled "File Systems". </P>
<HR>
<A HREF="Bootdisk-HOWTO-1.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-3.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc2"><IMG SRC="toc.gif" ALT="Contents"></A>
</BODY>
</HTML>

View File

@@ -0,0 +1,515 @@
<HTML>
<HEAD>
<TITLE>The Linux Bootdisk HOWTO: Components</TITLE>
</HEAD>
<BODY>
<A HREF="Bootdisk-HOWTO-2.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-4.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc3"><IMG SRC="toc.gif" ALT="Contents"></A>
<HR>
<H2><A NAME="s3">3. Components</A></H2>
<H2><A NAME="ss3.1">3.1 File Systems</A></H2>
<P>The Linux kernel now supports two file system types for root
disks to be automatically copied to ramdisk. These are minix
and ext2, of which ext2 is the preferred file system.
The ext2 support was added sometime between 1.1.17 and 1.1.57,
I'm not sure exactly which. If you have a kernel within this range
then edit /usr/src/linux/drivers/block/ramdisk.c and look for the
word "ext2". If it is not found, then you will have to use a minix
file system, and therefore the "mkfs" command to create it. (If using mkfs,
use the -i option to specify more inodes than the default; -i 2000 is
suggested).</P>
<P>To create an ext2 file system on a diskette on my system, I issue the
following command:
<BLOCKQUOTE><CODE>
<PRE>
mke2fs -m 0 /dev/fd0
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>The mke2fs command will automatically detect the space available and
configure itself accordingly. If desired, the diskette size in 1Kb blocks
can be specified to speed up mke2fs operation. The -m 0 parameter prevents
it from reserving space for root, and hence provides more usable space
on the disk. </P>
<P>An easy way to test the result is to create a system using the above
command or similar, and then attempt to mount the diskette. If it is
an ext2 system, then the command:
<BLOCKQUOTE><CODE>
<PRE>
mount -t ext2 /dev/fd0 /&lt;mount point&gt;
</PRE>
</CODE></BLOCKQUOTE>
should work.</P>
<H2><A NAME="ss3.2">3.2 Kernel</A></H2>
<H3>Building a Custom Kernel</H3>
<P>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.</P>
<P>One reason is size. The kernel is one of the
largest files in a minimum system, so if you want to build a
boot/root diskette, then you will have to reduce the size of the kernel
as much as possible. The kernel now supports changing
the diskette after booting and before mounting root, so it is not
necessary any more to squeeze the kernel into the same disk as
everything else, therefore these comments apply only if you choose
to build a boot/root diskette.</P>
<P>There are two ways of reducing kernel size:
<UL>
<LI>Building 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.</LI>
<LI>Compressing it, using the standard compressed-kernel
option included in the makefile:
<BLOCKQUOTE><CODE>
<PRE>
make zImage
</PRE>
</CODE></BLOCKQUOTE>
Refer to the documentation included with the kernel source
for up-to-date information on building compressed kernels.
Note that the kernel source is usually in /usr/src/linux.</LI>
</UL>
</P>
<P>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.</P>
<P>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 Ftape, and then try and read your backups.</P>
<P>It is probably desirable to maintain a copy of the same version
of backup utilities used to write the backups, so that you don't
waste time trying to install versions that cannot read your
backup tapes.</P>
<P>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.</P>
<P>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 /usr/src/linux. Note that if you
have trouble building a kernel, then you should probably not
attempt to build boot/root systems anyway.</P>
<H2><A NAME="ss3.3">3.3 Devices</A></H2>
<P>A /dev 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
the mkdir command in the normal way. The device special files,
however, must be created in a special way, using the mknod command.</P>
<P>There is a shortcut, though - copy your existing /dev directory
contents, and delete the ones you don't want. The only requirement
is that you copy the device special files using the -R option. This
will copy the directory without attempting to copy the contents of the
files. Note that if you use lower caser, as in "-r", there will be
a vast difference, because you will probably end up copying the
entire contents of all of your hard disks - or at least as much
of them as will fit on a diskette! Therefore, take care, and use
the command:
<BLOCKQUOTE><CODE>
<PRE>
cp -dpR /dev /mnt
</PRE>
</CODE></BLOCKQUOTE>
assuming that the diskette is mounted at /mnt. The dp switches
ensure that symbolic links are copied as links (rather than
the target file being copied) and that the original file attributes
are preserved, thus preserving ownership information.</P>
<P>If you want to do it the hard way, use ls -l to display the major
and minor device numbers for the devices you want, and create
them on the diskette using mknod.</P>
<P>Many distributions include a shell script called MAKEDEV in the
/dev directory. This shell script could be used to create the devices,
but it is probably easier to just copy your existing ones, especially
for rescue disk purposes.</P>
<P>Whichever way the device directory is copied, it is worth checking
that any special devices you need have been placed on the
rescue diskette. For example, Ftape uses tape devices, so you will
need to copy all of these.</P>
<H2><A NAME="ss3.4">3.4 Directories </A></H2>
<P>It might be possible to get away with just /dev, /proc and /etc to run
a Linux system. I don't know - I've never tested it. However a
reasonable minimum set of directories consists of the following:
<DL>
<DT><B>/dev</B><DD><P>Required to perform I/O with devices</P>
<DT><B>/proc</B><DD><P>Required by the ps command</P>
<DT><B>/etc</B><DD><P>System configuration files</P>
<DT><B>/bin</B><DD><P>Utility executables considered part of the system</P>
<DT><B>/lib</B><DD><P>Shared libraries to provide run-time support</P>
<DT><B>/mnt</B><DD><P>A mount point for maintenance on other disks</P>
<DT><B>/usr</B><DD><P>Additional utilities and applications</P>
</DL>
</P>
<P>Note that the directory tree presented here is for root diskette use only.
Refer to the Linux File System Standard for much better information
on how file systems should be structured in "standard" Linux
systems.</P>
<P>Four of these directories can be created very easily:
<UL>
<LI>/dev is described above in the section titled DEVICES.</LI>
<LI>/proc only needs to exist. Once the directory is created using
mkdir, nothing more is required.</LI>
<LI>Of the others, /mnt and /usr are included in this list only as
mount points for use after the boot/root system is running.
Hence again, these directories only need to be created.</LI>
</UL>
</P>
<P>The remaining 3 directories are described in the following sections.</P>
<H3>/etc</H3>
<P>This directory must contain a number of configuration files. On most
systems, these can be divided into 3 groups:
<UL>
<LI>Required at all times, e.g. rc, fstab, passwd.</LI>
<LI>May be required, but no-one is too sure.</LI>
<LI>Junk that crept in. </LI>
</UL>
</P>
<P>Files which are not essential can be identified with the command:
<BLOCKQUOTE><CODE>
<PRE>
ls -ltru
</PRE>
</CODE></BLOCKQUOTE>
This lists files in reverse order of date last accessed, so if any
files are not being accessed, then they can be omitted from a root
diskette.</P>
<P>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:
<UL>
<LI>The ones I must configure for a boot/root system:
<BLOCKQUOTE><CODE>
<PRE>
rc system startup script
fstab list of file systems to be mounted
inittab parameters for the init process - the
first process started at boot time.
</PRE>
</CODE></BLOCKQUOTE>
</LI>
<LI>the ones I should tidy up for a boot/root system:
<BLOCKQUOTE><CODE>
<PRE>
passwd list of logins
shadow contains passwords
</PRE>
</CODE></BLOCKQUOTE>
These should be pruned on secure systems to avoid copying
user's passwords off the system, and so that when you boot
from diskette, unwanted logins are rejected.</LI>
<LI>The rest. They work at the moment, so I leave them alone.</LI>
</UL>
</P>
<P>Out of this, I only really have to configure two files, and what they
should contain is suprisingly small.
<UL>
<LI>rc should contain:
<BLOCKQUOTE><CODE>
<PRE>
#!/bin/sh
/etc/mount -av
/bin/hostname boot_root
</PRE>
</CODE></BLOCKQUOTE>
and I don't really need to run hostname - it just looks nicer
if I do. Even mount is actually only needed to mount /proc to
support the ps command - Linux will run without it.</LI>
<LI>fstab should contain:
<BLOCKQUOTE><CODE>
<PRE>
/dev/fd0 / ext2 defaults
/proc /proc proc defaults
</PRE>
</CODE></BLOCKQUOTE>
I don't think that the first entry is really needed, but I
find that if I leave it out, mount won't mount /proc.</LI>
</UL>
</P>
<P>Inittab should be ok as is, unless you want to ensure that users on
serial ports cannot login. To prevent this, comment out all the entries
for /etc/getty which include a ttys or ttyS device at the end of the line.
Leave in the tty ports so that you can login at the console.</P>
<P>Inittab defines what the system will run or rerun in various states
including startup, move to multi-user mode, powerfail, and others.
A point to be careful of here is to carefully check that the commands
entered in inittab refer to programs which are present and to the
correct directory. If you place your command files on your rescue disk
using the sample directory listing in this HOWTO as a guide, and then
copy your inittab to your rescue disk without checking it, then the
probability of failure will be quite high, because half of the
inittab entries will refer to missing programs or to the wrong
directory.</P>
<P>It is worth noting here as well that some programs cannot be moved
from one directory to another or they will fail at runtime because
they have hardcoded the name of another program which they attempt
to run. For example on my system, <CODE>/etc/shutdown</CODE> has hardcoded in
it <CODE>/etc/reboot</CODE>. If I move reboot to /bin/reboot, and then
issue a shutdown command, it will fail because it can't find the
reboot file.</P>
<P>For the rest, just copy all the text files in your /etc directory, plus
all the executables in your /etc directory that you cannot be sure you
do not need. As a guide, consult the sample ls listing in
"Sample Boot/Root ls-lR Directory Listing" -
this is what I have, so probably it will be sufficient for you if
you copy only those files.</P>
<P>In practice, a single rc file is restrictive; most systems now use
an /etc/rc.d directory containing shell scripts for different run levels.
The absolute minimum is a single rc script, but it will probably be
a lot simpler in practice to copy the inittab and /etc/rc.d directory
from your existing system, and prune the shell scripts in the rc.d
directory to remove processing not relevent to a diskette system
environment.</P>
<H3>/bin</H3>
<P>Here is a convenient point to place the extra utilities you need to
perform basic operations, utilities such as ls, mv, cat, dd etc.</P>
<P>See the section titled "Sample Boot/Root ls-lR Directory Listing"
for the list of files that I place in my boot/root /bin
directory. You may notice that it does not include any of the utilities
required to restore from backup, such as
cpio, tar, gzip etc. That is because I place these on a separate
utility diskette, to save space on the boot/root diskette. Once I
have booted my boot/root diskette, it then copies itself to the ramdisk
leaving the diskette drive free to mount another diskette, the utility
diskette. I usually mount this as /usr.</P>
<P>Creation of a utility diskette is described below in the section
titled "Adding Utility Diskettes".</P>
<H3>/lib</H3>
<P>Two libraries are required to run many facilities under Linux:
<UL>
<LI>ld.so</LI>
<LI>libc.so.4</LI>
</UL>
</P>
<P>If they are not found in your /lib directory then the system will
be unable to boot. If you're lucky you may see an error message
telling you why.</P>
<P>These should be present in you existing /lib directory. Note that
libc.so.4 may be a symlink to a libc library with version number
in the filename. If you issue the command:
<BLOCKQUOTE><CODE>
<PRE>
ls -l /lib
</PRE>
</CODE></BLOCKQUOTE>
you will see something like:
<BLOCKQUOTE><CODE>
<PRE>
libc.so.4 -&gt; libc.so.4.5.21
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>In this case, the libc library you want is libc.so.4.5.21.</P>
<H2><A NAME="ss3.5">3.5 LILO</A></H2>
<H3>Overview</H3>
<P>For the boot/root to be any use, it must be bootable. To achieve this,
the easiest way is to install a boot loader,
which is a piece of executable code stored at sector 0, cylinder 0 of
the diskette. See the section above titled "BOOT DISKETTE" for an
overview of the boot process.</P>
<P>LILO is a tried and trusted boot loader available from any Linux
mirror site. It allows you to configure the boot loader, including:
<UL>
<LI>Which device is to be mounted as the root drive.</LI>
<LI>Whether to use a ramdisk.</LI>
</UL>
</P>
<H3>Sample LILO Configuration</H3>
<P>This provides a very convenient place to specify to the kernel how
it should boot. My root/boot LILO configuration file, used with
LILO 0.15, is:
<BLOCKQUOTE><CODE>
<HR>
<PRE>
boot = /dev/fd0
install = ./mnt/boot.b
map = ./mnt/lilo.map
delay = 50
message = ./mnt/lilo.msg
timeout = 150
compact
image = ./mnt/zImage
ramdisk = 1440
root = /dev/fd0
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>Note that boot.b, lilo.msg and the kernel must first have been copied to
the diskette using a command similar to:
<BLOCKQUOTE><CODE>
<HR>
<PRE>
cp /boot/boot.b ./mnt
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>If this is not done, then LILO will not run correctly at boot time if
the hard disk is not available, and there is little point setting up
a rescue disk which requires a hard disk in order to boot.</P>
<P>I run lilo using the command:
<BLOCKQUOTE><CODE>
<PRE>
/sbin/lilo -C &lt;configfile&gt;
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>I run it from the directory containing the mnt directory where I have
mounted the diskette. This means that I am telling LILO to install a
boot loader on the boot device (/dev/fd0 in this case), to boot a
kernel in the root directory of the diskette.</P>
<P>I have also specified that I want the root device to be the diskette,
and I want a ramdisk created of 1440 1K blocks, the same size as the
diskette. Since I have created an ext2 file system on the diskette,
this completes all the conditions required for Linux to automatically
switch the root device to the ramdisk, and copy the diskette contents
there as well.</P>
<P>The ramdisk features of Linux are described further in the section
above titled "RAM DISKS AND BOOT/ROOT SYSTEMS".</P>
<P>It is also worth considering using the "single" parameter to cause
Linux to boot in single-user mode. This could be useful to prevent
users logging in on serial ports.</P>
<P>I also use the "DELAY" "MESSAGE" and "TIMEOUT" statements so
that when I boot the disk, LILO will give me the opportunity to
enter command line options if I wish. I don't need them at present,
but I never know when I might want to set a different root device
or mount a filesystem read-only.</P>
<P>The message file I use contains the message:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
Linux Boot/Root Diskette
========================
Enter a command line of the form:
zImage [ command-line options]
If nothing is entered, linux will be loaded with
defaults after 15 seconds.
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>This is simply a reminder to myself what my choices are.</P>
<P>Readers are urged to read the LILO documentation carefully before
atttempting to install anything. It is relatively easy to destroy
partitions if you use the wrong "boot = " parameter. If you are
inexperienced, do NOT run LILO until you are sure you understand it
and you have triple-checked your parameters.</P>
<P>Note that you must re-run LILO every time you change the kernel, so
that LILO can set up its map file to correctly describe the new
kernel file. It is in fact possible to replace the kernel file with
one which is almost identical without rerunning LILO, but it is far
better not to gamble - if you change the kernel, re-run LILO.</P>
<H3>Removing LILO</H3>
<P>One other thing I might as well add here while I'm on the LILO topic:
if you mess up lilo on a drive containing DOS, you can always replace
the boot sector with the DOS boot loader by issuing the DOS command:
<BLOCKQUOTE><CODE>
<PRE>
FDISK /MBR
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>where MBR stands for "Master Boot Record". Note that some purists
disagree with this, and they may have grounds, but it works.</P>
<H3>Useful LILO Options</H3>
<P>LILO has several useful options which are worth keeping in mind when
building boot disks:
<UL>
<LI>Command line options - you can enter command line options
to set the root device, ramdisk size, special device parameters, or
other things. If you include the DELAY = nn statement in your LILO
configuration file, then LILO will pause to allow you to select
a kernel image to boot, and to enter, on the same line, any options.
For example:
<BLOCKQUOTE><CODE>
<PRE>
zImage aha152x=0x340,11,3,1 ro
</PRE>
</CODE></BLOCKQUOTE>
will pass the aha152x parameters through to the aha152x scsi disk
driver (provided that driver has been included when the kernel was
built) and will ask for the root filesystem to be mounted read-only.</LI>
<LI>Command line "lock" option - this option asks LILO to store
the command line entered as the default command line to be used for
all future boots. This is particularly useful where you have a device
which cannot be autoselected. By using "lock" you can avoid having
to type in the device parameter string every time you boot.
For example:
<BLOCKQUOTE><CODE>
<PRE>
zImage aha152x=0x340,11,3,1 root=/dev/sda8 ro lock
</PRE>
</CODE></BLOCKQUOTE>
</LI>
<LI>APPEND configuration statement - this allows device parameter
strings to be stored in the configuration, as an alternative to
using the "lock" command line option. Note that any keywords of
the form word=value MUST be enclosed in quotes. For example:
<BLOCKQUOTE><CODE>
<PRE>
APPEND = &quot;aha152x=0x340,11,3,1&quot;
</PRE>
</CODE></BLOCKQUOTE>
</LI>
<LI>DELAY configuration statement - this pauses for DELAY tenths
of seconds and allows the user to interrupt the automatic boot of
the default command line, so that the user can enter an alternate
command line.</LI>
</UL>
</P>
<HR>
<A HREF="Bootdisk-HOWTO-2.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-4.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc3"><IMG SRC="toc.gif" ALT="Contents"></A>
</BODY>
</HTML>

View File

@@ -0,0 +1,573 @@
<HTML>
<HEAD>
<TITLE>The Linux Bootdisk HOWTO: Samples</TITLE>
</HEAD>
<BODY>
<A HREF="Bootdisk-HOWTO-3.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-5.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc4"><IMG SRC="toc.gif" ALT="Contents"></A>
<HR>
<H2><A NAME="s4">4. Samples</A></H2>
<H2><A NAME="ss4.1">4.1 Disk Directory Listings</A></H2>
<P>This lists the contents of directories from my root and utility
diskettes. These lists are provided as an example only of the files
included to create a working system. The disks were created using
the Bootkit package, which copies to diskette only those files
that you want copied.</P>
<H3>Root Disk ls-lR Directory Listing</H3>
<P>The root listing is of a diskette mounted at /mnt.</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
total 27
drwx------ 2 root root 1024 Jun 11 23:23 bin/
drwxr-xr-x 2 root root 3072 Jun 11 23:24 dev/
drwxr-xr-x 3 root root 1024 May 30 06:38 etc/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 home/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 lib/
drwxr-xr-x 2 root root 12288 Jun 11 23:23 lost+found/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 mnt/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 proc/
drwxr-xr-x 2 root root 1024 May 30 05:56 root/
drwxr-xr-x 2 root root 1024 Jun 3 23:39 sbin/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 tmp/
drwxr-xr-x 3 root root 1024 May 30 05:48 usr/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 util/
drwxr-xr-x 5 root root 1024 May 30 05:58 var/
/mnt/bin:
total 664
-rwxr-xr-x 1 root root 222208 Sep 7 1992 bash*
-rwxr-xr-x 1 root other 4376 Sep 8 1992 cat*
-rwxr-xr-x 1 root other 5088 Sep 4 1992 chmod*
-rwxr-xr-x 1 root other 4024 Sep 4 1992 chown*
-rwxr-xr-x 1 root other 12104 Sep 4 1992 cp*
-rwxr-xr-x 1 root other 4376 Sep 5 1992 cut*
-rwxr-xr-x 1 root other 7592 Sep 4 1992 dd*
-rwxr-xr-x 1 root other 4656 Sep 4 1992 df*
-rwxr-xr-x 1 root root 37892 May 5 1994 e2fsck*
-rwx--x--x 1 root root 14396 Sep 20 1992 fdisk*
-r-x--x--x 1 bin bin 3536 Feb 19 19:14 hostname*
-rwxr-xr-x 1 root other 5292 Sep 4 1992 ln*
-rws--x--x 1 root root 24352 Jan 16 1993 login*
-rwxr-xr-x 1 root other 4104 Sep 4 1992 mkdir*
-rwxr-xr-x 1 root root 21508 May 5 1994 mke2fs*
-rwxr-xr-x 1 root other 3336 Sep 4 1992 mknod*
-rwx--x--x 1 root root 2432 Sep 20 1992 mkswap*
-rwxr-xr-x 1 root root 9596 Jun 10 22:12 mount*
-rwxr-xr-x 1 root other 6724 Sep 4 1992 mv*
-rwxr-xr-x 1 root root 11132 Apr 10 1993 ps*
-rwxr-xr-x 1 root other 5056 Sep 4 1992 rm*
-rwxr-xr-x 1 root root 222208 Sep 7 1992 sh*
-rws--x--x 1 root root 16464 Jan 16 1993 su*
-rwxr-xr-x 1 root root 1204 Sep 17 1992 sync*
-rwxr-xr-x 1 root root 6188 Apr 17 1993 umount*
/mnt/dev:
total 72
-rwxr-xr-x 1 root root 8331 Mar 14 1993 MAKEDEV*
lrwxrwxrwx 1 root root 4 Jun 11 23:24 console -&gt; tty0
crw-rw-rw- 1 root tty 5, 64 Apr 1 1993 cua0
crw-rw-rw- 1 root tty 5, 65 Mar 19 19:35 cua1
crw-rw-rw- 1 root tty 5, 66 Apr 10 1993 cua2
crw-rw-rw- 1 root tty 5, 67 Apr 10 1993 cua3
brw-r--r-- 1 root root 2, 0 Aug 29 1992 fd0
brw-r--r-- 1 root root 2, 12 Aug 29 1992 fd0D360
brw-r--r-- 1 root root 2, 16 Aug 29 1992 fd0D720
brw-r--r-- 1 root root 2, 28 Aug 29 1992 fd0H1440
brw-r--r-- 1 root root 2, 12 Aug 29 1992 fd0H360
brw-r--r-- 1 root root 2, 16 Aug 29 1992 fd0H720
brw-r--r-- 1 root root 2, 4 Aug 29 1992 fd0d360
brw-r--r-- 1 root root 2, 8 Jan 15 1993 fd0h1200
brw-r--r-- 1 root root 2, 20 Aug 29 1992 fd0h360
brw-r--r-- 1 root root 2, 24 Aug 29 1992 fd0h720
brw-r--r-- 1 root root 2, 1 Aug 29 1992 fd1
brw-r--r-- 1 root root 2, 13 Aug 29 1992 fd1D360
brw-r--r-- 1 root root 2, 17 Aug 29 1992 fd1D720
brw-r--r-- 1 root root 2, 29 Aug 29 1992 fd1H1440
brw-r--r-- 1 root root 2, 13 Aug 29 1992 fd1H360
brw-r--r-- 1 root root 2, 17 Aug 29 1992 fd1H720
brw-r--r-- 1 root root 2, 5 Aug 29 1992 fd1d360
brw-r--r-- 1 root root 2, 9 Aug 29 1992 fd1h1200
brw-r--r-- 1 root root 2, 21 Aug 29 1992 fd1h360
brw-r--r-- 1 root root 2, 25 Aug 29 1992 fd1h720
brw-r----- 1 root root 3, 0 Aug 29 1992 hda
brw-r----- 1 root root 3, 1 Aug 29 1992 hda1
brw-r----- 1 root root 3, 2 Aug 29 1992 hda2
brw-r----- 1 root root 3, 3 Aug 29 1992 hda3
brw-r----- 1 root root 3, 4 Aug 29 1992 hda4
brw-r----- 1 root root 3, 5 Aug 29 1992 hda5
brw-r----- 1 root root 3, 6 Aug 29 1992 hda6
brw-r----- 1 root root 3, 7 Aug 29 1992 hda7
brw-r----- 1 root root 3, 8 Aug 29 1992 hda8
brw-r----- 1 root root 3, 64 Aug 29 1992 hdb
brw-r----- 1 root root 3, 65 Aug 29 1992 hdb1
brw-r----- 1 root root 3, 66 Aug 29 1992 hdb2
brw-r----- 1 root root 3, 67 Aug 29 1992 hdb3
brw-r----- 1 root root 3, 68 Aug 29 1992 hdb4
brw-r----- 1 root root 3, 69 Aug 29 1992 hdb5
brw-r----- 1 root root 3, 70 Aug 29 1992 hdb6
brw-r----- 1 root root 3, 71 Aug 29 1992 hdb7
brw-r----- 1 root root 3, 72 Aug 29 1992 hdb8
crw-r----- 1 root kmem 1, 2 Aug 29 1992 kmem
crw-rw-rw- 1 root root 6, 0 Aug 29 1992 lp0
crw-rw-rw- 1 root root 6, 1 Aug 29 1992 lp1
crw-rw-rw- 1 root root 6, 2 Aug 29 1992 lp2
crw-r----- 1 root sys 1, 1 Aug 29 1992 mem
lrwxrwxrwx 1 root root 4 Jun 11 23:24 mouse -&gt; cua1
crw-rw-rw- 1 root root 27, 4 Jul 31 1994 nrft0
crw-rw-rw- 1 root root 27, 5 Jul 31 1994 nrft1
crw-rw-rw- 1 root root 27, 6 Jul 31 1994 nrft2
crw-rw-rw- 1 root root 27, 7 Jul 31 1994 nrft3
crw------- 1 root root 9, 128 Jan 23 1993 nrmt0
crw-rw-rw- 1 root root 1, 3 Aug 29 1992 null
crw-r----- 1 root root 6, 0 Aug 29 1992 par0
crw-r----- 1 root root 6, 1 Aug 29 1992 par1
crw-r----- 1 root root 6, 2 Aug 29 1992 par2
crw-r----- 1 root root 1, 4 Aug 29 1992 port
crw-rw-rw- 1 root root 4, 128 Jun 10 00:10 ptyp0
crw-rw-rw- 1 root root 4, 129 Apr 10 14:51 ptyp1
crw-rw-rw- 1 root root 4, 130 Aug 21 1994 ptyp2
crw-rw-rw- 1 root root 4, 131 Apr 12 1993 ptyp3
crw-rw-rw- 1 root tty 4, 132 Jan 3 1993 ptyp4
crw-rw-rw- 1 root tty 4, 133 Jan 3 1993 ptyp5
crw-rw-rw- 1 root tty 4, 134 Jan 3 1993 ptyp6
crw-rw-rw- 1 root tty 4, 135 Jan 3 1993 ptyp7
crw-rw-rw- 1 root tty 4, 136 Jan 3 1993 ptyp8
crw-rw-rw- 1 root tty 4, 137 Jan 3 1993 ptyp9
crw-rw-rw- 1 root tty 4, 138 Jan 3 1993 ptypa
crw-rw-rw- 1 root tty 4, 139 Jan 3 1993 ptypb
crw-rw-rw- 1 root tty 4, 140 Jan 3 1993 ptypc
crw-rw-rw- 1 root tty 4, 141 Jan 3 1993 ptypd
crw-rw-rw- 1 root tty 4, 142 Jan 3 1993 ptype
crw-rw-rw- 1 root tty 4, 143 Jan 3 1993 ptypf
brw-rw---- 1 root root 1, 0 Jun 8 18:49 ram
crw-rw-rw- 1 root root 27, 0 Jul 31 1994 rft0
crw-rw-rw- 1 root root 27, 1 Jul 31 1994 rft1
crw-rw-rw- 1 root root 27, 2 Jul 31 1994 rft2
crw-rw-rw- 1 root root 27, 3 Jul 31 1994 rft3
crw------- 1 root root 9, 0 Jan 23 1993 rmt0
brw-r----- 1 root root 8, 0 Aug 29 1992 sda
brw-r----- 1 root root 8, 1 Aug 29 1992 sda1
brw-r----- 1 root root 8, 2 Aug 29 1992 sda2
brw-r----- 1 root root 8, 3 Aug 29 1992 sda3
brw-r----- 1 root root 8, 4 Aug 29 1992 sda4
brw-r----- 1 root root 8, 5 Aug 29 1992 sda5
brw-r----- 1 root root 8, 6 Aug 29 1992 sda6
brw-r----- 1 root root 8, 7 Aug 29 1992 sda7
brw-r----- 1 root root 8, 8 Aug 29 1992 sda8
brw-r----- 1 root root 8, 16 Aug 29 1992 sdb
brw-r----- 1 root root 8, 17 Aug 29 1992 sdb1
brw-r----- 1 root root 8, 18 Aug 29 1992 sdb2
brw-r----- 1 root root 8, 19 Aug 29 1992 sdb3
brw-r----- 1 root root 8, 20 Aug 29 1992 sdb4
brw-r----- 1 root root 8, 21 Aug 29 1992 sdb5
brw-r----- 1 root root 8, 22 Aug 29 1992 sdb6
brw-r----- 1 root root 8, 23 Aug 29 1992 sdb7
brw-r----- 1 root root 8, 24 Aug 29 1992 sdb8
brw------- 1 bin bin 8, 32 Jun 30 1992 sdc
brw------- 1 bin bin 8, 33 Jun 30 1992 sdc1
brw------- 1 bin bin 8, 34 Jun 30 1992 sdc2
brw------- 1 bin bin 8, 35 Jun 30 1992 sdc3
brw------- 1 bin bin 8, 36 Jun 30 1992 sdc4
brw------- 1 bin bin 8, 37 Jun 30 1992 sdc5
brw------- 1 bin bin 8, 38 Jun 30 1992 sdc6
brw------- 1 bin bin 8, 39 Jun 30 1992 sdc7
brw------- 1 bin bin 8, 40 Jun 30 1992 sdc8
brw------- 1 bin bin 8, 48 Jun 30 1992 sdd
brw------- 1 bin bin 8, 49 Jun 30 1992 sdd1
brw------- 1 bin bin 8, 50 Jun 30 1992 sdd2
brw------- 1 bin bin 8, 51 Jun 30 1992 sdd3
brw------- 1 bin bin 8, 52 Jun 30 1992 sdd4
brw------- 1 bin bin 8, 53 Jun 30 1992 sdd5
brw------- 1 bin bin 8, 54 Jun 30 1992 sdd6
brw------- 1 bin bin 8, 55 Jun 30 1992 sdd7
brw------- 1 bin bin 8, 56 Jun 30 1992 sdd8
brw------- 1 bin bin 8, 64 Jun 30 1992 sde
brw------- 1 bin bin 8, 65 Jun 30 1992 sde1
brw------- 1 bin bin 8, 66 Jun 30 1992 sde2
brw------- 1 bin bin 8, 67 Jun 30 1992 sde3
brw------- 1 bin bin 8, 68 Jun 30 1992 sde4
brw------- 1 bin bin 8, 69 Jun 30 1992 sde5
brw------- 1 bin bin 8, 70 Jun 30 1992 sde6
brw------- 1 bin bin 8, 71 Jun 30 1992 sde7
brw------- 1 bin bin 8, 72 Jun 30 1992 sde8
crw-rw-rw- 1 root root 5, 0 Apr 16 1994 tty
crw-rw-rw- 1 grahamc other 4, 0 Jun 11 23:21 tty0
crw--w--w- 1 root root 4, 1 Jun 11 23:23 tty1
crw-rw-rw- 1 root root 4, 2 Jun 11 23:21 tty2
crw-rw-rw- 1 root root 4, 3 Jun 11 23:21 tty3
crw-rw-rw- 1 root other 4, 4 Jun 11 23:21 tty4
crw-rw-rw- 1 root other 4, 5 Jun 11 23:21 tty5
crw-rw-rw- 1 root root 4, 6 Jun 11 23:21 tty6
crw--w--w- 1 grahamc other 4, 7 Apr 15 1993 tty7
crw--w--w- 1 root root 4, 8 Apr 15 1993 tty8
crw-rw-rw- 1 root root 4, 64 Mar 30 1993 ttyS0
crw-rw-rw- 1 root users 4, 65 Mar 31 1993 ttyS1
crw-rw-rw- 1 root root 4, 66 Jan 23 1980 ttyS2
crw-rw-rw- 1 root root 4, 192 Jun 10 00:10 ttyp0
crw-rw-rw- 1 root root 4, 193 Apr 10 14:51 ttyp1
crw-rw-rw- 1 root root 4, 194 Aug 21 1994 ttyp2
crw-rw-rw- 1 root root 4, 195 Apr 12 1993 ttyp3
crw-rw-rw- 1 root tty 4, 196 Jan 3 1993 ttyp4
crw-rw-rw- 1 root tty 4, 197 Jan 3 1993 ttyp5
crw-rw-rw- 1 root tty 4, 198 Jan 3 1993 ttyp6
crw-rw-rw- 1 root tty 4, 199 Jan 3 1993 ttyp7
crw-rw-rw- 1 root tty 4, 200 Jan 3 1993 ttyp8
crw-rw-rw- 1 root tty 4, 201 Jan 3 1993 ttyp9
crw-rw-rw- 1 root tty 4, 202 Jan 3 1993 ttypa
crw-rw-rw- 1 root tty 4, 203 Jan 3 1993 ttypb
crw-rw-rw- 1 root tty 4, 204 Jan 3 1993 ttypc
crw-rw-rw- 1 root tty 4, 205 Jan 3 1993 ttypd
crw-rw-rw- 1 root tty 4, 206 Jan 3 1993 ttype
crw-rw-rw- 1 root tty 4, 207 Jan 3 1993 ttypf
-rw------- 1 root root 63488 Mar 14 1993 ttys0
crw-rw-rw- 1 root root 4, 67 Oct 14 1992 ttys3
crw-r--r-- 1 root root 1, 5 Aug 29 1992 zero
/mnt/etc:
total 108
-rw-r--r-- 1 root root 94 May 30 06:15 fstab
-rwx------ 1 root root 25604 Mar 17 1993 getty*
-rw------- 1 root root 566 Dec 30 1992 gettydefs
-rw-rw-r-- 1 root shadow 321 Oct 3 1994 group
-rwxr-xr-x 1 bin bin 9220 Mar 17 1993 halt*
-rw-r--r-- 1 root root 26 Feb 19 19:07 host.conf
-rw-r--r-- 1 root root 506 Feb 19 19:07 hosts
-rwxr-xr-x 1 bin bin 17412 Mar 17 1993 init*
-rw-r--r-- 1 root root 1354 Jun 3 23:42 inittab
-rwxr-xr-x 1 root root 1478 Mar 17 18:29 issue*
-rw-rw---- 1 root shadow 5137 Dec 4 1992 login.defs
-rw-r--r-- 1 sysadmin bin 42 Mar 17 18:30 motd
-rw-r--r-- 1 root shadow 525 Jun 11 23:24 passwd
-rwxr-xr-x 1 root root 1476 Aug 17 1994 profile*
-rw-r--r-- 1 root root 715 Feb 19 19:02 protocols
drwxr-xr-x 2 root root 1024 May 30 06:05 rc.d/
-rwxr-xr-x 1 bin bin 9220 Mar 17 1993 reboot*
-r--r--r-- 1 bin bin 57 Nov 28 1992 securetty
-rw-r--r-- 1 root root 3316 Feb 19 19:01 services
-rwxr-xr-x 1 bin bin 13316 Mar 17 1993 shutdown*
-rwxr-xr-x 1 root root 3212 Apr 17 1993 swapoff*
-rwxr-xr-x 1 root root 3212 Apr 17 1993 swapon*
-rw-r--r-- 1 root root 817 Jun 11 23:23 termcap
-rwxr-xr-x 1 root root 6188 Apr 17 1993 umount*
-rw-r--r-- 1 root root 12264 Jun 11 23:22 utmp
-rw-r--r-- 1 root root 56 Jun 11 23:22 wtmp
/mnt/etc/rc.d:
total 4
-rwxr-xr-- 1 root root 450 May 30 06:05 rc.0*
-rwxr-xr-- 1 root root 390 May 30 06:05 rc.K*
-rwxr-xr-- 1 root root 683 May 30 06:06 rc.M*
-rwxr-xr-- 1 root root 498 Jun 11 18:44 rc.S*
/mnt/home:
total 0
/mnt/lib:
total 287
-rwxr-xr-x 1 root root 17412 Jun 11 23:24 ld.so*
lrwxrwxrwx 1 root root 14 Jun 11 23:24 libc.so.4 -&gt; libc.so.4.5.21*
-rwxr-xr-x 1 root root 623620 May 22 1994 libc.so.4.5.21*
/mnt/lost+found:
total 0
/mnt/mnt:
total 0
/mnt/proc:
total 0
/mnt/root:
total 0
/mnt/sbin:
total 15
-rwxr-xr-x 1 root root 16885 Jun 13 1994 update*
/mnt/tmp:
total 0
/mnt/usr:
total 1
drwxr-xr-x 2 root root 1024 May 30 05:49 bin/
/mnt/usr/bin:
total 217
-rwxr-xr-x 1 root root 1560 Sep 17 1992 basename*
-rws--x--x 1 root root 8232 Jan 16 1993 chsh*
-rwxr-xr-x 1 root root 1308 Jan 23 1980 clear*
-rwxr-xr-x 1 root other 91136 Sep 4 1992 elvis*
-rwxr-xr-x 1 root root 13252 Sep 17 1992 ls*
-rwxr-xr-x 1 bin bin 21504 Oct 2 1992 more*
-rwxr-xr-x 1 root other 91136 Sep 4 1992 vi*
/mnt/util:
total 0
/mnt/var:
total 3
drwxr-xr-x 2 root root 1024 May 30 05:58 adm/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 logs/
drwxr-xr-x 2 root root 1024 Jun 11 23:24 run/
/mnt/var/adm:
total 0
-rw-r--r-- 1 root root 0 May 30 05:58 utmp
-rw-r--r-- 1 root root 0 May 30 05:58 wtmp
/mnt/var/logs:
total 0
/mnt/var/run:
total 0
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H3>Utility Disk ls-lR Directory Listing</H3>
<P>The utility listing is of a diskette mounted at /mnt.</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
total 15
drwx------ 2 root root 1024 Jun 18 19:57 bin/
drwxr-xr-x 2 root root 12288 Jun 18 19:57 lost+found/
drwx------ 2 root root 1024 Jun 18 19:57 sbin/
drwxr-xr-x 4 root root 1024 May 5 16:30 usr/
/mnt/bin:
total 13
-rwxr-xr-x 1 root root 3180 Apr 10 1993 free*
-rwxr-xr-x 1 root root 10687 Feb 10 1994 pwd*
-rwx--x--x 1 root root 3672 Nov 17 1992 rdev*
/mnt/lost+found:
total 0
/mnt/sbin:
total 18
-rwxr-xr-x 1 root root 16336 Jun 18 14:31 insmod*
-rwxr-xr-x 1 root root 68 Jun 18 14:31 lsmod*
lrwxrwxrwx 1 root root 6 Jun 18 19:57 rmmod -&gt; insmod*
/mnt/usr:
total 2
drwx------ 2 root root 1024 Jun 18 19:57 bin/
drwxr-xr-x 3 root root 1024 Jun 18 19:57 local/
/mnt/usr/bin:
total 411
-rwxr-xr-x 1 root bin 111616 Sep 9 1992 awk*
-rwxr-xr-x 1 root root 41984 Dec 23 1992 cpio*
-rwxr-xr-x 1 root root 50176 Dec 23 1992 find*
-rwxr-xr-x 1 root root 115712 Sep 17 1992 gawk*
-rwxr-xr-x 1 root bin 37888 Sep 4 1992 grep*
-rwxr-xr-x 1 root root 63874 May 1 1994 gzip*
-rwxr-xr-x 1 root root 2044 Sep 17 1992 kill*
-rwx--x--x 1 root root 3132 Jan 24 1993 mt*
-rwxr-xr-x 1 root root 3416 Sep 22 1992 strings*
-rwxr-xr-x 1 root other 3848 Sep 4 1992 who*
/mnt/usr/local:
total 1
drwx------ 2 root root 1024 Jun 18 19:57 bin/
/mnt/usr/local/bin:
total 374
-rwxr-xr-x 1 root root 155542 Jun 18 17:07 ftape.o*
-rwxr-xr-x 1 root root 226308 Jun 13 1994 tar*
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H2><A NAME="ss4.2">4.2 Shell Scripts to Build Diskettes</A></H2>
<P>These shell scripts are provided as examples only. I no longer use
them because I now use and recommend Scott Burkett's <CODE>Bootkit</CODE>
package to manage rescue diskette contents and creation. Bootkit is based
on these scripts, and does essentially the same thing, but it is much
tidier, nicer and easier to use. However, the sample shell scripts here
will still provide working diskettes.</P>
<P>There are two shell scripts:
<UL>
<LI>mkroot - builds a root or boot/root diskette.</LI>
<LI>mkutil - builds a utility diskette.</LI>
</UL>
</P>
<P>Both are currently configured to run in the parent directory of
boot_disk and util_disk, each of which contains everything to be
copied to it's diskette. Note that these shell scripts will *NOT*
automatically set up and copy all the files for you - you work
out which files are needed, set up the directories and copy the
files to those directories. The shell scripts are samples which
will copy the contents of those directories. Note that they are
primitive shell scripts and are not meant for the novice user.</P>
<P>The scripts both contain configuration variables at the
start which allow them to be easily configured to run anywhere.
First, set up the model directories and copy all the required
files into them. To see what directories and files are needed,
have a look at the sample directory listings in the previous
sections.</P>
<P>Check the configuration variables in the
shell scripts and change them as required before running the
scripts.</P>
<H3>mkroot - Make Root or Boot/Root Diskette</H3>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
# mkroot: make a boot/boot disk - creates a boot/root diskette
# by building a file system on it, then mounting it and
# copying required files from a model.
# Note: the model to copy from from must dirst be set up,
# then change the configuration variables below to suit
# your system.
#
# usage: mkroot [nokernel]
# if the parameter is omitted, then the kernel and LILO
# are copied.
# Copyright (c) Graham Chapman 1995. All rights reserved.
# Permission is granted for this material to be freely
# used and distributed, provided the source is acknowledged.
# No warranty of any kind is provided. You use this material
# at your own risk.
# Configuration variables...
BOOTDISKDIR=./boot_disk # name of boot disk directory
MOUNTPOINT=./mnt # temporary mount point for diskette
LILODIR=/sbin # directory containing lilo
LILOBOOT=/boot/boot.b # lilo boot sector
LILOMSG=./lilo.msg # lilo message to display at boot time
LILOCONFIG=./lilo.conf # lilo parms for boot/root diskette
DISKETTEDEV=/dev/fd0 # device name of diskette drive
echo $0: create boot/root diskette
echo Warning: data on diskette will be overwritten!
echo Insert diskette in $DISKETTEDEV and and press any key...
read anything
mke2fs $DISKETTEDEV
if [ $? -ne 0 ]
then
echo mke2fs failed
exit
fi
mount -t ext2 $DISKETTEDEV $MOUNTPOINT
if [ $? -ne 0 ]
then
echo mount failed
exit
fi
# copy the directories containing files
for i in bin etc lib
do
cp -dpr $BOOTDISKDIR/$i $MOUNTPOINT
done
# copy dev *without* trying to copy the files in it
cp -dpR $BOOTDISKDIR/dev $MOUNTPOINT
# create empty directories required
mkdir $MOUNTPOINT/proc
mkdir $MOUNTPOINT/tmp
mkdir $MOUNTPOINT/mnt
mkdir $MOUNTPOINT/usr
# copy the kernel
if [ &quot;$1&quot; != &quot;nokernel&quot; ]
then
echo &quot;Copying kernel&quot;
cp $BOOTDISKDIR/zImage $MOUNTPOINT
echo kernel copied
# setup lilo
cp $LILOBOOT $MOUNTPOINT
cp $LILOMSG $MOUNTPOINT
$LILODIR/lilo -C $LILOCONFIG
echo LILO installed
fi
umount $MOUNTPOINT
echo Root diskette complete
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<H3>mkutil - Make Utility Diskette</H3>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
# mkutil: make a utility diskette - creates a utility diskette
# by building a file system on it, then mounting it and
# copying required files from a model.
# Note: the model to copy from from must first be set up,
# then change the configuration variables below to suit
# your system.
# Copyright (c) Graham Chapman 1995. All rights reserved.
# Permission is granted for this material to be freely
# used and distributed, provided the source is acknowledged.
# No warranty of any kind is provided. You use this material
# at your own risk.
# Configuration variables...
UTILDISKDIR=./util_disk # name of directory containing model
MOUNTPOINT=./mnt # temporary mount point for diskette
DISKETTEDEV=/dev/fd0 # device name of diskette drive
echo $0: create utility diskette
echo Warning: data on diskette will be overwritten!
echo Insert diskette in $DISKETTEDEV and and press any key...
read anything
mke2fs $DISKETTEDEV
if [ $? -ne 0 ]
then
echo mke2fs failed
exit
fi
# Any file system type would do here
mount -t ext2 $DISKETTEDEV $MOUNTPOINT
if [ $? -ne 0 ]
then
echo mount failed
exit
fi
# copy the directories containing files
cp -dpr $UTILDISKDIR/bin $MOUNTPOINT
umount $MOUNTPOINT
echo Utility diskette complete
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<HR>
<A HREF="Bootdisk-HOWTO-3.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-5.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc4"><IMG SRC="toc.gif" ALT="Contents"></A>
</BODY>
</HTML>

View File

@@ -0,0 +1,375 @@
<HTML>
<HEAD>
<TITLE>The Linux Bootdisk HOWTO: FAQ</TITLE>
</HEAD>
<BODY>
<A HREF="Bootdisk-HOWTO-4.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-6.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc5"><IMG SRC="toc.gif" ALT="Contents"></A>
<HR>
<H2><A NAME="s5">5. FAQ</A></H2>
<H2><A NAME="ss5.1">5.1 Q. How can I make a boot disk with a XXX driver?</A></H2>
<P>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.</P>
<P>Go to the a1 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.</P>
<P>You must then check the root device in the kernel, using the rdev
command:
<BLOCKQUOTE><CODE>
<PRE>
rdev zImage
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Rdev will then display the current root device in the kernel. If this
is not the same as the root device you want, then use rdev to change it.
For example, the kernel I tried was set to /dev/sda2, but my root
scsi partition is /dev/sda8. To use a root diskette, you would have
to use the command:
<BLOCKQUOTE><CODE>
<PRE>
rdev zImage /dev/fd0
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>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".</P>
<H2><A NAME="ss5.2">5.2 Q. How do I update my boot floppy with a new kernel?</A></H2>
<P>Just copy the kernel to your boot diskette using the dd command for
a boot diskette without a filesystem, or the cp command for a
boot/root disk. Refer to the section in this HOWTO titled "Boot"
for details on creating a boot disk. The description applies equally
to updating a kernel on a boot disk.</P>
<H2><A NAME="ss5.3">5.3 Q. How do I remove LILO so that I can use DOS to boot again?</A></H2>
<P>This is not really a Bootdisk topic, but it is asked so often, so: the
answer is, use the DOS command:
<BLOCKQUOTE><CODE>
<PRE>
FDISK /MBR
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>MBR stands for Master Boot Record, and it 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.</P>
<P>You can also use the dd command to copy the backup saved by LILO
to the boot sector - refer to the LILO documentation if you wish
to do this.</P>
<H2><A NAME="ss5.4">5.4 Q. How can I boot if I've lost my kernel AND my boot disk?</A></H2>
<P>If you don't have a boot disk standing by, then 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.</P>
<P>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 /dev/sda2, whereas my
root Linux partition happens to be /dev/sda8. In this case the
root device in the kernel will have to be changed.</P>
<P>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.</P>
<P>Rdev 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:
<BLOCKQUOTE><CODE>
<PRE>
0x01F8 Low byte of RAMDISK size
0x01F9 High byte of RAMDISK size
0x01FC Root minor device number - see below
0X01FD Root major device number - see below
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>The ramdisk size is the number of blocks of ramdisk to create.
If you want to boot from a root diskette then set this to decimal
1440, which is 0x05A0, thus set offset 0x01F8 to 0xA0 and
offset 0x01F9 to 0x05. This will allocate enough space for
a 1.4Mb diskette.</P>
<P>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:
<BLOCKQUOTE><CODE>
<PRE>
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
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>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
rawrite.exe. This program is included
in several distributions, including the SLS and Slackware 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, then you must write the file to a physical disk
starting at the beginning of the disk.</P>
<H2><A NAME="ss5.5">5.5 Q. How can I make extra copies of boot/root diskettes?</A></H2>
<P>It is never desirable to have just one set of rescue disks - 2 or 3
should be kept in case one is unreadable.</P>
<P>The easiest way of making copies of any diskettes, including
bootable and utility diskettes, is to use the dd 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 dd uses the raw device interface.</P>
<P>To copy the original, enter the command:
<BLOCKQUOTE><CODE>
<PRE>
dd if=devicename of=filename
where devicename the device name of the diskette
drive
and filename the name of the file where you
want to copy to
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>For example, to copy from /dev/fd0 to a temporary file called
/tmp/diskette.copy, I would enter the command:
<BLOCKQUOTE><CODE>
<PRE>
dd if=/dev/fd0 of=/tmp/diskette.copy
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Omitting the "count" parameter, as we have done here, means that the
whole diskette of 2880 (for a high-density) blocks will be copied.</P>
<P>To copy the resulting file back to a new diskette, insert the new
diskette and enter the reverse command:
<BLOCKQUOTE><CODE>
<PRE>
dd if=filename of=devicename
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Note that the above discussion assumes that you have only one diskette
drive. If you have two of the same type, then you can copy diskettes
using a command like:
<BLOCKQUOTE><CODE>
<PRE>
dd if=/dev/fd0 of=/dev/fd1
</PRE>
</CODE></BLOCKQUOTE>
</P>
<H2><A NAME="ss5.6">5.6 Q. How can I boot without typing in "ahaxxxx=nn,nn,nn" every time?</A></H2>
<P>Where a disk device cannot be autodetected it is necessary to supply
the kernel with a command device parameter string, such as:
<BLOCKQUOTE><CODE>
<PRE>
aha152x=0x340,11,3,1
</PRE>
</CODE></BLOCKQUOTE>
This parameter string can be supplied in several ways using LILO:
<UL>
<LI>By entering it on the command line every time the system
is booted via LILO. This is boring, though.</LI>
<LI>By using the LILO "lock" 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.</LI>
<LI>By using the APPEND statement in the lilo config file. Note that
the parameter string must be enclosed in quotes.</LI>
</UL>
</P>
<P>For example, a sample command line using the above parameter string
would be:
<BLOCKQUOTE><CODE>
<PRE>
zImage aha152x=0x340,11,3,1 root=/dev/sda1 lock
</PRE>
</CODE></BLOCKQUOTE>
This would pass the device parameter string through, and also ask the
kernel to set the root device to /dev/sda1 and save the whole command
line and reuse it for all future boots.</P>
<P>A sample APPEND statement is:
<BLOCKQUOTE><CODE>
<PRE>
APPEND = &quot;aha152x=0x340,11,3,1&quot;
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Note that the parameter string must NOT be enclosed in quotes on the
command line, but it MUST be enclosed in quotes in the APPEND statement.</P>
<P>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, cd to /usr/src/linux 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.</P>
<P>Readers are strongly urged to read the LILO documentation before
experimenting with LILO installation. Incautious use of the "BOOT"
statement can damage partitions.</P>
<H2><A NAME="ss5.7">5.7 Q. How can I create an oversize ramdisk filesystem?</A></H2>
<P>An oversize ramdisk filesystem is a filesystem in a ramdisk larger
than the size of the root disk it was loaded from. This can be
extremely useful when using Ftape, which requires exclusive use
of the floppy disk controller (see the Ftape HOWTO for details.)</P>
<P>Two things are required: create an oversize file system on the
root diskette, and then patch the kernel so that it will not
try to load blocks off the end of the diskette.</P>
<P>To create an oversize filesystem, two methods are possible:
<UL>
<LI>Use the "blocks" e2fsck parameter to specify the size of
filesystem that you eventually want in the ramdisk. For example:
<BLOCKQUOTE><CODE>
<PRE>
mke2fs /dev/fd0 3000
</PRE>
</CODE></BLOCKQUOTE>
will create a filesystem on the diskette of 3000 1Kb blocks. The
diskette only has 1440 blocks, but mke2fs does not care about this.
E2fs will care about it if you try to use more than 1440 blocks
of data (allowing for blocks used as inodes and reserved etc),
but up to this point it is quite safe. You will soon find out if
you try to load too much on the diskette because an I/O error will result.</LI>
<LI>Create a partition on your hard disk as large as the filesystem
you want on the ramdisk. Then create a filesystem on it and load in
the files you want. Then use dd to copy only the first 1440 blocks
to diskette, and then check that there was nothing in the uncopied
part of the filesystem. For example:
<BLOCKQUOTE><CODE>
<PRE>
dd if=/dev/hdb of=/dev/fd0 bs=1024 count=1440
dd if=/dev/hdb of=tailpart bs=1024 skip=1440
cmp -l tailparm /dev/zero
</PRE>
</CODE></BLOCKQUOTE>
</LI>
</UL>
Of the two, I prefer the first method - it appears easier and safer.</P>
<P>The second thing required to get an oversized filesystem is to get the
kernel to stop loading at the end of the physical diskette when it
tries to load the root diskette into ramdisk. To do this, a simple
patch can be applied to the ramdisk driver, which should be found in
/usr/src/linux/drivers/block/ramdisk.c. The following patch has been
contributed by Bruce Elliot. It is for kernel version 1.2.0, but it
should be fairly easy to apply to later versions. Even if the patch
will not apply, the code is not complex, so the patch could easily
be modified until it worked.</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
=================================================================
X--- ramdisk.c~ Mon Jan 23 13:04:09 1995
X+++ ramdisk.c Mon May 29 00:54:52 1995
X@@ -113,6 +113,7 @@
X (struct ext2_super_block *)&amp;sb;
X int block, tries;
X int i = 1;
X+ int fblocks;
X int nblocks;
X char *cp;
X
X@@ -168,12 +169,16 @@
X nblocks, rd_length &gt;&gt; BLOCK_SIZE_BITS);
X return;
X }
X- printk(&quot;RAMDISK: Loading %d blocks into RAM disk&quot;, nblocks);
X+ fblocks = blk_size[MAJOR(ROOT_DEV)][MINOR(ROOT_DEV)];
X+ if (fblocks &gt; nblocks)
X+ fblocks = nblocks;
X+ printk(&quot;RAMDISK: Loading %d blocks into %d block filesystem &quot;
X+ &quot;in RAM disk&quot;, fblocks, nblocks);
X
X /* We found an image file system. Load it into core! */
X cp = rd_start;
X- while (nblocks) {
X- if (nblocks &gt; 2)
X+ while (fblocks) {
X+ if (fblocks &gt; 2)
X bh = breada(ROOT_DEV, block, BLOCK_SIZE, 0, PAGE_SIZE);
X else
X bh = bread(ROOT_DEV, block, BLOCK_SIZE);
X@@ -184,7 +189,7 @@
X }
X (void) memcpy(cp, bh-&gt;b_data, BLOCK_SIZE);
X brelse(bh);
X- if (!(nblocks-- & 15)) printk(&quot;.&quot;);
X+ if (!(fblocks-- & 15)) printk(&quot;.&quot;);
X cp += BLOCK_SIZE;
X block++;
X i++;
=================================================================
</PRE>
</CODE></BLOCKQUOTE>
With this patch, the kernel stops loading at the end of the
physical diskette, leaving a filesystem larger than the disk.</P>
<P>Some warnings: I have been able to create stable ramdisk filesystems
in this fashion of 3500 blocks, but if I try 3600 or more then the
kernel collapses with an error something like "fixup table corrupt".
I have not been able to track down why, but obviously something is
overflowing. Up to 3500 blocks, though, I have had no problems.</P>
<H2><A NAME="ss5.8">5.8 Q. At boot time, I get error <CODE>A: cannot execute B</CODE>. Why?</A></H2>
<P>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 "strings" command and
piping the output through grep.</P>
<P>Known examples of hardcoding are:
<UL>
<LI>Shutdown in some versions has <CODE>/etc/reboot</CODE> hardcoded, so
<CODE>reboot</CODE> must be placed in the /etc directory.</LI>
<LI>Init has caused problems for at least one person, with the kernel
being unable to find init. </LI>
</UL>
To fix these problems, either move the programs to the correct directory,
or change configuration files (e.g. inittab) 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 inittab and <CODE>/etc/rc.d</CODE>
files as they appear on your hard disk.</P>
<HR>
<A HREF="Bootdisk-HOWTO-4.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<A HREF="Bootdisk-HOWTO-6.html"><IMG SRC="next.gif" ALT="Next"></A>
<A HREF="Bootdisk-HOWTO.html#toc5"><IMG SRC="toc.gif" ALT="Contents"></A>
</BODY>
</HTML>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,80 @@
<HTML>
<HEAD>
<TITLE>The Linux Bootdisk HOWTO</TITLE>
</HEAD>
<BODY>
<IMG SRC="prev.gif" ALT="Previous">
<A HREF="Bootdisk-HOWTO-1.html"><IMG SRC="next.gif" ALT="Next"></A>
<IMG SRC="toc.gif" ALT="Contents">
<HR>
<H1>The Linux Bootdisk HOWTO</H1>
<H2>Graham Chapman, <CODE>grahamc@zeta.org.au</CODE></H2>v1.02, 25 June 1995
<P><HR><EM>This document describes how to create Linux boot, boot/root and utility
maintenance disks. These disks could be used as rescue disks or to test
new kernels.</EM><HR></P>
<P>
<H2><A NAME="toc1">1.</A> <A HREF="Bootdisk-HOWTO-1.html">Introduction</A></H2>
<UL>
<LI><A HREF="Bootdisk-HOWTO-1.html#ss1.1">1.1 Why Build Boot Disks?</A>
<LI><A HREF="Bootdisk-HOWTO-1.html#ss1.2">1.2 Feedback and Credits</A>
<LI><A HREF="Bootdisk-HOWTO-1.html#ss1.3">1.3 Change History</A>
</UL>
<P>
<H2><A NAME="toc2">2.</A> <A HREF="Bootdisk-HOWTO-2.html">Disks</A></H2>
<UL>
<LI><A HREF="Bootdisk-HOWTO-2.html#ss2.1">2.1 Summary of Disk Types</A>
<LI><A HREF="Bootdisk-HOWTO-2.html#ss2.2">2.2 Boot</A>
<LI><A HREF="Bootdisk-HOWTO-2.html#ss2.3">2.3 Root</A>
<LI><A HREF="Bootdisk-HOWTO-2.html#ss2.4">2.4 Boot/Root </A>
<LI><A HREF="Bootdisk-HOWTO-2.html#ss2.5">2.5 Utility</A>
</UL>
<P>
<H2><A NAME="toc3">3.</A> <A HREF="Bootdisk-HOWTO-3.html">Components</A></H2>
<UL>
<LI><A HREF="Bootdisk-HOWTO-3.html#ss3.1">3.1 File Systems</A>
<LI><A HREF="Bootdisk-HOWTO-3.html#ss3.2">3.2 Kernel</A>
<LI><A HREF="Bootdisk-HOWTO-3.html#ss3.3">3.3 Devices</A>
<LI><A HREF="Bootdisk-HOWTO-3.html#ss3.4">3.4 Directories </A>
<LI><A HREF="Bootdisk-HOWTO-3.html#ss3.5">3.5 LILO</A>
</UL>
<P>
<H2><A NAME="toc4">4.</A> <A HREF="Bootdisk-HOWTO-4.html">Samples</A></H2>
<UL>
<LI><A HREF="Bootdisk-HOWTO-4.html#ss4.1">4.1 Disk Directory Listings</A>
<LI><A HREF="Bootdisk-HOWTO-4.html#ss4.2">4.2 Shell Scripts to Build Diskettes</A>
</UL>
<P>
<H2><A NAME="toc5">5.</A> <A HREF="Bootdisk-HOWTO-5.html">FAQ</A></H2>
<UL>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.1">5.1 Q. How can I make a boot disk with a XXX driver?</A>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.2">5.2 Q. How do I update my boot floppy with a new kernel?</A>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.3">5.3 Q. How do I remove LILO so that I can use DOS to boot again?</A>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.4">5.4 Q. How can I boot if I've lost my kernel AND my boot disk?</A>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.5">5.5 Q. How can I make extra copies of boot/root diskettes?</A>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.6">5.6 Q. How can I boot without typing in "ahaxxxx=nn,nn,nn" every time?</A>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.7">5.7 Q. How can I create an oversize ramdisk filesystem?</A>
<LI><A HREF="Bootdisk-HOWTO-5.html#ss5.8">5.8 Q. At boot time, I get error <CODE>A: cannot execute B</CODE>. Why?</A>
</UL>
<P>
<H2><A NAME="toc6">6.</A> <A HREF="Bootdisk-HOWTO-6.html">References</A></H2>
<UL>
<LI><A HREF="Bootdisk-HOWTO-6.html#ss6.1">6.1 LILO - Linux Loader</A>
<LI><A HREF="Bootdisk-HOWTO-6.html#ss6.2">6.2 Linux FAQ and HOWTOs</A>
<LI><A HREF="Bootdisk-HOWTO-6.html#ss6.3">6.3 Rescue Packages</A>
<LI><A HREF="Bootdisk-HOWTO-6.html#ss6.4">6.4 Slackware Distribution</A>
</UL>
<HR>
<IMG SRC="prev.gif" ALT="Previous">
<A HREF="Bootdisk-HOWTO-1.html"><IMG SRC="next.gif" ALT="Next"></A>
<IMG SRC="toc.gif" ALT="Contents">
</BODY>
</HTML>

View File

@@ -0,0 +1,113 @@
<HTML>
<HEAD>
<TITLE>The Linux Bootdisk HOWTO: References</TITLE>
</HEAD>
<BODY>
<A HREF="Bootdisk-HOWTO-5.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<IMG SRC="next.gif" ALT="Next">
<A HREF="Bootdisk-HOWTO.html#toc6"><IMG SRC="toc.gif" ALT="Contents"></A>
<HR>
<H2><A NAME="s6">6. References</A></H2>
<P>In this section, vvv is used in package names in place of the version,
to avoid referring here to specific versions. When retrieving a package,
always get the latest version unless you have good reasons for not
doing so.</P>
<H2><A NAME="ss6.1">6.1 LILO - Linux Loader</A></H2>
<P>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.</P>
<P>Ftp from: <CODE>tsx-11.mit.edu:
/pub/linux/packages/lilo/lilo.vvv.tar.gz</CODE>
also on sunsite and mirror sites.</P>
<H2><A NAME="ss6.2">6.2 Linux FAQ and HOWTOs</A></H2>
<P>These are available from many sources. Look at the usenet newsgroups
<CODE>news.answers</CODE> and <CODE>comp.os.linux.announce</CODE>. </P>
<P>Ftp from: <CODE>sunsite.unc.edu:/pub/Linux/docs</CODE>
<UL>
<LI>FAQ is in <CODE>/pub/linux/docs/faqs/linux-faq</CODE></LI>
<LI>HOWTOs are in <CODE>/pub/Linux/docs/HOWTO</CODE></LI>
</UL>
</P>
<P>For WWW, start at the Linux documentation home page:
<BLOCKQUOTE><CODE>
<PRE>
http://sunsite.unc.edu/mdw/linux.html
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>If desperate, send mail to:
<BLOCKQUOTE><CODE>
<PRE>
mail-server@rtfm.mit.edu
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>with the word "help" in the message, then follow the mailed instructions.</P>
<P>Note: if you haven't read the Linux FAQ and related documents such as the
Linux Installation HOWTO and the Linux Install Guide, then you should not
be trying to build boot diskettes.</P>
<H2><A NAME="ss6.3">6.3 Rescue Packages</A></H2>
<H3>Bootkit</H3>
<P>Written by Scott Burkett. Bootkit provides a flexible menu-driven
framework for managing rescue disk creation and contents. It uses the
Dialog package to provide nice menus, and a straight-forward directory
tree to contain definitions of rescue disk contents. The package
includes samples of the main files needed. The package
aims to provide only the framework; it is up to the user to work out
what to put on the disks and set up the config files accordingly.
For those users who don't mind doing this, it is a good choice.
I use this package myself.</P>
<P>Ftp from: <CODE>sunsite.unc.edu:
/pub/Linux/system/Recovery/Bootkit-vvv.tar.gz</CODE></P>
<H3>CatRescue</H3>
<P>Written by Oleg Kibirev. This package concentrates on saving space
on the rescue diskettes by extensive use of compression, and by
implementing executables as shells scripts. The doco includes some
tips on what to do in various disaster situations.</P>
<P>Ftp from: <CODE>gd.cs.csufresno.edu/pub/sun4bin/src/CatRescue100.tgz</CODE></P>
<H3>Rescue Shell Scripts</H3>
<P>Written by Thomas Heiling. This contains shell scripts to produce
boot and boot/root diskettes. It has some dependencies on specific
versions of other software such as LILO, and so might need some
effort to convert to your system, but it might be useful as a
starting point if you wanted more comprehensive shell scripts than
are provided in this document.</P>
<P>Ftp from: <CODE>sunsite.unc.edu:/pub/Linux/system/Recovery/rescue.tgz</CODE></P>
<H3>SAR - Search and Rescue</H3>
<P>Written by Karel Kubat. SAR produces a rescue diskette, using
several techniques to minimize the space required on the diskette.
The manual includes a description of the Linux boot/login process.</P>
<P>Ftp from: <CODE>ftp.icce.rug.nl:/pub/unix/SAR-vvv.tar.gz</CODE></P>
<P>The manual is available via WWW from:</P>
<P><CODE>http://www.icce.rug.nl/karel/programs/SAR.html</CODE></P>
<H2><A NAME="ss6.4">6.4 Slackware Distribution</A></H2>
<P>Apart from being one of the more popular Linux distributions around, it
is also a good place to get a generic kernel. It is available from
almost everywhere, so there is little point in putting addresses here.</P>
<HR>
<A HREF="Bootdisk-HOWTO-5.html"><IMG SRC="prev.gif" ALT="Previous"></A>
<IMG SRC="next.gif" ALT="Next">
<A HREF="Bootdisk-HOWTO.html#toc6"><IMG SRC="toc.gif" ALT="Contents"></A>
</BODY>
</HTML>