8. Miscellaneous topics

8.1. Reducing root filesystem size

Sometimes a root filesystem is too large to fit on a diskette even after compression. Here are some ways to reduce the filesystem size:

  1. Increase the diskette density. By default, floppy diskettes are formatted at 1440K, but higher density formats are available. fdformat will format disks for the following sizes: 1600, 1680, 1722, 1743, 1760, 1840, and 1920. Most 1440K drives will support 1722K, and this is what I always use for bootdisks. See the fdformat man page and /usr/src/linux/Documentation/devices.txt.

  2. Replace your shell. Some of the popular shells for Linux, such as bash and tcsh, are large and require many libraries. Light-weight alternatives exist, such as ash, lsh, kiss and smash, which are much smaller and require few (or no) libraries. Most of these replacement shells are available from http://metalab.unc.edu/pub/Linux/system/shells/. Make sure any shell you use is capable of running commands in all the rc files you include on your bootdisk.

  3. Strip libraries and binaries. Many libraries and binaries are distributed with debugging information. Running file on these files will tell you ``not stripped'' if so. When copying binaries to your root filesystem, it is good practice to use:

          objcopy --strip-all FROM TO

    Important: When copying libraries, be sure to use strip-debug instead of strip-all.

  4. If you deleted or moved many files when you were creating the root filesystem, create it again. See the NOTE ABOVE on the importance of not having dirty blocks in the filesystem.

  5. Move non-critical files to a utility disk. If some of your binaries are not needed immediately to boot or login, you can move them to a utility disk. See Section 8.3 for details. You may also consider moving modules to a utility disk as well.

8.2. Non-ramdisk root filesystems

Section 4 gave instructions for building a compressed root filesystem which is loaded to ramdisk when the system boots. This method has many advantages so it is commonly used. However, some systems with little memory cannot afford the RAM needed for this, and they must use root filesystems mounted directly from the diskette.

Such filesystems are actually easier to build than compressed root filesystems because they can be built on a diskette rather than on some other device, and they do not have to be compressed. We will outline the procedure as it differs from the instructions above. If you choose to do this, keep in mind that you will have much less space available.

  1. Calculate how much space you will have available for root files. If you are building a single boot/root disk, you must fit all blocks for the kernel plus all blocks for the root filesystem on the one disk.

  2. Using mke2fs, create a root filesystem on a diskette of the appropriate size.

  3. Populate the filesystem as described above.

  4. When done, unmount the filesystem and transfer it to a disk file but do not compress it.

  5. Transfer the kernel to a floppy diskette, as described above. When calculating the ramdisk word, set bit 14 to zero, to indicate that the root filesystem is not to be loaded to ramdisk. Run the rdev's as described.

  6. Transfer the root filesystem as before.

There are several shortcuts you can take. If you are building a two-disk set, you can build the complete root filesystem directly on the second disk and you need not transfer it to a hard disk file and then back. Also, if you are building a single boot/root disk and using LILO, you can build a single filesystem on the entire disk, containing the kernel, LILO files and root files, and simply run LILO as the last step.

8.3. Building a utility disk

Building a utility disk is relatively easy -- simply create a filesystem on a formatted disk and copy files to it. To use it with a bootdisk, mount it manually after the system is booted.

In the instructions above, we mentioned that the utility disk could be mounted as /usr. In this case, binaries could be placed into a /bin directory on your utility disk, so that placing /usr/bin in your path will access them. Additional libraries needed by the binaries are placed in /lib on the utility disk.

There are several important points to keep in mind when designing a utility disk:

  1. Do not place critical system binaries or libraries onto the utility disk, since it will not be mountable until after the system has booted.

  2. You cannot access a floppy diskette and a floppy tape drive simultaneously. This means that if you have a floppy tape drive, you will not be able to access it while your utility disk is mounted.

  3. Access to files on the utility disk will be slow.

Appendix D shows a sample of files on a utility disk. Here are some ideas for files you may find useful: programs for examining and manipulating disks (format, fdisk) and filesystems (mke2fs, fsck, debugfs, isofs.o), a lightweight text editor (elvis, jove), compression and archive utilities (gzip, bzip, tar, cpio, afio), tape utilities (mt, ftmt, tob, taper), communications utilities (ppp.o, slip.o, minicom) and utilities for devices (setserial, mknod).