home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 8 / CDACTUAL8.iso / docs / bootdisk < prev    next >
Encoding:
Text File  |  1996-07-11  |  75.9 KB  |  1,882 lines

  1.   The Linux Bootdisk HOWTO
  2.   Graham Chapman, grahamc@zeta.org.au
  3.   v1.02, 25 June 1995
  4.  
  5.   This document describes how to create Linux boot, boot/root and util¡
  6.   ity maintenance disks. These disks could be used as rescue disks or to
  7.   test new kernels.
  8.  
  9.   1.  Introduction
  10.  
  11.   1.1.  Why Build Boot Disks?
  12.  
  13.   Linux boot disks are useful in a number of situations, such as:
  14.  
  15.   ╖  Testing a new kernel.
  16.  
  17.   ╖  Recovering from disk or system failure. Such a failure could be
  18.      anything from a lost boot sector to a disk head crash.
  19.  
  20.   There are several ways of producing boot disks:
  21.  
  22.   ╖  Use one from a distribution such as Slackware. This will at least
  23.      allow you to boot.
  24.  
  25.   ╖  Use a rescue package to set up disks designed to be used as rescue
  26.      disks.
  27.  
  28.   ╖  Learn what is required for each of the various types of disk to
  29.      operate, then build your own.
  30.  
  31.   I originally chose the last option - learn how it works so that you
  32.   can do it yourself. That way, if something breaks, you can work out
  33.   what to do to fix it. Plus you learn a lot about how Linux works along
  34.   the way. Once I understood how it all worked, then I changed to using
  35.   the Bootkit rescue package to maintain my boot disks.
  36.  
  37.   Experienced Linux users may find little of use in this document.
  38.   However users new to Linux system administration who wish to protect
  39.   against root disk loss and other mishaps may find it useful.
  40.  
  41.   A note on versions - this document has been updated to support the
  42.   following packages and versions:
  43.  
  44.   ╖  Linux 1.2.0
  45.  
  46.   ╖  LILO 0.15
  47.  
  48.   Copyright (c) Graham Chapman 1995.
  49.  
  50.   Permission is granted for this material to be freely used and
  51.   distributed, provided the source is acknowledged.  No warranty of any
  52.   kind is provided. You use this material at your own risk.
  53.  
  54.   1.2.  Feedback and Credits
  55.  
  56.   I welcome any feedback, good or bad, on the content of this document.
  57.   Please let me know if you find any errors or omissions.
  58.  
  59.   I thank the following people for correcting errors and providing
  60.   useful suggestions for improvement:
  61.  
  62.           Randolph Bentson
  63.           Grant R. Bowman
  64.           Scott Burkett
  65.           Bruce Elliot
  66.           HARIGUCHI Youichi
  67.           Bjxrn-Helge Mevik
  68.           Dwight Spencer
  69.           Cameron Spitzer
  70.           Johannes Stille
  71.  
  72.   1.3.  Change History
  73.  
  74.   v1.02, 25 June 1995
  75.  
  76.   ╖  Add: FAQ question on oversize ramdisk filesystems.
  77.  
  78.   ╖  Add: if using mkfs, use the -i option.
  79.  
  80.   ╖  Add: can use cp as well as dd to copy to raw disk.
  81.  
  82.   ╖  Chg: correct explanation of /dev/fd0 vs /dev/fd0H1440.
  83.  
  84.   ╖  Chg: use "zImage" terminology to conform to standard usage.
  85.  
  86.   ╖  Add: mke2fs -m 0 will provide more usable disk space.
  87.  
  88.   ╖  Add: re-run LILO if the kernel has changed.
  89.  
  90.   ╖  Add: move rescue packages to new section under "References".
  91.  
  92.   ╖  Add: new rescue packages Bootkit and CatRescue.
  93.  
  94.   ╖  Add: FAQ question on cannot execute errors.
  95.  
  96.   ╖  Add: shell scripts are samples only - I now use Bootkit.
  97.  
  98.   ╖  Chg: stop using < and > in command examples - too confusing.
  99.  
  100.   ╖  Chg: sample directory listings are now of diskettes, not model.
  101.  
  102.   ╖  Chg: use more consistent terminology with ramdisks.
  103.  
  104.      v1.01, 6 February 1995
  105.  
  106.   ╖  Fix: DO NOT cp kernel_filename /dev/fd0 - this will overwrite any
  107.      file system on the diskette.
  108.  
  109.   ╖  Fix: Put LILO boot.b and map files on target disk.
  110.  
  111.   ╖  Add: -dp flags to cp commands to avoid problems.
  112.  
  113.   ╖  Chg: restructure to try to improve readability.
  114.  
  115.   ╖  Add: can now use ext2 filesystem on root diskettes.
  116.  
  117.   ╖  Chg: can now separate boot and root diskettes.
  118.  
  119.   ╖  Add: credits section in Introduction.
  120.  
  121.   ╖  Add: FAQ.
  122.  
  123.   v1.0, 2 January 1995
  124.  
  125.   ╖  Converted to conform to HOWTO documentation standards.
  126.  
  127.   ╖  Added new section - Change History.
  128.  
  129.   ╖  Various minor corrections.
  130.  
  131.   v0.10, 1 November 1994 Original version, labelled "draft".
  132.  
  133.   2.  Disks
  134.  
  135.   2.1.  Summary of Disk Types
  136.  
  137.   I classify boot-related disks into 4 types. The discussion here and
  138.   throughout this document uses the term "disk" to refer to diskettes
  139.   unless otherwise specified. Most of the discussion could be equally
  140.   well applied to hard disks.
  141.  
  142.   A summary of disk types and uses is:
  143.  
  144.      boot
  145.         A disk containing a kernel which can be booted. The disk can
  146.         contain a filesystem and use a boot loader to boot, or it can
  147.         simply contain the kernel only at the start of the disk.  The
  148.         disk can be used to boot the kernel using a root file system on
  149.         another disk. This could be useful if you lost your boot loader
  150.         due to, for example, an incorrect installation attempt.
  151.  
  152.      root
  153.         A disk with a file system containing everything required to run
  154.         a Linux system. It does not necessarily contain either a kernel
  155.         or a boot loader.
  156.  
  157.         This disk can be used to run the system independently of any
  158.         other disks, once the kernel has been booted. A special kernel
  159.         feature allows a separate root disk to be mounted after booting,
  160.         with the root disk being automatically copied to a ramdisk.
  161.  
  162.         You could use this type of disk to check another disk for
  163.         corruption without mounting it, or to restore another disk after
  164.         a disk failure or loss of files.
  165.  
  166.      boot/root
  167.         A disk which is the same as a root disk, but contains a kernel
  168.         and a boot loader. It can be used to boot from, and to run the
  169.         system. The advantage of this type of disk is that is it compact
  170.         - everything required is on a single disk.  However the
  171.         gradually increasing size of everything means that it won't
  172.         necessarily always be possbile to fit everything on a single
  173.         diskette.
  174.  
  175.      utility
  176.         A disk which contains a file system, but is not intended to be
  177.         mounted as a root file system. It is an additional data disk.
  178.         You would use this type of disk to carry additional utilities
  179.         where you have too much to fit on your root disk.
  180.  
  181.         The term "utility" only really applies to diskettes, where you
  182.         would use a utility disk to store additional recovery utility
  183.         software.
  184.   2.2.  Boot
  185.  
  186.   2.2.1.  Overview
  187.  
  188.   All PC systems start the boot process by executing code in ROM to load
  189.   the sector from sector 0, cylinder 0 of the boot drive and try and
  190.   execute it. On most bootable disks, sector 0, cylinder 0 contains
  191.   either:
  192.  
  193.   ╖  code from a boot loader such as LILO, which locates the kernel,
  194.      loads it and executes it to start the boot proper.
  195.  
  196.   ╖  the start of an operating system kernel, such as Linux.
  197.  
  198.   If a Linux kernel has been written to a diskette as a raw device, then
  199.   the first sector will be the first sector of the Linux kernel itself,
  200.   and this sector will continue the boot process by loading the rest of
  201.   the kernel and running Linux. For a more detailed description of the
  202.   boot sector contents, see the documentation in lilo-01.5 or higher.
  203.  
  204.   An alternative method of storing a kernel on a boot disk is to create
  205.   a filesystem, not as a root filesystem, but simply as a means of
  206.   installing LILO and thus allowing boot-time command line options to be
  207.   specified. For example, the same kernel could then be used to boot
  208.   using a hard disk root filesystem, or a diskette root filesystem. This
  209.   could be useful if you were trying to rebuild the hard disk
  210.   filesystem, and wanted to repeatedly test results.
  211.  
  212.   2.2.2.  Setting Pointer to Root
  213.  
  214.   The kernel must somehow obtain a pointer to the drive and partititon
  215.   to be mounted as the root drive. This can be provided in several ways:
  216.  
  217.   ╖  By setting ROOT_DEV = devicename in the Linux kernel makefile and
  218.      rebuilding the kernel (for advice on how to rebuild the kernel,
  219.      read the Linux FAQ and look in /usr/src/linux). Comments in the
  220.      Linux makefile describe the valid values for devicename.
  221.  
  222.   ╖  By running the rdev utility:
  223.  
  224.                rdev filename devicename
  225.  
  226.   This will set the root device of the kernel contained in filename to
  227.   be devicename. For example:
  228.  
  229.                rdev zImage /dev/sda1
  230.  
  231.   This sets the root device in the kernel in zImage to the first parti¡
  232.   tion on the first SCSI drive.
  233.  
  234.   There are some alternative ways of issuing the rdev command. Try:
  235.  
  236.           rdev -h
  237.  
  238.   and it will display command usage.
  239.  
  240.   There is usually no need to configure the root device for boot
  241.   diskette use, because the kernel currently used to boot from probably
  242.   already points to the root drive device. The need can arise, howoever,
  243.   if you obtain a kernel from another machine, for example, from a
  244.   distribution, or if you want to use the kernel to boot a root
  245.   diskette. It is probably a good idea to check the current root drive
  246.   setting, just in case it is wrong. To get rdev to check the current
  247.   root device in a kernel file, enter the command:
  248.  
  249.                rdev <filename>
  250.  
  251.   It is possible to change the root device set in a kernel by means
  252.   other than using rdev. For details, see the FAQ at the end of this
  253.   document.
  254.  
  255.   2.2.3.  Copying Kernel to Boot Diskette
  256.  
  257.   Once the kernel has been configured then it must be copied to the boot
  258.   diskette.
  259.  
  260.   The commands described below (and throughout the HOWTO) assume that
  261.   the diskettes have been formatted. If not, then use fdformat to format
  262.   the diskettes before continuing.
  263.  
  264.   If the disk is not intended to contain a file system, then the kernel
  265.   can be copied using the dd command, as follows:
  266.  
  267.                dd if=infilename of=devicename
  268.  
  269.                where   infilename is the name of the kernel
  270.                and     devicename is the diskette raw device,
  271.                        usually /dev/fd0
  272.  
  273.   The cp command can also be used:
  274.  
  275.                cp filename devicename
  276.  
  277.   For example:
  278.  
  279.                dd if=zImage of=/dev/fd0
  280.        or
  281.                cp zImage /dev/fd0
  282.  
  283.   The seek parameter to the dd command should NOT be used. The file must
  284.   be copied to start at the boot sector (sector 0, cylinder 0), and
  285.   omitting the seek parameter will do this.
  286.  
  287.   The output device name to be used is usually /dev/fd0 for the primary
  288.   diskette drive (i.e. drive "A:" in DOS), and /dev/fd1 for the
  289.   secondary. These device names will cause the kernel to autodetect the
  290.   attributes of the drives. Drive attributes can be specified to the
  291.   kernel by using other device names: for example /dev/fd0H1440
  292.   specifies a high density 1.44 Mb drive. It is rare to need to use
  293.   these specific device names.
  294.  
  295.   Where the kernel is to be copied to a boot disk containing a
  296.   filesystem, then the disk is mounted at a suitable point in a
  297.   currently-mounted filesystem, then the cp command is used. For
  298.   example:
  299.  
  300.                mount -t ext2 /dev/fd0 /mnt
  301.                cp zImage /mnt
  302.                umount /mnt
  303.  
  304.   Note that for almost all operations in this HOWTO, the user should be
  305.   operating as the superuser.
  306.  
  307.   2.3.  Root
  308.  
  309.   2.3.1.  Overview
  310.  
  311.   A root disk contains a complete working Linux system, but without
  312.   necessarily including a kernel. In other words, the disk may not be
  313.   bootable, but once the kernel is running, the root disk contains
  314.   everything needed to support a full Linux system. To be able to do
  315.   this, the disk must include the minimum requirements for a Linux
  316.   system:
  317.  
  318.   ╖  File system.
  319.  
  320.   ╖  Minimum set of directories - dev, proc, bin, etc, lib, usr, tmp.
  321.  
  322.   ╖  Basic set of utilities - bash (to run a shell), ls, cp etc.
  323.  
  324.   ╖  Minimum set of config files - rc, inittab, fstab etc.
  325.  
  326.   ╖  Runtime library to provide basic functions used by utilities.
  327.  
  328.   Of course, any system only becomes useful when you can run something
  329.   on it, and a root diskette usually only becomes useful when you can do
  330.   something like:
  331.  
  332.   ╖  Check a file system on another drive, for example to check your
  333.      root file system on your hard drive, you need to be able to boot
  334.      Linux from another drive, as you can with a root diskette system.
  335.      Then you can run fsck on your original root drive while it is not
  336.      mounted.
  337.  
  338.   ╖  Restore all or part of your original root drive from backup using
  339.      archive/compression utilities including cpio, tar, gzip and ftape.
  340.  
  341.   2.4.  Boot/Root
  342.  
  343.   This is essentially the same as the root disk, with the addition of a
  344.   kernel and a boot loader such as LILO.
  345.  
  346.   With this configuration, a kernel file is copied to the root file
  347.   system, and LILO is then run to install a configuration which points
  348.   to the kernel file on the target disk. At boot time, LILO will boot
  349.   the kernel from the target disk.
  350.  
  351.   Several files must be copied to the diskette for this method to work.
  352.   Details of these files and the required LILO configuration, including
  353.   a working sample, are given below in the section titled "LILO".
  354.  
  355.   2.4.1.  RAM Disks and Root Filesystems on Diskette
  356.  
  357.   For a diskette root filesystem to be efficient, you need to be able to
  358.   run it from a ramdisk, i.e. an emulated disk drive in main memory.
  359.   This avoids having the system run at a snail's pace, which a diskette
  360.   would impose. The Ftape HOWTO states that a ramdisk will be required
  361.   when using Ftape because Ftape requires exclusive use of the diskette
  362.   controller.
  363.  
  364.   There is an added benefit from using a ramdisk - the Linux kernel
  365.   includes an automatic ramdisk root feature, whereby it will, under
  366.   certain circumstances, automatically copy the contents of a root
  367.   diskette to a ramdisk, and then switch the root drive to be the
  368.   ramdisk instead of the diskette. This has two major benefits:
  369.  
  370.   ╖  The system runs a lot faster.
  371.  
  372.   ╖  The diskette drive is freed up to allow other diskettes to be used
  373.      on a single-diskette drive system.
  374.  
  375.   The requirements for this feature to be invoked are:
  376.  
  377.   ╖  The file system on the diskette drive must be either a minix or an
  378.      ext2 file system. The ext2 file system is generally the preferred
  379.      file system to use. Note that if you have a Linux kernel earlier
  380.      than 1.1.73, then you should see the comments in the section titled
  381.      "File Systems" to see whether your kernel will support ext2. If
  382.      your kernel is old then you may have to use minix. This will not
  383.      cause any significant problems.
  384.  
  385.   ╖  A ramdisk must be configured into the kernel, and it must be at
  386.      least as big as the diskette drive.
  387.  
  388.   A ramdisk can be configured into the kernel in several ways:
  389.  
  390.   ╖  By uncommenting the RAMDISK macro in the Linux kernel makefile, so
  391.      that it reads:
  392.  
  393.                RAMDISK = -DRAMDISK=1440
  394.  
  395.   to define a ramdisk of 1440 1K blocks, the size of a high-density
  396.   diskette.
  397.  
  398.   ╖  By running the rdev utility, available on most Linux systems. This
  399.      utility displays or sets values for several things in the kernel,
  400.      including the desired size for a ramdisk. To configure a ramdisk of
  401.      1440 blocks into a kernel in a file named zImage, enter:
  402.                rdev -r zImage 1440
  403.  
  404.   this might change in the future, of course. To see what your version
  405.   of rdev does, enter the command:
  406.  
  407.                rdev -h
  408.  
  409.   and it should display its options.
  410.  
  411.   ╖  By using the boot loader package LILO to configure it into your
  412.      kernel at boot time. This can be done using the LILO configuration
  413.      parameter:
  414.  
  415.                ramdisk = 1440
  416.  
  417.   to request a ramdisk of 1440 1K blocks at boot time.
  418.  
  419.   ╖  By interrupting a LILO automatic boot and adding ramdisk=1440 to
  420.      the command line. For example, such a command line might be:
  421.  
  422.                zImage ramdisk=1440
  423.  
  424.   See the section on LILO for more details.
  425.  
  426.   ╖  By editing the kernel file and altering the values near the start
  427.      of the file which record the ramdisk size. This is definitely a
  428.      last resort, but can be done. See the FAQ near the end of this
  429.      document for more details.
  430.  
  431.   The easiest of these methods is LILO configuration, because you need
  432.   to set up a LILO configuration file anyway, so why not add the ramdisk
  433.   size here?
  434.  
  435.   LILO configuration is briefly described in a section titled "LILO"
  436.   below, but it is advisable to obtain the latest stable version of LILO
  437.   from your nearest Linux mirror site, and read the documentation that
  438.   comes with it.
  439.  
  440.   Ramdisks can be made larger than the size of a diskette, and made to
  441.   contain a filesystem as large as the ramdisk. This can be useful to
  442.   load all the software required for rescue work onto a single high-
  443.   performance ramdisk. The method of doing this is described in the FAQ
  444.   section under the question "How can I create an oversize ramdisk
  445.   filesystem?"
  446.  
  447.   2.5.  Utility
  448.  
  449.   Often one disk is not sufficient to hold all the software you need to
  450.   be able to perform rescue functions of analysing, repairing and
  451.   restoring corrupted disk drives. By the time you include tar, gzip
  452.   e2fsck, fdisk, Ftape and so on, there is enough for a whole new
  453.   diskette, maybe even more if you want lots of tools.
  454.  
  455.   This means that a rescue set often requires a utility diskette, with a
  456.   file system containing any extra files required. This file system can
  457.   then be mounted at a convenient point, such as /usr, on the boot/root
  458.   system.
  459.  
  460.   Creating a file system is fairly easy, and is described in the section
  461.   titled "File Systems".
  462.  
  463.   3.  Components
  464.  
  465.   3.1.  File Systems
  466.  
  467.   The Linux kernel now supports two file system types for root disks to
  468.   be automatically copied to ramdisk. These are minix and ext2, of which
  469.   ext2 is the preferred file system.  The ext2 support was added
  470.   sometime between 1.1.17 and 1.1.57, I'm not sure exactly which. If you
  471.   have a kernel within this range then edit
  472.   /usr/src/linux/drivers/block/ramdisk.c and look for the word "ext2".
  473.   If it is not found, then you will have to use a minix file system, and
  474.   therefore the "mkfs" command to create it. (If using mkfs, use the -i
  475.   option to specify more inodes than the default; -i 2000 is suggested).
  476.  
  477.   To create an ext2 file system on a diskette on my system, I issue the
  478.   following command:
  479.  
  480.                mke2fs -m 0 /dev/fd0
  481.  
  482.   The mke2fs command will automatically detect the space available and
  483.   configure itself accordingly. If desired, the diskette size in 1Kb
  484.   blocks can be specified to speed up mke2fs operation. The -m 0
  485.   parameter prevents it from reserving space for root, and hence
  486.   provides more usable space on the disk.
  487.  
  488.   An easy way to test the result is to create a system using the above
  489.   command or similar, and then attempt to mount the diskette. If it is
  490.   an ext2 system, then the command:
  491.  
  492.                mount -t ext2 /dev/fd0 /<mount point>
  493.  
  494.   should work.
  495.  
  496.   3.2.  Kernel
  497.  
  498.   3.2.1.  Building a Custom Kernel
  499.  
  500.   In most cases it would be possible to copy your current kernel and
  501.   boot the diskette from that. However there may be cases where you wish
  502.   to build a separate one.
  503.  
  504.   One reason is size.  The kernel is one of the largest files in a
  505.   minimum system, so if you want to build a boot/root diskette, then you
  506.   will have to reduce the size of the kernel as much as possible.  The
  507.   kernel now supports changing the diskette after booting and before
  508.   mounting root, so it is not necessary any more to squeeze the kernel
  509.   into the same disk as everything else, therefore these comments apply
  510.   only if you choose to build a boot/root diskette.
  511.  
  512.   There are two ways of reducing kernel size:
  513.  
  514.   ╖  Building it with the minumum set of facilities necessary to support
  515.      the desired system. This means leaving out everything you don't
  516.      need. Networking is a good thing to leave out, as well as support
  517.      for any disk drives and other devices which you don't need when
  518.      running your boot/root system.
  519.  
  520.   ╖  Compressing it, using the standard compressed-kernel option
  521.      included in the makefile:
  522.  
  523.                make zImage
  524.  
  525.   Refer to the documentation included with the kernel source for up-to-
  526.   date information on building compressed kernels.  Note that the kernel
  527.   source is usually in /usr/src/linux.
  528.  
  529.   Having worked out a minimum set of facilities to include in a kernel,
  530.   you then need to work out what to add back in. Probably the most
  531.   common uses for a boot/root diskette system would be to examine and
  532.   restore a corrupted root file system, and to do this you may need
  533.   kernel support.
  534.  
  535.   For example, if your backups are all held on tape using Ftape to
  536.   access your tape drive, then, if you lose your current root drive and
  537.   drives containing Ftape, then you will not be able to restore from
  538.   your backup tapes. You will have to reinstall Linux, download and
  539.   reinstall Ftape, and then try and read your backups.
  540.  
  541.   It is probably desirable to maintain a copy of the same version of
  542.   backup utilities used to write the backups, so that you don't waste
  543.   time trying to install versions that cannot read your backup tapes.
  544.  
  545.   The point here is that, whatever I/O support you have added to your
  546.   kernel to support backups should also be added into your boot/root
  547.   kernel.
  548.  
  549.   The procedure for actually building the kernel is described in the
  550.   documentation that comes with the kernel. It is quite easy to follow,
  551.   so start by looking in /usr/src/linux. Note that if you have trouble
  552.   building a kernel, then you should probably not attempt to build
  553.   boot/root systems anyway.
  554.  
  555.   3.3.  Devices
  556.  
  557.   A /dev directory containing a special file for all devices to be used
  558.   by the system is mandatory for any Linux system. The directory itself
  559.   is a normal directory, and can be created with the mkdir command in
  560.   the normal way. The device special files, however, must be created in
  561.   a special way, using the mknod command.
  562.  
  563.   There is a shortcut, though - copy your existing /dev directory
  564.   contents, and delete the ones you don't want. The only requirement is
  565.   that you copy the device special files using the -R option. This will
  566.   copy the directory without attempting to copy the contents of the
  567.   files. Note that if you use lower caser, as in "-r", there will be a
  568.   vast difference, because you will probably end up copying the entire
  569.   contents of all of your hard disks - or at least as much of them as
  570.   will fit on a diskette! Therefore, take care, and use the command:
  571.  
  572.                cp -dpR /dev /mnt
  573.  
  574.   assuming that the diskette is mounted at /mnt. The dp switches ensure
  575.   that symbolic links are copied as links (rather than the target file
  576.   being copied) and that the original file attributes are preserved,
  577.   thus preserving ownership information.
  578.  
  579.   If you want to do it the hard way, use ls -l to display the major and
  580.   minor device numbers for the devices you want, and create them on the
  581.   diskette using mknod.
  582.  
  583.   Many distributions include a shell script called MAKEDEV in the /dev
  584.   directory. This shell script could be used to create the devices, but
  585.   it is probably easier to just copy your existing ones, especially for
  586.   rescue disk purposes.
  587.  
  588.   Whichever way the device directory is copied, it is worth checking
  589.   that any special devices you need have been placed on the rescue
  590.   diskette. For example, Ftape uses tape devices, so you will need to
  591.   copy all of these.
  592.  
  593.   3.4.  Directories
  594.  
  595.   It might be possible to get away with just /dev, /proc and /etc to run
  596.   a Linux system. I don't know - I've never tested it. However a
  597.   reasonable minimum set of directories consists of the following:
  598.  
  599.      /dev
  600.         Required to perform I/O with devices
  601.  
  602.      /proc
  603.         Required by the ps command
  604.  
  605.      /etc
  606.         System configuration files
  607.  
  608.      /bin
  609.         Utility executables considered part of the system
  610.  
  611.      /lib
  612.         Shared libraries to provide run-time support
  613.  
  614.      /mnt
  615.         A mount point for maintenance on other disks
  616.  
  617.      /usr
  618.         Additional utilities and applications
  619.  
  620.   Note that the directory tree presented here is for root diskette use
  621.   only.  Refer to the Linux File System Standard for much better
  622.   information on how file systems should be structured in "standard"
  623.   Linux systems.
  624.  
  625.   Four of these directories can be created very easily:
  626.  
  627.   ╖  /dev is described above in the section titled DEVICES.
  628.  
  629.   ╖  /proc only needs to exist. Once the directory is created using
  630.      mkdir, nothing more is required.
  631.  
  632.   ╖  Of the others, /mnt and /usr are included in this list only as
  633.      mount points for use after the boot/root system is running.  Hence
  634.      again, these directories only need to be created.
  635.  
  636.   The remaining 3 directories are described in the following sections.
  637.  
  638.   3.4.1.  /etc
  639.  
  640.   This directory must contain a number of configuration files. On most
  641.   systems, these can be divided into 3 groups:
  642.  
  643.   ╖  Required at all times, e.g. rc, fstab, passwd.
  644.  
  645.   ╖  May be required, but no-one is too sure.
  646.  
  647.   ╖  Junk that crept in.
  648.  
  649.   Files which are not essential can be identified with the command:
  650.  
  651.                ls -ltru
  652.  
  653.   This lists files in reverse order of date last accessed, so if any
  654.   files are not being accessed, then they can be omitted from a root
  655.   diskette.
  656.  
  657.   On my root diskettes, I have the number of config files down to 15.
  658.   This reduces my work to dealing with three sets of files:
  659.  
  660.   ╖  The ones I must configure for a boot/root system:
  661.  
  662.                rc      system startup script
  663.                fstab   list of file systems to be mounted
  664.                inittab parameters for the init process - the
  665.                        first process started at boot time.
  666.  
  667.   ╖  the ones I should tidy up for a boot/root system:
  668.  
  669.                passwd  list of logins
  670.                shadow  contains passwords
  671.  
  672.   These should be pruned on secure systems to avoid copying user's pass¡
  673.   words off the system, and so that when you boot from diskette,
  674.   unwanted logins are rejected.
  675.  
  676.   ╖  The rest. They work at the moment, so I leave them alone.
  677.  
  678.   Out of this, I only really have to configure two files, and what they
  679.   should contain is suprisingly small.
  680.  
  681.   ╖  rc should contain:
  682.  
  683.                #!/bin/sh
  684.                /etc/mount -av
  685.                /bin/hostname boot_root
  686.  
  687.   and I don't really need to run hostname - it just looks nicer if I do.
  688.   Even mount is actually only needed to mount /proc to support the ps
  689.   command - Linux will run without it.
  690.  
  691.   ╖  fstab should contain:
  692.  
  693.                /dev/fd0        /               ext2    defaults
  694.                /proc           /proc           proc    defaults
  695.  
  696.   I don't think that the first entry is really needed, but I find that
  697.   if I leave it out, mount won't mount /proc.
  698.  
  699.   Inittab should be ok as is, unless you want to ensure that users on
  700.   serial ports cannot login. To prevent this, comment out all the
  701.   entries for /etc/getty which include a ttys or ttyS device at the end
  702.   of the line.  Leave in the tty ports so that you can login at the
  703.   console.
  704.  
  705.   Inittab defines what the system will run or rerun in various states
  706.   including startup, move to multi-user mode, powerfail, and others.  A
  707.   point to be careful of here is to carefully check that the commands
  708.   entered in inittab refer to programs which are present and to the
  709.   correct directory. If you place your command files on your rescue disk
  710.   using the sample directory listing in this HOWTO as a guide, and then
  711.   copy your inittab to your rescue disk without checking it, then the
  712.   probability of failure will be quite high, because half of the inittab
  713.   entries will refer to missing programs or to the wrong directory.
  714.  
  715.   It is worth noting here as well that some programs cannot be moved
  716.   from one directory to another or they will fail at runtime because
  717.   they have hardcoded the name of another program which they attempt to
  718.   run. For example on my system, /etc/shutdown has hardcoded in it
  719.   /etc/reboot. If I move reboot to /bin/reboot, and then issue a
  720.   shutdown command, it will fail because it can't find the reboot file.
  721.  
  722.   For the rest, just copy all the text files in your /etc directory,
  723.   plus all the executables in your /etc directory that you cannot be
  724.   sure you do not need. As a guide, consult the sample ls listing in
  725.   "Sample Boot/Root ls-lR Directory Listing" - this is what I have, so
  726.   probably it will be sufficient for you if you copy only those files.
  727.  
  728.   In practice, a single rc file is restrictive; most systems now use an
  729.   /etc/rc.d directory containing shell scripts for different run levels.
  730.   The absolute minimum is a single rc script, but it will probably be a
  731.   lot simpler in practice to copy the inittab and /etc/rc.d directory
  732.   from your existing system, and prune the shell scripts in the rc.d
  733.   directory to remove processing not relevent to a diskette system
  734.   environment.
  735.  
  736.   3.4.2.  /bin
  737.  
  738.   Here is a convenient point to place the extra utilities you need to
  739.   perform basic operations, utilities such as ls, mv, cat, dd etc.
  740.  
  741.   See the section titled "Sample Boot/Root ls-lR Directory Listing" for
  742.   the list of files that I place in my boot/root /bin directory. You may
  743.   notice that it does not include any of the utilities required to
  744.   restore from backup, such as cpio, tar, gzip etc. That is because I
  745.   place these on a separate utility diskette, to save space on the
  746.   boot/root diskette. Once I have booted my boot/root diskette, it then
  747.   copies itself to the ramdisk leaving the diskette drive free to mount
  748.   another diskette, the utility diskette. I usually mount this as /usr.
  749.  
  750.   Creation of a utility diskette is described below in the section
  751.   titled "Adding Utility Diskettes".
  752.  
  753.   3.4.3.  /lib
  754.  
  755.   Two libraries are required to run many facilities under Linux:
  756.  
  757.   ╖  ld.so
  758.  
  759.   ╖  libc.so.4
  760.  
  761.   If they are not found in your /lib directory then the system will be
  762.   unable to boot. If you're lucky you may see an error message telling
  763.   you why.
  764.  
  765.   These should be present in you existing /lib directory. Note that
  766.   libc.so.4 may be a symlink to a libc library with version number in
  767.   the filename. If you issue the command:
  768.  
  769.                ls -l /lib
  770.  
  771.   you will see something like:
  772.  
  773.                libc.so.4 -> libc.so.4.5.21
  774.  
  775.   In this case, the libc library you want is libc.so.4.5.21.
  776.  
  777.   3.5.  LILO
  778.  
  779.   3.5.1.  Overview
  780.  
  781.   For the boot/root to be any use, it must be bootable. To achieve this,
  782.   the easiest way is to install a boot loader, which is a piece of
  783.   executable code stored at sector 0, cylinder 0 of the diskette. See
  784.   the section above titled "BOOT DISKETTE" for an overview of the boot
  785.   process.
  786.  
  787.   LILO is a tried and trusted boot loader available from any Linux
  788.   mirror site. It allows you to configure the boot loader, including:
  789.  
  790.   ╖  Which device is to be mounted as the root drive.
  791.  
  792.   ╖  Whether to use a ramdisk.
  793.  
  794.   3.5.2.  Sample LILO Configuration
  795.  
  796.   This provides a very convenient place to specify to the kernel how it
  797.   should boot. My root/boot LILO configuration file, used with LILO
  798.   0.15, is:
  799.  
  800.        ______________________________________________________________________
  801.        boot = /dev/fd0
  802.        install = ./mnt/boot.b
  803.        map = ./mnt/lilo.map
  804.        delay = 50
  805.        message = ./mnt/lilo.msg
  806.        timeout = 150
  807.        compact
  808.        image = ./mnt/zImage
  809.                ramdisk = 1440
  810.                root = /dev/fd0
  811.        ______________________________________________________________________
  812.  
  813.   Note that boot.b, lilo.msg and the kernel must first have been copied
  814.   to the diskette using a command similar to:
  815.  
  816.        ______________________________________________________________________
  817.        cp /boot/boot.b ./mnt
  818.        ______________________________________________________________________
  819.  
  820.   If this is not done, then LILO will not run correctly at boot time if
  821.   the hard disk is not available, and there is little point setting up a
  822.   rescue disk which requires a hard disk in order to boot.
  823.  
  824.   I run lilo using the command:
  825.  
  826.                /sbin/lilo -C <configfile>
  827.  
  828.   I run it from the directory containing the mnt directory where I have
  829.   mounted the diskette. This means that I am telling LILO to install a
  830.   boot loader on the boot device (/dev/fd0 in this case), to boot a
  831.   kernel in the root directory of the diskette.
  832.  
  833.   I have also specified that I want the root device to be the diskette,
  834.   and I want a ramdisk created of 1440 1K blocks, the same size as the
  835.   diskette. Since I have created an ext2 file system on the diskette,
  836.   this completes all the conditions required for Linux to automatically
  837.   switch the root device to the ramdisk, and copy the diskette contents
  838.   there as well.
  839.  
  840.   The ramdisk features of Linux are described further in the section
  841.   above titled "RAM DISKS AND BOOT/ROOT SYSTEMS".
  842.  
  843.   It is also worth considering using the "single" parameter to cause
  844.   Linux to boot in single-user mode. This could be useful to prevent
  845.   users logging in on serial ports.
  846.  
  847.   I also use the "DELAY" "MESSAGE" and "TIMEOUT" statements so that when
  848.   I boot the disk, LILO will give me the opportunity to enter command
  849.   line options if I wish. I don't need them at present, but I never know
  850.   when I might want to set a different root device or mount a filesystem
  851.   read-only.
  852.  
  853.   The message file I use contains the message:
  854.  
  855.        Linux Boot/Root Diskette
  856.        ========================
  857.  
  858.        Enter a command line of the form:
  859.  
  860.              zImage [ command-line options]
  861.  
  862.        If nothing is entered, linux will be loaded with
  863.        defaults after 15 seconds.
  864.  
  865.   This is simply a reminder to myself what my choices are.
  866.  
  867.   Readers are urged to read the LILO documentation carefully before
  868.   atttempting to install anything. It is relatively easy to destroy
  869.   partitions if you use the wrong "boot = " parameter. If you are
  870.   inexperienced, do NOT run LILO until you are sure you understand it
  871.   and you have triple-checked your parameters.
  872.  
  873.   Note that you must re-run LILO every time you change the kernel, so
  874.   that LILO can set up its map file to correctly describe the new kernel
  875.   file. It is in fact possible to replace the kernel file with one which
  876.   is almost identical without rerunning LILO, but it is far better not
  877.   to gamble - if you change the kernel, re-run LILO.
  878.  
  879.   3.5.3.  Removing LILO
  880.  
  881.   One other thing I might as well add here while I'm on the LILO topic:
  882.   if you mess up lilo on a drive containing DOS, you can always replace
  883.   the boot sector with the DOS boot loader by issuing the DOS command:
  884.  
  885.                FDISK /MBR
  886.  
  887.   where MBR stands for "Master Boot Record". Note that some purists
  888.   disagree with this, and they may have grounds, but it works.
  889.  
  890.   3.5.4.  Useful LILO Options
  891.  
  892.   LILO has several useful options which are worth keeping in mind when
  893.   building boot disks:
  894.  
  895.   ╖  Command line options - you can enter command line options to set
  896.      the root device, ramdisk size, special device parameters, or other
  897.      things. If you include the DELAY = nn statement in your LILO
  898.      configuration file, then LILO will pause to allow you to select a
  899.      kernel image to boot, and to enter, on the same line, any options.
  900.      For example:
  901.  
  902.                zImage aha152x=0x340,11,3,1 ro
  903.  
  904.   will pass the aha152x parameters through to the aha152x scsi disk
  905.   driver (provided that driver has been included when the kernel was
  906.   built) and will ask for the root filesystem to be mounted read-only.
  907.  
  908.   ╖  Command line "lock" option - this option asks LILO to store the
  909.      command line entered as the default command line to be used for all
  910.      future boots. This is particularly useful where you have a device
  911.      which cannot be autoselected. By using "lock" you can avoid having
  912.      to type in the device parameter string every time you boot.  For
  913.      example:
  914.  
  915.                zImage aha152x=0x340,11,3,1 root=/dev/sda8 ro lock
  916.  
  917.   ╖  APPEND configuration statement - this allows device parameter
  918.      strings to be stored in the configuration, as an alternative to
  919.      using the "lock" command line option. Note that any keywords of the
  920.      form word=value MUST be enclosed in quotes. For example:
  921.  
  922.                APPEND = "aha152x=0x340,11,3,1"
  923.  
  924.   ╖  DELAY configuration statement - this pauses for DELAY tenths of
  925.      seconds and allows the user to interrupt the automatic boot of the
  926.      default command line, so that the user can enter an alternate
  927.      command line.
  928.  
  929.   4.  Samples
  930.  
  931.   4.1.  Disk Directory Listings
  932.  
  933.   This lists the contents of directories from my root and utility
  934.   diskettes. These lists are provided as an example only of the files
  935.   included to create a working system. The disks were created using the
  936.   Bootkit package, which copies to diskette only those files that you
  937.   want copied.
  938.  
  939.   4.1.1.  Root Disk ls-lR Directory Listing
  940.  
  941.   The root listing is of a diskette mounted at /mnt.
  942.  
  943.   total 27
  944.   drwx------   2 root     root         1024 Jun 11 23:23 bin/
  945.   drwxr-xr-x   2 root     root         3072 Jun 11 23:24 dev/
  946.   drwxr-xr-x   3 root     root         1024 May 30 06:38 etc/
  947.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 home/
  948.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 lib/
  949.   drwxr-xr-x   2 root     root        12288 Jun 11 23:23 lost+found/
  950.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 mnt/
  951.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 proc/
  952.   drwxr-xr-x   2 root     root         1024 May 30 05:56 root/
  953.   drwxr-xr-x   2 root     root         1024 Jun  3 23:39 sbin/
  954.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 tmp/
  955.   drwxr-xr-x   3 root     root         1024 May 30 05:48 usr/
  956.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 util/
  957.   drwxr-xr-x   5 root     root         1024 May 30 05:58 var/
  958.  
  959.   /mnt/bin:
  960.   total 664
  961.   -rwxr-xr-x   1 root     root       222208 Sep  7  1992 bash*
  962.   -rwxr-xr-x   1 root     other        4376 Sep  8  1992 cat*
  963.   -rwxr-xr-x   1 root     other        5088 Sep  4  1992 chmod*
  964.   -rwxr-xr-x   1 root     other        4024 Sep  4  1992 chown*
  965.   -rwxr-xr-x   1 root     other       12104 Sep  4  1992 cp*
  966.   -rwxr-xr-x   1 root     other        4376 Sep  5  1992 cut*
  967.   -rwxr-xr-x   1 root     other        7592 Sep  4  1992 dd*
  968.   -rwxr-xr-x   1 root     other        4656 Sep  4  1992 df*
  969.   -rwxr-xr-x   1 root     root        37892 May  5  1994 e2fsck*
  970.   -rwx--x--x   1 root     root        14396 Sep 20  1992 fdisk*
  971.   -r-x--x--x   1 bin      bin          3536 Feb 19 19:14 hostname*
  972.   -rwxr-xr-x   1 root     other        5292 Sep  4  1992 ln*
  973.   -rws--x--x   1 root     root        24352 Jan 16  1993 login*
  974.   -rwxr-xr-x   1 root     other        4104 Sep  4  1992 mkdir*
  975.   -rwxr-xr-x   1 root     root        21508 May  5  1994 mke2fs*
  976.   -rwxr-xr-x   1 root     other        3336 Sep  4  1992 mknod*
  977.   -rwx--x--x   1 root     root         2432 Sep 20  1992 mkswap*
  978.   -rwxr-xr-x   1 root     root         9596 Jun 10 22:12 mount*
  979.   -rwxr-xr-x   1 root     other        6724 Sep  4  1992 mv*
  980.   -rwxr-xr-x   1 root     root        11132 Apr 10  1993 ps*
  981.   -rwxr-xr-x   1 root     other        5056 Sep  4  1992 rm*
  982.   -rwxr-xr-x   1 root     root       222208 Sep  7  1992 sh*
  983.   -rws--x--x   1 root     root        16464 Jan 16  1993 su*
  984.   -rwxr-xr-x   1 root     root         1204 Sep 17  1992 sync*
  985.   -rwxr-xr-x   1 root     root         6188 Apr 17  1993 umount*
  986.  
  987.   /mnt/dev:
  988.   total 72
  989.   -rwxr-xr-x   1 root     root         8331 Mar 14  1993 MAKEDEV*
  990.   lrwxrwxrwx   1 root     root            4 Jun 11 23:24 console -> tty0
  991.   crw-rw-rw-   1 root     tty        5,  64 Apr  1  1993 cua0
  992.   crw-rw-rw-   1 root     tty        5,  65 Mar 19 19:35 cua1
  993.   crw-rw-rw-   1 root     tty        5,  66 Apr 10  1993 cua2
  994.   crw-rw-rw-   1 root     tty        5,  67 Apr 10  1993 cua3
  995.   brw-r--r--   1 root     root       2,   0 Aug 29  1992 fd0
  996.   brw-r--r--   1 root     root       2,  12 Aug 29  1992 fd0D360
  997.   brw-r--r--   1 root     root       2,  16 Aug 29  1992 fd0D720
  998.   brw-r--r--   1 root     root       2,  28 Aug 29  1992 fd0H1440
  999.   brw-r--r--   1 root     root       2,  12 Aug 29  1992 fd0H360
  1000.   brw-r--r--   1 root     root       2,  16 Aug 29  1992 fd0H720
  1001.   brw-r--r--   1 root     root       2,   4 Aug 29  1992 fd0d360
  1002.   brw-r--r--   1 root     root       2,   8 Jan 15  1993 fd0h1200
  1003.   brw-r--r--   1 root     root       2,  20 Aug 29  1992 fd0h360
  1004.   brw-r--r--   1 root     root       2,  24 Aug 29  1992 fd0h720
  1005.   brw-r--r--   1 root     root       2,   1 Aug 29  1992 fd1
  1006.   brw-r--r--   1 root     root       2,  13 Aug 29  1992 fd1D360
  1007.   brw-r--r--   1 root     root       2,  17 Aug 29  1992 fd1D720
  1008.   brw-r--r--   1 root     root       2,  29 Aug 29  1992 fd1H1440
  1009.   brw-r--r--   1 root     root       2,  13 Aug 29  1992 fd1H360
  1010.   brw-r--r--   1 root     root       2,  17 Aug 29  1992 fd1H720
  1011.   brw-r--r--   1 root     root       2,   5 Aug 29  1992 fd1d360
  1012.   brw-r--r--   1 root     root       2,   9 Aug 29  1992 fd1h1200
  1013.   brw-r--r--   1 root     root       2,  21 Aug 29  1992 fd1h360
  1014.   brw-r--r--   1 root     root       2,  25 Aug 29  1992 fd1h720
  1015.   brw-r-----   1 root     root       3,   0 Aug 29  1992 hda
  1016.   brw-r-----   1 root     root       3,   1 Aug 29  1992 hda1
  1017.   brw-r-----   1 root     root       3,   2 Aug 29  1992 hda2
  1018.   brw-r-----   1 root     root       3,   3 Aug 29  1992 hda3
  1019.   brw-r-----   1 root     root       3,   4 Aug 29  1992 hda4
  1020.   brw-r-----   1 root     root       3,   5 Aug 29  1992 hda5
  1021.   brw-r-----   1 root     root       3,   6 Aug 29  1992 hda6
  1022.   brw-r-----   1 root     root       3,   7 Aug 29  1992 hda7
  1023.   brw-r-----   1 root     root       3,   8 Aug 29  1992 hda8
  1024.   brw-r-----   1 root     root       3,  64 Aug 29  1992 hdb
  1025.   brw-r-----   1 root     root       3,  65 Aug 29  1992 hdb1
  1026.   brw-r-----   1 root     root       3,  66 Aug 29  1992 hdb2
  1027.   brw-r-----   1 root     root       3,  67 Aug 29  1992 hdb3
  1028.   brw-r-----   1 root     root       3,  68 Aug 29  1992 hdb4
  1029.   brw-r-----   1 root     root       3,  69 Aug 29  1992 hdb5
  1030.   brw-r-----   1 root     root       3,  70 Aug 29  1992 hdb6
  1031.   brw-r-----   1 root     root       3,  71 Aug 29  1992 hdb7
  1032.   brw-r-----   1 root     root       3,  72 Aug 29  1992 hdb8
  1033.   crw-r-----   1 root     kmem       1,   2 Aug 29  1992 kmem
  1034.   crw-rw-rw-   1 root     root       6,   0 Aug 29  1992 lp0
  1035.   crw-rw-rw-   1 root     root       6,   1 Aug 29  1992 lp1
  1036.   crw-rw-rw-   1 root     root       6,   2 Aug 29  1992 lp2
  1037.   crw-r-----   1 root     sys        1,   1 Aug 29  1992 mem
  1038.   lrwxrwxrwx   1 root     root            4 Jun 11 23:24 mouse -> cua1
  1039.   crw-rw-rw-   1 root     root      27,   4 Jul 31  1994 nrft0
  1040.   crw-rw-rw-   1 root     root      27,   5 Jul 31  1994 nrft1
  1041.   crw-rw-rw-   1 root     root      27,   6 Jul 31  1994 nrft2
  1042.   crw-rw-rw-   1 root     root      27,   7 Jul 31  1994 nrft3
  1043.   crw-------   1 root     root       9, 128 Jan 23  1993 nrmt0
  1044.   crw-rw-rw-   1 root     root       1,   3 Aug 29  1992 null
  1045.   crw-r-----   1 root     root       6,   0 Aug 29  1992 par0
  1046.   crw-r-----   1 root     root       6,   1 Aug 29  1992 par1
  1047.   crw-r-----   1 root     root       6,   2 Aug 29  1992 par2
  1048.   crw-r-----   1 root     root       1,   4 Aug 29  1992 port
  1049.   crw-rw-rw-   1 root     root       4, 128 Jun 10 00:10 ptyp0
  1050.   crw-rw-rw-   1 root     root       4, 129 Apr 10 14:51 ptyp1
  1051.   crw-rw-rw-   1 root     root       4, 130 Aug 21  1994 ptyp2
  1052.   crw-rw-rw-   1 root     root       4, 131 Apr 12  1993 ptyp3
  1053.   crw-rw-rw-   1 root     tty        4, 132 Jan  3  1993 ptyp4
  1054.   crw-rw-rw-   1 root     tty        4, 133 Jan  3  1993 ptyp5
  1055.   crw-rw-rw-   1 root     tty        4, 134 Jan  3  1993 ptyp6
  1056.   crw-rw-rw-   1 root     tty        4, 135 Jan  3  1993 ptyp7
  1057.   crw-rw-rw-   1 root     tty        4, 136 Jan  3  1993 ptyp8
  1058.   crw-rw-rw-   1 root     tty        4, 137 Jan  3  1993 ptyp9
  1059.   crw-rw-rw-   1 root     tty        4, 138 Jan  3  1993 ptypa
  1060.   crw-rw-rw-   1 root     tty        4, 139 Jan  3  1993 ptypb
  1061.   crw-rw-rw-   1 root     tty        4, 140 Jan  3  1993 ptypc
  1062.   crw-rw-rw-   1 root     tty        4, 141 Jan  3  1993 ptypd
  1063.   crw-rw-rw-   1 root     tty        4, 142 Jan  3  1993 ptype
  1064.   crw-rw-rw-   1 root     tty        4, 143 Jan  3  1993 ptypf
  1065.   brw-rw----   1 root     root       1,   0 Jun  8 18:49 ram
  1066.   crw-rw-rw-   1 root     root      27,   0 Jul 31  1994 rft0
  1067.   crw-rw-rw-   1 root     root      27,   1 Jul 31  1994 rft1
  1068.   crw-rw-rw-   1 root     root      27,   2 Jul 31  1994 rft2
  1069.   crw-rw-rw-   1 root     root      27,   3 Jul 31  1994 rft3
  1070.   crw-------   1 root     root       9,   0 Jan 23  1993 rmt0
  1071.   brw-r-----   1 root     root       8,   0 Aug 29  1992 sda
  1072.   brw-r-----   1 root     root       8,   1 Aug 29  1992 sda1
  1073.   brw-r-----   1 root     root       8,   2 Aug 29  1992 sda2
  1074.   brw-r-----   1 root     root       8,   3 Aug 29  1992 sda3
  1075.   brw-r-----   1 root     root       8,   4 Aug 29  1992 sda4
  1076.   brw-r-----   1 root     root       8,   5 Aug 29  1992 sda5
  1077.   brw-r-----   1 root     root       8,   6 Aug 29  1992 sda6
  1078.   brw-r-----   1 root     root       8,   7 Aug 29  1992 sda7
  1079.   brw-r-----   1 root     root       8,   8 Aug 29  1992 sda8
  1080.   brw-r-----   1 root     root       8,  16 Aug 29  1992 sdb
  1081.   brw-r-----   1 root     root       8,  17 Aug 29  1992 sdb1
  1082.   brw-r-----   1 root     root       8,  18 Aug 29  1992 sdb2
  1083.   brw-r-----   1 root     root       8,  19 Aug 29  1992 sdb3
  1084.   brw-r-----   1 root     root       8,  20 Aug 29  1992 sdb4
  1085.   brw-r-----   1 root     root       8,  21 Aug 29  1992 sdb5
  1086.   brw-r-----   1 root     root       8,  22 Aug 29  1992 sdb6
  1087.   brw-r-----   1 root     root       8,  23 Aug 29  1992 sdb7
  1088.   brw-r-----   1 root     root       8,  24 Aug 29  1992 sdb8
  1089.   brw-------   1 bin      bin        8,  32 Jun 30  1992 sdc
  1090.   brw-------   1 bin      bin        8,  33 Jun 30  1992 sdc1
  1091.   brw-------   1 bin      bin        8,  34 Jun 30  1992 sdc2
  1092.   brw-------   1 bin      bin        8,  35 Jun 30  1992 sdc3
  1093.   brw-------   1 bin      bin        8,  36 Jun 30  1992 sdc4
  1094.   brw-------   1 bin      bin        8,  37 Jun 30  1992 sdc5
  1095.   brw-------   1 bin      bin        8,  38 Jun 30  1992 sdc6
  1096.   brw-------   1 bin      bin        8,  39 Jun 30  1992 sdc7
  1097.   brw-------   1 bin      bin        8,  40 Jun 30  1992 sdc8
  1098.   brw-------   1 bin      bin        8,  48 Jun 30  1992 sdd
  1099.   brw-------   1 bin      bin        8,  49 Jun 30  1992 sdd1
  1100.   brw-------   1 bin      bin        8,  50 Jun 30  1992 sdd2
  1101.   brw-------   1 bin      bin        8,  51 Jun 30  1992 sdd3
  1102.   brw-------   1 bin      bin        8,  52 Jun 30  1992 sdd4
  1103.   brw-------   1 bin      bin        8,  53 Jun 30  1992 sdd5
  1104.   brw-------   1 bin      bin        8,  54 Jun 30  1992 sdd6
  1105.   brw-------   1 bin      bin        8,  55 Jun 30  1992 sdd7
  1106.   brw-------   1 bin      bin        8,  56 Jun 30  1992 sdd8
  1107.   brw-------   1 bin      bin        8,  64 Jun 30  1992 sde
  1108.   brw-------   1 bin      bin        8,  65 Jun 30  1992 sde1
  1109.   brw-------   1 bin      bin        8,  66 Jun 30  1992 sde2
  1110.   brw-------   1 bin      bin        8,  67 Jun 30  1992 sde3
  1111.   brw-------   1 bin      bin        8,  68 Jun 30  1992 sde4
  1112.   brw-------   1 bin      bin        8,  69 Jun 30  1992 sde5
  1113.   brw-------   1 bin      bin        8,  70 Jun 30  1992 sde6
  1114.   brw-------   1 bin      bin        8,  71 Jun 30  1992 sde7
  1115.   brw-------   1 bin      bin        8,  72 Jun 30  1992 sde8
  1116.   crw-rw-rw-   1 root     root       5,   0 Apr 16  1994 tty
  1117.   crw-rw-rw-   1 grahamc  other      4,   0 Jun 11 23:21 tty0
  1118.   crw--w--w-   1 root     root       4,   1 Jun 11 23:23 tty1
  1119.   crw-rw-rw-   1 root     root       4,   2 Jun 11 23:21 tty2
  1120.   crw-rw-rw-   1 root     root       4,   3 Jun 11 23:21 tty3
  1121.   crw-rw-rw-   1 root     other      4,   4 Jun 11 23:21 tty4
  1122.   crw-rw-rw-   1 root     other      4,   5 Jun 11 23:21 tty5
  1123.   crw-rw-rw-   1 root     root       4,   6 Jun 11 23:21 tty6
  1124.   crw--w--w-   1 grahamc  other      4,   7 Apr 15  1993 tty7
  1125.   crw--w--w-   1 root     root       4,   8 Apr 15  1993 tty8
  1126.   crw-rw-rw-   1 root     root       4,  64 Mar 30  1993 ttyS0
  1127.   crw-rw-rw-   1 root     users      4,  65 Mar 31  1993 ttyS1
  1128.   crw-rw-rw-   1 root     root       4,  66 Jan 23  1980 ttyS2
  1129.   crw-rw-rw-   1 root     root       4, 192 Jun 10 00:10 ttyp0
  1130.   crw-rw-rw-   1 root     root       4, 193 Apr 10 14:51 ttyp1
  1131.   crw-rw-rw-   1 root     root       4, 194 Aug 21  1994 ttyp2
  1132.   crw-rw-rw-   1 root     root       4, 195 Apr 12  1993 ttyp3
  1133.   crw-rw-rw-   1 root     tty        4, 196 Jan  3  1993 ttyp4
  1134.   crw-rw-rw-   1 root     tty        4, 197 Jan  3  1993 ttyp5
  1135.   crw-rw-rw-   1 root     tty        4, 198 Jan  3  1993 ttyp6
  1136.   crw-rw-rw-   1 root     tty        4, 199 Jan  3  1993 ttyp7
  1137.   crw-rw-rw-   1 root     tty        4, 200 Jan  3  1993 ttyp8
  1138.   crw-rw-rw-   1 root     tty        4, 201 Jan  3  1993 ttyp9
  1139.   crw-rw-rw-   1 root     tty        4, 202 Jan  3  1993 ttypa
  1140.   crw-rw-rw-   1 root     tty        4, 203 Jan  3  1993 ttypb
  1141.   crw-rw-rw-   1 root     tty        4, 204 Jan  3  1993 ttypc
  1142.   crw-rw-rw-   1 root     tty        4, 205 Jan  3  1993 ttypd
  1143.   crw-rw-rw-   1 root     tty        4, 206 Jan  3  1993 ttype
  1144.   crw-rw-rw-   1 root     tty        4, 207 Jan  3  1993 ttypf
  1145.   -rw-------   1 root     root        63488 Mar 14  1993 ttys0
  1146.   crw-rw-rw-   1 root     root       4,  67 Oct 14  1992 ttys3
  1147.   crw-r--r--   1 root     root       1,   5 Aug 29  1992 zero
  1148.  
  1149.   /mnt/etc:
  1150.   total 108
  1151.   -rw-r--r--   1 root     root           94 May 30 06:15 fstab
  1152.   -rwx------   1 root     root        25604 Mar 17  1993 getty*
  1153.   -rw-------   1 root     root          566 Dec 30  1992 gettydefs
  1154.   -rw-rw-r--   1 root     shadow        321 Oct  3  1994 group
  1155.   -rwxr-xr-x   1 bin      bin          9220 Mar 17  1993 halt*
  1156.   -rw-r--r--   1 root     root           26 Feb 19 19:07 host.conf
  1157.   -rw-r--r--   1 root     root          506 Feb 19 19:07 hosts
  1158.   -rwxr-xr-x   1 bin      bin         17412 Mar 17  1993 init*
  1159.   -rw-r--r--   1 root     root         1354 Jun  3 23:42 inittab
  1160.   -rwxr-xr-x   1 root     root         1478 Mar 17 18:29 issue*
  1161.   -rw-rw----   1 root     shadow       5137 Dec  4  1992 login.defs
  1162.   -rw-r--r--   1 sysadmin bin            42 Mar 17 18:30 motd
  1163.   -rw-r--r--   1 root     shadow        525 Jun 11 23:24 passwd
  1164.   -rwxr-xr-x   1 root     root         1476 Aug 17  1994 profile*
  1165.   -rw-r--r--   1 root     root          715 Feb 19 19:02 protocols
  1166.   drwxr-xr-x   2 root     root         1024 May 30 06:05 rc.d/
  1167.   -rwxr-xr-x   1 bin      bin          9220 Mar 17  1993 reboot*
  1168.   -r--r--r--   1 bin      bin            57 Nov 28  1992 securetty
  1169.   -rw-r--r--   1 root     root         3316 Feb 19 19:01 services
  1170.   -rwxr-xr-x   1 bin      bin         13316 Mar 17  1993 shutdown*
  1171.   -rwxr-xr-x   1 root     root         3212 Apr 17  1993 swapoff*
  1172.   -rwxr-xr-x   1 root     root         3212 Apr 17  1993 swapon*
  1173.   -rw-r--r--   1 root     root          817 Jun 11 23:23 termcap
  1174.   -rwxr-xr-x   1 root     root         6188 Apr 17  1993 umount*
  1175.   -rw-r--r--   1 root     root        12264 Jun 11 23:22 utmp
  1176.   -rw-r--r--   1 root     root           56 Jun 11 23:22 wtmp
  1177.  
  1178.   /mnt/etc/rc.d:
  1179.   total 4
  1180.   -rwxr-xr--   1 root     root          450 May 30 06:05 rc.0*
  1181.   -rwxr-xr--   1 root     root          390 May 30 06:05 rc.K*
  1182.   -rwxr-xr--   1 root     root          683 May 30 06:06 rc.M*
  1183.   -rwxr-xr--   1 root     root          498 Jun 11 18:44 rc.S*
  1184.  
  1185.   /mnt/home:
  1186.   total 0
  1187.  
  1188.   /mnt/lib:
  1189.   total 287
  1190.   -rwxr-xr-x   1 root     root        17412 Jun 11 23:24 ld.so*
  1191.   lrwxrwxrwx   1 root     root           14 Jun 11 23:24 libc.so.4 -> libc.so.4.5.21*
  1192.   -rwxr-xr-x   1 root     root       623620 May 22  1994 libc.so.4.5.21*
  1193.  
  1194.   /mnt/lost+found:
  1195.   total 0
  1196.  
  1197.   /mnt/mnt:
  1198.   total 0
  1199.  
  1200.   /mnt/proc:
  1201.   total 0
  1202.  
  1203.   /mnt/root:
  1204.   total 0
  1205.  
  1206.   /mnt/sbin:
  1207.   total 15
  1208.   -rwxr-xr-x   1 root     root        16885 Jun 13  1994 update*
  1209.  
  1210.   /mnt/tmp:
  1211.   total 0
  1212.  
  1213.   /mnt/usr:
  1214.   total 1
  1215.   drwxr-xr-x   2 root     root         1024 May 30 05:49 bin/
  1216.  
  1217.   /mnt/usr/bin:
  1218.   total 217
  1219.   -rwxr-xr-x   1 root     root         1560 Sep 17  1992 basename*
  1220.   -rws--x--x   1 root     root         8232 Jan 16  1993 chsh*
  1221.   -rwxr-xr-x   1 root     root         1308 Jan 23  1980 clear*
  1222.   -rwxr-xr-x   1 root     other       91136 Sep  4  1992 elvis*
  1223.   -rwxr-xr-x   1 root     root        13252 Sep 17  1992 ls*
  1224.   -rwxr-xr-x   1 bin      bin         21504 Oct  2  1992 more*
  1225.   -rwxr-xr-x   1 root     other       91136 Sep  4  1992 vi*
  1226.  
  1227.   /mnt/util:
  1228.   total 0
  1229.  
  1230.   /mnt/var:
  1231.   total 3
  1232.   drwxr-xr-x   2 root     root         1024 May 30 05:58 adm/
  1233.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 logs/
  1234.   drwxr-xr-x   2 root     root         1024 Jun 11 23:24 run/
  1235.  
  1236.   /mnt/var/adm:
  1237.   total 0
  1238.   -rw-r--r--   1 root     root            0 May 30 05:58 utmp
  1239.   -rw-r--r--   1 root     root            0 May 30 05:58 wtmp
  1240.  
  1241.   /mnt/var/logs:
  1242.   total 0
  1243.  
  1244.   /mnt/var/run:
  1245.   total 0
  1246.  
  1247.   4.1.2.  Utility Disk ls-lR Directory Listing
  1248.  
  1249.   The utility listing is of a diskette mounted at /mnt.
  1250.  
  1251.   total 15
  1252.   drwx------   2 root     root         1024 Jun 18 19:57 bin/
  1253.   drwxr-xr-x   2 root     root        12288 Jun 18 19:57 lost+found/
  1254.   drwx------   2 root     root         1024 Jun 18 19:57 sbin/
  1255.   drwxr-xr-x   4 root     root         1024 May  5 16:30 usr/
  1256.  
  1257.   /mnt/bin:
  1258.   total 13
  1259.   -rwxr-xr-x   1 root     root         3180 Apr 10  1993 free*
  1260.   -rwxr-xr-x   1 root     root        10687 Feb 10  1994 pwd*
  1261.   -rwx--x--x   1 root     root         3672 Nov 17  1992 rdev*
  1262.  
  1263.   /mnt/lost+found:
  1264.   total 0
  1265.  
  1266.   /mnt/sbin:
  1267.   total 18
  1268.   -rwxr-xr-x   1 root     root        16336 Jun 18 14:31 insmod*
  1269.   -rwxr-xr-x   1 root     root           68 Jun 18 14:31 lsmod*
  1270.   lrwxrwxrwx   1 root     root            6 Jun 18 19:57 rmmod -> insmod*
  1271.  
  1272.   /mnt/usr:
  1273.   total 2
  1274.   drwx------   2 root     root         1024 Jun 18 19:57 bin/
  1275.   drwxr-xr-x   3 root     root         1024 Jun 18 19:57 local/
  1276.  
  1277.   /mnt/usr/bin:
  1278.   total 411
  1279.   -rwxr-xr-x   1 root     bin        111616 Sep  9  1992 awk*
  1280.   -rwxr-xr-x   1 root     root        41984 Dec 23  1992 cpio*
  1281.   -rwxr-xr-x   1 root     root        50176 Dec 23  1992 find*
  1282.   -rwxr-xr-x   1 root     root       115712 Sep 17  1992 gawk*
  1283.   -rwxr-xr-x   1 root     bin         37888 Sep  4  1992 grep*
  1284.   -rwxr-xr-x   1 root     root        63874 May  1  1994 gzip*
  1285.   -rwxr-xr-x   1 root     root         2044 Sep 17  1992 kill*
  1286.   -rwx--x--x   1 root     root         3132 Jan 24  1993 mt*
  1287.   -rwxr-xr-x   1 root     root         3416 Sep 22  1992 strings*
  1288.   -rwxr-xr-x   1 root     other        3848 Sep  4  1992 who*
  1289.  
  1290.   /mnt/usr/local:
  1291.   total 1
  1292.   drwx------   2 root     root         1024 Jun 18 19:57 bin/
  1293.  
  1294.   /mnt/usr/local/bin:
  1295.   total 374
  1296.   -rwxr-xr-x   1 root     root       155542 Jun 18 17:07 ftape.o*
  1297.   -rwxr-xr-x   1 root     root       226308 Jun 13  1994 tar*
  1298.  
  1299.   4.2.  Shell Scripts to Build Diskettes
  1300.  
  1301.   These shell scripts are provided as examples only. I no longer use
  1302.   them because I now use and recommend Scott Burkett's Bootkit package
  1303.   to manage rescue diskette contents and creation. Bootkit is based on
  1304.   these scripts, and does essentially the same thing, but it is much
  1305.   tidier, nicer and easier to use. However, the sample shell scripts
  1306.   here will still provide working diskettes.
  1307.  
  1308.   There are two shell scripts:
  1309.  
  1310.   ╖  mkroot - builds a root or boot/root diskette.
  1311.  
  1312.   ╖  mkutil - builds a utility diskette.
  1313.  
  1314.   Both are currently configured to run in the parent directory of
  1315.   boot_disk and util_disk, each of which contains everything to be
  1316.   copied to it's diskette. Note that these shell scripts will *NOT*
  1317.   automatically set up and copy all the files for you - you work out
  1318.   which files are needed, set up the directories and copy the files to
  1319.   those directories. The shell scripts are samples which will copy the
  1320.   contents of those directories. Note that they are primitive shell
  1321.   scripts and are not meant for the novice user.
  1322.  
  1323.   The scripts both contain configuration variables at the start which
  1324.   allow them to be easily configured to run anywhere.  First, set up the
  1325.   model directories and copy all the required files into them. To see
  1326.   what directories and files are needed, have a look at the sample
  1327.   directory listings in the previous sections.
  1328.  
  1329.   Check the configuration variables in the shell scripts and change them
  1330.   as required before running the scripts.
  1331.  
  1332.   4.2.1.  mkroot - Make Root or Boot/Root Diskette
  1333.  
  1334.   ______________________________________________________________________
  1335.   # mkroot: make a boot/boot disk - creates a boot/root diskette
  1336.   #       by building a file system on it, then mounting it and
  1337.   #       copying required files from a model.
  1338.   #       Note: the model to copy from from must dirst be set up,
  1339.   #       then change the configuration variables below to suit
  1340.   #       your system.
  1341.   #
  1342.   # usage: mkroot [nokernel]
  1343.   #       if the parameter is omitted, then the kernel and LILO
  1344.   #       are copied.
  1345.  
  1346.   # Copyright (c) Graham Chapman 1995. All rights reserved.
  1347.   # Permission is granted for this material to be freely
  1348.   # used and distributed, provided the source is acknowledged.
  1349.   # No warranty of any kind is provided. You use this material
  1350.   # at your own risk.
  1351.  
  1352.   # Configuration variables...
  1353.   BOOTDISKDIR=./boot_disk       # name of boot disk directory
  1354.   MOUNTPOINT=./mnt              # temporary mount point for diskette
  1355.   LILODIR=/sbin                 # directory containing lilo
  1356.   LILOBOOT=/boot/boot.b         # lilo boot sector
  1357.   LILOMSG=./lilo.msg            # lilo message to display at boot time
  1358.   LILOCONFIG=./lilo.conf        # lilo parms for boot/root diskette
  1359.   DISKETTEDEV=/dev/fd0          # device name of diskette drive
  1360.  
  1361.   echo $0: create boot/root diskette
  1362.   echo Warning: data on diskette will be overwritten!
  1363.   echo Insert diskette in $DISKETTEDEV and and press any key...
  1364.   read anything
  1365.  
  1366.   mke2fs $DISKETTEDEV
  1367.   if [ $? -ne 0 ]
  1368.   then
  1369.           echo mke2fs failed
  1370.           exit
  1371.   fi
  1372.  
  1373.   mount -t ext2 $DISKETTEDEV $MOUNTPOINT
  1374.   if [ $? -ne 0 ]
  1375.   then
  1376.           echo mount failed
  1377.           exit
  1378.   fi
  1379.  
  1380.   # copy the directories containing files
  1381.   for i in bin etc lib
  1382.   do
  1383.           cp -dpr $BOOTDISKDIR/$i $MOUNTPOINT
  1384.   done
  1385.  
  1386.   # copy dev *without* trying to copy the files in it
  1387.   cp -dpR $BOOTDISKDIR/dev $MOUNTPOINT
  1388.  
  1389.   # create empty directories required
  1390.   mkdir $MOUNTPOINT/proc
  1391.   mkdir $MOUNTPOINT/tmp
  1392.   mkdir $MOUNTPOINT/mnt
  1393.   mkdir $MOUNTPOINT/usr
  1394.  
  1395.   # copy the kernel
  1396.   if [ "$1" != "nokernel" ]
  1397.   then
  1398.           echo "Copying kernel"
  1399.           cp $BOOTDISKDIR/zImage $MOUNTPOINT
  1400.           echo kernel copied
  1401.  
  1402.           # setup lilo
  1403.           cp $LILOBOOT $MOUNTPOINT
  1404.           cp $LILOMSG $MOUNTPOINT
  1405.           $LILODIR/lilo -C $LILOCONFIG
  1406.           echo LILO installed
  1407.   fi
  1408.  
  1409.   umount $MOUNTPOINT
  1410.  
  1411.   echo Root diskette complete
  1412.   ______________________________________________________________________
  1413.  
  1414.   4.2.2.  mkutil - Make Utility Diskette
  1415.  
  1416.   ______________________________________________________________________
  1417.   # mkutil: make a utility diskette - creates a utility diskette
  1418.   #       by building a file system on it, then mounting it and
  1419.   #       copying required files from a model.
  1420.   #       Note: the model to copy from from must first be set up,
  1421.   #       then change the configuration variables below to suit
  1422.   #       your system.
  1423.  
  1424.   # Copyright (c) Graham Chapman 1995. All rights reserved.
  1425.   # Permission is granted for this material to be freely
  1426.   # used and distributed, provided the source is acknowledged.
  1427.   # No warranty of any kind is provided. You use this material
  1428.   # at your own risk.
  1429.  
  1430.   # Configuration variables...
  1431.   UTILDISKDIR=./util_disk       # name of directory containing model
  1432.   MOUNTPOINT=./mnt              # temporary mount point for diskette
  1433.   DISKETTEDEV=/dev/fd0          # device name of diskette drive
  1434.  
  1435.   echo $0: create utility diskette
  1436.   echo Warning: data on diskette will be overwritten!
  1437.   echo Insert diskette in $DISKETTEDEV and and press any key...
  1438.   read anything
  1439.  
  1440.   mke2fs $DISKETTEDEV
  1441.   if [ $? -ne 0 ]
  1442.   then
  1443.           echo mke2fs failed
  1444.           exit
  1445.   fi
  1446.  
  1447.   # Any file system type would do here
  1448.   mount -t ext2 $DISKETTEDEV $MOUNTPOINT
  1449.   if [ $? -ne 0 ]
  1450.   then
  1451.           echo mount failed
  1452.           exit
  1453.   fi
  1454.  
  1455.   # copy the directories containing files
  1456.   cp -dpr $UTILDISKDIR/bin $MOUNTPOINT
  1457.  
  1458.   umount $MOUNTPOINT
  1459.  
  1460.   echo Utility diskette complete
  1461.   ______________________________________________________________________
  1462.  
  1463.   5.  FAQ
  1464.  
  1465.   5.1.  Q. How can I make a boot disk with a XXX driver?
  1466.  
  1467.   The easiest way is to obtain a Slackware kernel from your nearest
  1468.   Slackware mirror site. Slackware kernels are generic kernels which
  1469.   atttempt to include drivers for as many devices as possible, so if you
  1470.   have a SCSI or IDE controller, chances are that a driver for it is
  1471.   included in the Slackware kernel.
  1472.  
  1473.   Go to the a1 directory and select either IDE or SCSI kernel depending
  1474.   on the type of controller you have. Check the xxxxkern.cfg file for
  1475.   the selected kernel to see the drivers which have been included in
  1476.   that kernel. If the device you want is in that list, then the
  1477.   corresponding kernel should boot your computer. Download the
  1478.   xxxxkern.tgz file and copy it to your boot diskette as described above
  1479.   in the section on making boot disks.
  1480.  
  1481.   You must then check the root device in the kernel, using the rdev
  1482.   command:
  1483.  
  1484.                rdev zImage
  1485.  
  1486.   Rdev will then display the current root device in the kernel. If this
  1487.   is not the same as the root device you want, then use rdev to change
  1488.   it.  For example, the kernel I tried was set to /dev/sda2, but my root
  1489.   scsi partition is /dev/sda8. To use a root diskette, you would have to
  1490.   use the command:
  1491.  
  1492.                rdev zImage /dev/fd0
  1493.  
  1494.   If you want to know how to set up a Slackware root disk as well,
  1495.   that's outside the scope of this HOWTO, so I suggest you check the
  1496.   Linux Install Guide or get the Slackware distribution. See the section
  1497.   in this HOWTO titled "References".
  1498.  
  1499.   5.2.  Q. How do I update my boot floppy with a new kernel?
  1500.  
  1501.   Just copy the kernel to your boot diskette using the dd command for a
  1502.   boot diskette without a filesystem, or the cp command for a boot/root
  1503.   disk. Refer to the section in this HOWTO titled "Boot" for details on
  1504.   creating a boot disk. The description applies equally to updating a
  1505.   kernel on a boot disk.
  1506.  
  1507.   5.3.  Q. How do I remove LILO so that I can use DOS to boot again?
  1508.  
  1509.   This is not really a Bootdisk topic, but it is asked so often, so: the
  1510.   answer is, use the DOS command:
  1511.  
  1512.                FDISK /MBR
  1513.  
  1514.   MBR stands for Master Boot Record, and it replaces the boot sector
  1515.   with a clean DOS one, without affecting the partition table. Some
  1516.   purists disagree with this, but even the author of LILO, Werner
  1517.   Almesberger, suggests it. It is easy, and it works.
  1518.  
  1519.   You can also use the dd command to copy the backup saved by LILO to
  1520.   the boot sector - refer to the LILO documentation if you wish to do
  1521.   this.
  1522.  
  1523.   5.4.  Q. How can I boot if I've lost my kernel AND my boot disk?
  1524.  
  1525.   If you don't have a boot disk standing by, then probably the easiest
  1526.   method is to obtain a Slackware kernel for your disk controller type
  1527.   (IDE or SCSI) as described above for "How do I make a boot disk with a
  1528.   XXX driver?". You can then boot your computer using this kernel, then
  1529.   repair whatever damage there is.
  1530.  
  1531.   The kernel you get may not have the root device set to the disk type
  1532.   and partition you want. For example, Slackware's generic scsi kernel
  1533.   has the root device set to /dev/sda2, whereas my root Linux partition
  1534.   happens to be /dev/sda8. In this case the root device in the kernel
  1535.   will have to be changed.
  1536.  
  1537.   You can still change the root device and ramdisk settings in the
  1538.   kernel even if all you have is a kernel, and some other operating
  1539.   system, such as DOS.
  1540.  
  1541.   Rdev changes kernel settings by changing the values at fixed offsets
  1542.   in the kernel file, so you can do the same if you have a hex editor
  1543.   available on whatever systems you do still have running - for example,
  1544.   Norton Utilities Disk Editor under DOS.  You then need to check and if
  1545.   necessary change the values in the kernel at the following offsets:
  1546.  
  1547.        0x01F8  Low byte of RAMDISK size
  1548.        0x01F9  High byte of RAMDISK size
  1549.        0x01FC  Root minor device number - see below
  1550.        0X01FD  Root major device number - see below
  1551.  
  1552.   The ramdisk size is the number of blocks of ramdisk to create.  If you
  1553.   want to boot from a root diskette then set this to decimal 1440, which
  1554.   is 0x05A0, thus set offset 0x01F8 to 0xA0 and offset 0x01F9 to 0x05.
  1555.   This will allocate enough space for a 1.4Mb diskette.
  1556.  
  1557.   The major and minor device numbers must be set to the device you want
  1558.   to mount your root filesystem on. Some useful values to select from
  1559.   are:
  1560.  
  1561.        device          major minor
  1562.        /dev/fd0            2     0   1st floppy drive
  1563.        /dev/hda1           3     1   partition 1 on 1st IDE drive
  1564.        /dev/sda1           8     1   partition 1 on 1st scsi drive
  1565.        /dev/sda8           8     8   partition 8 on 1st scsi drive
  1566.  
  1567.   Once you have set these values then you can write the file to a
  1568.   diskette using either Norton Utilities Disk Editor, or a program
  1569.   called rawrite.exe. This program is included in several distributions,
  1570.   including the SLS and Slackware distributions.  It is a DOS program
  1571.   which writes a file to the "raw" disk, starting at the boot sector,
  1572.   instead of writing it to the file system. If you use Norton Utilities,
  1573.   then you must write the file to a physical disk starting at the
  1574.   beginning of the disk.
  1575.  
  1576.   5.5.  Q. How can I make extra copies of boot/root diskettes?
  1577.  
  1578.   It is never desirable to have just one set of rescue disks - 2 or 3
  1579.   should be kept in case one is unreadable.
  1580.  
  1581.   The easiest way of making copies of any diskettes, including bootable
  1582.   and utility diskettes, is to use the dd command to copy the contents
  1583.   of the original diskette to a file on your hard drive, and then use
  1584.   the same command to copy the file back to a new diskette.  Note that
  1585.   you do not need to, and should not, mount the diskettes, because dd
  1586.   uses the raw device interface.
  1587.  
  1588.   To copy the original, enter the command:
  1589.  
  1590.                dd if=devicename of=filename
  1591.                where   devicename the device name of the diskette
  1592.                        drive
  1593.                and     filename the name of the file where you
  1594.                        want to copy to
  1595.  
  1596.   For example, to copy from /dev/fd0 to a temporary file called
  1597.   /tmp/diskette.copy, I would enter the command:
  1598.  
  1599.                dd if=/dev/fd0 of=/tmp/diskette.copy
  1600.  
  1601.   Omitting the "count" parameter, as we have done here, means that the
  1602.   whole diskette of 2880 (for a high-density) blocks will be copied.
  1603.  
  1604.   To copy the resulting file back to a new diskette, insert the new
  1605.   diskette and enter the reverse command:
  1606.  
  1607.                dd if=filename of=devicename
  1608.  
  1609.   Note that the above discussion assumes that you have only one diskette
  1610.   drive. If you have two of the same type, then you can copy diskettes
  1611.   using a command like:
  1612.  
  1613.                dd if=/dev/fd0 of=/dev/fd1
  1614.  
  1615.   5.6.  Q. How can I boot without typing in "ahaxxxx=nn,nn,nn" every
  1616.   time?
  1617.  
  1618.   Where a disk device cannot be autodetected it is necessary to supply
  1619.   the kernel with a command device parameter string, such as:
  1620.  
  1621.                aha152x=0x340,11,3,1
  1622.  
  1623.   This parameter string can be supplied in several ways using LILO:
  1624.  
  1625.   ╖  By entering it on the command line every time the system is booted
  1626.      via LILO. This is boring, though.
  1627.  
  1628.   ╖  By using the LILO "lock" keyword to make it store the command line
  1629.      as the default command line, so that LILO will use the same options
  1630.      every time it boots.
  1631.  
  1632.   ╖  By using the APPEND statement in the lilo config file. Note that
  1633.      the parameter string must be enclosed in quotes.
  1634.  
  1635.   For example, a sample command line using the above parameter string
  1636.   would be:
  1637.  
  1638.                zImage  aha152x=0x340,11,3,1 root=/dev/sda1 lock
  1639.  
  1640.   This would pass the device parameter string through, and also ask the
  1641.   kernel to set the root device to /dev/sda1 and save the whole command
  1642.   line and reuse it for all future boots.
  1643.  
  1644.   A sample APPEND statement is:
  1645.  
  1646.                APPEND = "aha152x=0x340,11,3,1"
  1647.  
  1648.   Note that the parameter string must NOT be enclosed in quotes on the
  1649.   command line, but it MUST be enclosed in quotes in the APPEND
  1650.   statement.
  1651.  
  1652.   Note also that for the parameter string to be acted on, the kernel
  1653.   must contain the driver for that disk type. If it does not, then there
  1654.   is nothing listening for the parameter string, and you will have to
  1655.   rebuild the kernel to include the required driver. For details on
  1656.   rebuilding the kernel, cd to /usr/src/linux and read the README, and
  1657.   read the Linux FAQ and Installation HOWTO. Alternatively you could
  1658.   obtain a generic kernel for the disk type and install that.
  1659.  
  1660.   Readers are strongly urged to read the LILO documentation before
  1661.   experimenting with LILO installation. Incautious use of the "BOOT"
  1662.   statement can damage partitions.
  1663.  
  1664.   5.7.  Q. How can I create an oversize ramdisk filesystem?
  1665.  
  1666.   An oversize ramdisk filesystem is a filesystem in a ramdisk larger
  1667.   than the size of the root disk it was loaded from. This can be
  1668.   extremely useful when using Ftape, which requires exclusive use of the
  1669.   floppy disk controller (see the Ftape HOWTO for details.)
  1670.  
  1671.   Two things are required: create an oversize file system on the root
  1672.   diskette, and then patch the kernel so that it will not try to load
  1673.   blocks off the end of the diskette.
  1674.  
  1675.   To create an oversize filesystem, two methods are possible:
  1676.  
  1677.   ╖  Use the "blocks" e2fsck parameter to specify the size of filesystem
  1678.      that you eventually want in the ramdisk. For example:
  1679.  
  1680.                mke2fs /dev/fd0 3000
  1681.  
  1682.   will create a filesystem on the diskette of 3000 1Kb blocks. The
  1683.   diskette only has 1440 blocks, but mke2fs does not care about this.
  1684.   E2fs will care about it if you try to use more than 1440 blocks of
  1685.   data (allowing for blocks used as inodes and reserved etc), but up to
  1686.   this point it is quite safe. You will soon find out if you try to load
  1687.   too much on the diskette because an I/O error will result.
  1688.  
  1689.   ╖  Create a partition on your hard disk as large as the filesystem you
  1690.      want on the ramdisk. Then create a filesystem on it and load in the
  1691.      files you want. Then use dd to copy only the first 1440 blocks to
  1692.      diskette, and then check that there was nothing in the uncopied
  1693.      part of the filesystem. For example:
  1694.  
  1695.                dd if=/dev/hdb of=/dev/fd0 bs=1024 count=1440
  1696.                dd if=/dev/hdb of=tailpart bs=1024 skip=1440
  1697.                cmp -l tailparm /dev/zero
  1698.  
  1699.   Of the two, I prefer the first method - it appears easier and safer.
  1700.  
  1701.   The second thing required to get an oversized filesystem is to get the
  1702.   kernel to stop loading at the end of the physical diskette when it
  1703.   tries to load the root diskette into ramdisk. To do this, a simple
  1704.   patch can be applied to the ramdisk driver, which should be found in
  1705.   /usr/src/linux/drivers/block/ramdisk.c. The following patch has been
  1706.   contributed by Bruce Elliot. It is for kernel version 1.2.0, but it
  1707.   should be fairly easy to apply to later versions. Even if the patch
  1708.   will not apply, the code is not complex, so the patch could easily be
  1709.   modified until it worked.
  1710.  
  1711.   =================================================================
  1712.   X--- ramdisk.c~ Mon Jan 23 13:04:09 1995
  1713.   X+++ ramdisk.c  Mon May 29 00:54:52 1995
  1714.   X@@ -113,6 +113,7 @@
  1715.   X               (struct ext2_super_block *)&sb;
  1716.   X       int             block, tries;
  1717.   X       int             i = 1;
  1718.   X+      int             fblocks;
  1719.   X       int             nblocks;
  1720.   X       char            *cp;
  1721.   X
  1722.   X@@ -168,12 +169,16 @@
  1723.   X                                       nblocks, rd_length >> BLOCK_SIZE_BITS);
  1724.   X                       return;
  1725.   X               }
  1726.   X-              printk("RAMDISK: Loading %d blocks into RAM disk", nblocks);
  1727.   X+              fblocks = blk_size[MAJOR(ROOT_DEV)][MINOR(ROOT_DEV)];
  1728.   X+              if (fblocks > nblocks)
  1729.   X+                      fblocks = nblocks;
  1730.   X+              printk("RAMDISK: Loading %d blocks into %d block filesystem "
  1731.   X+                                      "in RAM disk", fblocks, nblocks);
  1732.   X
  1733.   X               /* We found an image file system.  Load it into core! */
  1734.   X               cp = rd_start;
  1735.   X-              while (nblocks) {
  1736.   X-                      if (nblocks > 2)
  1737.   X+              while (fblocks) {
  1738.   X+                      if (fblocks > 2)
  1739.   X                               bh = breada(ROOT_DEV, block, BLOCK_SIZE, 0,  PAGE_SIZE);
  1740.   X                       else
  1741.   X                               bh = bread(ROOT_DEV, block, BLOCK_SIZE);
  1742.   X@@ -184,7 +189,7 @@
  1743.   X                       }
  1744.   X                       (void) memcpy(cp, bh->b_data, BLOCK_SIZE);
  1745.   X                       brelse(bh);
  1746.   X-                      if (!(nblocks-- & 15)) printk(".");
  1747.   X+                      if (!(fblocks-- & 15)) printk(".");
  1748.   X                       cp += BLOCK_SIZE;
  1749.   X                       block++;
  1750.   X                       i++;
  1751.   =================================================================
  1752.  
  1753.   With this patch, the kernel stops loading at the end of the physical
  1754.   diskette, leaving a filesystem larger than the disk.
  1755.  
  1756.   Some warnings: I have been able to create stable ramdisk filesystems
  1757.   in this fashion of 3500 blocks, but if I try 3600 or more then the
  1758.   kernel collapses with an error something like "fixup table corrupt".
  1759.   I have not been able to track down why, but obviously something is
  1760.   overflowing. Up to 3500 blocks, though, I have had no problems.
  1761.  
  1762.   5.8.  Q. At boot time, I get error A: cannot execute B. Why?
  1763.  
  1764.   There are several cases of program names being hardcoded in various
  1765.   utilities. These cases do not occur everywhere, but they may explain
  1766.   why an executable apparently cannot be found on your system even
  1767.   though you can see that it is there. You can find out if a given
  1768.   program has the name of another hardcoded by using the "strings"
  1769.   command and piping the output through grep.
  1770.  
  1771.   Known examples of hardcoding are:
  1772.  
  1773.   ╖  Shutdown in some versions has /etc/reboot hardcoded, so reboot must
  1774.      be placed in the /etc directory.
  1775.  
  1776.   ╖  Init has caused problems for at least one person, with the kernel
  1777.      being unable to find init.
  1778.  
  1779.      To fix these problems, either move the programs to the correct
  1780.      directory, or change configuration files (e.g. inittab) to point to
  1781.      the correct directory. If in doubt, put programs in the same
  1782.      directories as they are on your hard disk, and use the same inittab
  1783.      and /etc/rc.d files as they appear on your hard disk.
  1784.  
  1785.   6.  References
  1786.  
  1787.   In this section, vvv is used in package names in place of the version,
  1788.   to avoid referring here to specific versions. When retrieving a
  1789.   package, always get the latest version unless you have good reasons
  1790.   for not doing so.
  1791.  
  1792.   6.1.  LILO - Linux Loader
  1793.  
  1794.   Written by Werner Almesberger. Excellent boot loader, and the
  1795.   documentation includes information on the boot sector contents and the
  1796.   early stages of the boot process.
  1797.  
  1798.   Ftp from: tsx-11.mit.edu: /pub/linux/packages/lilo/lilo.vvv.tar.gz
  1799.   also on sunsite and mirror sites.
  1800.  
  1801.   6.2.  Linux FAQ and HOWTOs
  1802.  
  1803.   These are available from many sources. Look at the usenet newsgroups
  1804.   news.answers and comp.os.linux.announce.
  1805.  
  1806.   Ftp from: sunsite.unc.edu:/pub/Linux/docs
  1807.  
  1808.   ╖  FAQ is in /pub/linux/docs/faqs/linux-faq
  1809.  
  1810.   ╖  HOWTOs are in /pub/Linux/docs/HOWTO
  1811.  
  1812.   For WWW, start at the Linux documentation home page:
  1813.  
  1814.        http://sunsite.unc.edu/mdw/linux.html
  1815.  
  1816.   If desperate, send mail to:
  1817.  
  1818.                mail-server@rtfm.mit.edu
  1819.  
  1820.   with the word "help" in the message, then follow the mailed
  1821.   instructions.
  1822.  
  1823.   Note: if you haven't read the Linux FAQ and related documents such as
  1824.   the Linux Installation HOWTO and the Linux Install Guide, then you
  1825.   should not be trying to build boot diskettes.
  1826.  
  1827.   6.3.  Rescue Packages
  1828.  
  1829.   6.3.1.  Bootkit
  1830.  
  1831.   Written by Scott Burkett. Bootkit provides a flexible menu-driven
  1832.   framework for managing rescue disk creation and contents. It uses the
  1833.   Dialog package to provide nice menus, and a straight-forward directory
  1834.   tree to contain definitions of rescue disk contents. The package
  1835.   includes samples of the main files needed. The package aims to provide
  1836.   only the framework; it is up to the user to work out what to put on
  1837.   the disks and set up the config files accordingly.  For those users
  1838.   who don't mind doing this, it is a good choice.  I use this package
  1839.   myself.
  1840.  
  1841.   Ftp from: sunsite.unc.edu: /pub/Linux/system/Recovery/Bootkit-
  1842.   vvv.tar.gz
  1843.  
  1844.   6.3.2.  CatRescue
  1845.  
  1846.   Written by Oleg Kibirev. This package concentrates on saving space on
  1847.   the rescue diskettes by extensive use of compression, and by
  1848.   implementing executables as shells scripts. The doco includes some
  1849.   tips on what to do in various disaster situations.
  1850.  
  1851.   Ftp from: gd.cs.csufresno.edu/pub/sun4bin/src/CatRescue100.tgz
  1852.  
  1853.   6.3.3.  Rescue Shell Scripts
  1854.  
  1855.   Written by Thomas Heiling. This contains shell scripts to produce boot
  1856.   and boot/root diskettes. It has some dependencies on specific versions
  1857.   of other software such as LILO, and so might need some effort to
  1858.   convert to your system, but it might be useful as a starting point if
  1859.   you wanted more comprehensive shell scripts than are provided in this
  1860.   document.
  1861.  
  1862.   Ftp from: sunsite.unc.edu:/pub/Linux/system/Recovery/rescue.tgz
  1863.  
  1864.   6.3.4.  SAR - Search and Rescue
  1865.  
  1866.   Written by Karel Kubat. SAR produces a rescue diskette, using several
  1867.   techniques to minimize the space required on the diskette.  The manual
  1868.   includes a description of the Linux boot/login process.
  1869.  
  1870.   Ftp from: ftp.icce.rug.nl:/pub/unix/SAR-vvv.tar.gz
  1871.  
  1872.   The manual is available via WWW from:
  1873.  
  1874.   http://www.icce.rug.nl/karel/programs/SAR.html
  1875.  
  1876.   6.4.  Slackware Distribution
  1877.  
  1878.   Apart from being one of the more popular Linux distributions around,
  1879.   it is also a good place to get a generic kernel. It is available from
  1880.   almost everywhere, so there is little point in putting addresses here.
  1881.  
  1882.