"Linux Gazette...making Linux just a little more fun! "

The YARD Rescue Disk Package

by Larry Ayers

Copyright (c) 1996

Published in Issue 12 of the Linux Gazette


It is a common practice to use the rescue/boot disks supplied with a Linux distribution if filesystem problems occur and you need to boot from a floppy. Typically these disks consist of a bootable compressed kernel on disk 1, with the second disk containing basic maintenance tools such as fsck.

On the few occasions I've had to boot from such disks the transition from my familiar Linux environment to the bare-essentials, limited boot-disk system (constrained by the size of a floppy disk) has been disconcerting, to say the least. Typically if an editor is available it's a small one with which I've never worked, and many of the tools I'm used to having around aren't there.

Recently Tom Fawcett has been refining a suite of customizable Perl scripts which make the creation of boot-disks from scratch easier. YARD (for Yet Another Rescue Disk) makes use of (and requires) the optional Linux kernel compressed ramdisk option, which allows you to load a compressed disk image into memory at boot-up. Paul Gortmaker has written a lucid explanation of the new ramdisk options in the file "ramdisk.txt", which is in the Documentation subdirectory of recent kernel source releases.

Installation and Usage

The Yard distribution contains two files which need to be edited as a first step. Config.pl is a Perl script which sets such preferences as the type of floppy you're using and whether you are making a single boot-disk or a double. The Bootdisk_Contents file contains a list of all of the files and utilities you would like on your disk(s). This file needs to be edited heavily, as it includes much more than will fit on even two disks. Anything you like can be included in this file.

The next step is to run the Perl script make_root_fs. This script gathers up all of the files you've specified (as well as all libraries upon which they depend) and constructs a root filesystem upon whichever device was specified in the Config.pl script. A ramdisk works well. The new filesystem is then compressed with gzip into a single file in your /tmp directory. Once this process is complete yet another Perl script, check_root_fs is run, which makes sure that all needed libraries,etc. are present.

After all of this preparation you're ready to actually write the rescue disks; here's where you find out if you've attempted to cram too much into them. The write_rescue_disk script first copies your compressed kernel (vmlinuz) onto the disk (the first disk if it's a two-disk set) and then copies the compressed filesystem image you've constructed onto whatever is left. It took me several tries to pare down what I wanted Initially on the disks to what would actually fit. The virtue of the Yard system is that all you need to do to try again is re-edit the Bootdisk_Contents file and re-make the filesystem. Yard also writes log-files which can be helpful in diagnosing problems.

Modular kernels are great, but if you boot a kernel image and a capability you need is a demand-loaded module you're out of luck. Yard sidesteps this potential problem by including your modules directory in the compressed filesystem, as well as making sure that the kernel-daemon /sbin/kerneld is started at boot-up.

The result of this process is a customized miniature Linux system. It's a nice feeling to know that if your filesystem is in shambles due to a power outage or a beta program run amuck that you at least have familiar tools available.

Once you've managed to edit a set of Yard configuration files which will successfully write working rescue disks, consider saving copies of these files in case the disks become corrupted. I just replaced the supplied files with my edited copies, then tarred and gzipped the Yard distribution and saved it to floppy.


Yard gives you the option of using or not using Lilo to boot your disks. I first tried Yard with Lilo, as Lilo has always worked well for me. It wouldn't work with my Yard disks, so I disabled that option. I'm using an old version of Lilo, left over from my original Slackware 3.00 Linux installation, which may explain this failure. Yard works fine without it. Lilo might be necessary if you need to include parameters in order to boot your system, such as those required for some SCSI hard disks.


Yard is available from the Yard home-page, as well as from the sunsite archive and its mirrors. It's well worth trying if you want the ultimate in control over just what is included on your rescue disks.

Larry Ayers<layers@vax2.rain.gen.mo.us>
Last modified: Wed Nov 20 09:21:50 CST 1996