Cover V03, I01
Listing 1
Sidebar 1
Sidebar 2


Reproducing Boot-Disk Filesystems

Packey Velleca


This article presents a method for quickly reproducing entire boot-disk filesystems, including user and system files. Once the boot-disk on a single machine (the Master) has been properly configured, a copy of that load can be made and quickly distributed to other machines (Slaves) in a short time.

One method of boot-disk production is to place a Slave boot-disk on the same SCSI bus as the Master, and perform a low-level disk-to-disk copy. This method is serial-based, and inherently slow because only one Slave can be copied at a time and each in turn must be cabled and uncabled. Another disadvantage is that the Master is unavailable for any other use while the copies are being made.

The parallel-based method presented here, in contrast, is very fast because it employs an easily reproducible, inexpensive production medium containing an exact copy of the Master boot-disk. By using multiple copies of the production medium (1/4" tape, CD, or similar raw, or non-blocked, medium), one operator can load multiple Slaves at the same time. And because copying from the production medium to hard-disk has nearly the same throughput as a low-level disk-to-disk copy, the decrease in Slave production time is tremendous: one operator using five production media can load Slaves 500 percent faster than would be possible serially, with virtually no production hassles!

Scope and Portability

The copy procedure described here requires a system administrator with moderately high to advanced skills. It was written on a DEC 5000/240 ULTRIX 4.2a (BSD) RISC-based workstation with SCSI peripherals and does use some peripheral names, device drivers, and commands that are DEC ULTRIX-specific. System administrators with the appropriate level of experience should have no difficulty porting these to other systems and architectures.

Technical Overview

The procedure consists of three logical steps of pre-production preparation, and one step for production. The steps are:

1. Fully configure the Master so it is ready to be copied.

2. Create the production medium by sequentially transferring four (or more) files to it: File 1: the mini-kernel, or mini-root (see the sidebar "Required Mini-Root Functions"), used to boot the Slave into a shell where commands can be executed

File 2: the load script (see Listing 1), used to execute the commands that copy the image of the Master boot-disk from the production medium to the Slave

File 3: a dump(8) image of the Master / filesystem

File 4: an image of the Master /usr filesystem

File n: an image of the Master "nth" filesystem.

3. Create multiple copies of the production medium.

4. Place the production medium in each Slave and load its boot-disk, as follows:

a) Boot the mini-root from the production medium (File 1)

b) From the mini-root shell, copy the load script (File 2) from the production medium into the mini-root filesystem

c) Execute the load script (File 2), which then automatically loads the Slave boot-disk with each filesystem dump (Files 3 through "n").

When the load script is finished, the Slave will be a clone of the Master, and ready for service.

Assumptions Used in This Procedure

The production medium will be a QIC-320 1/4" cartridge tape (hereafter referred to as "tape"). In fact, though, almost any other raw production medium can be substituted. Tapes can be any size, though the larger they are, the less operator intervention will be required.

The Master boot-disk contains two filesystems: / and /usr. In practice, any number of filesystems (as listed in the file /etc/fstab) can be easily accommodated.

The Master and Slave machines all have boot-disks at SCSI ID#0 and tape drives at SCSI ID#5. Predetermining Slave SCSI IDs allows the load script to make assumptions about the locations of drives. Each workstation (Master and Slave) is assumed to have a production medium (tape) drive.

If this is not practical, then a number of tape drives (equal to the level of parallelism) must be procured and cabled to each Slave during production.

Materials Needed

The materials needed to execute the procedure are:

  • Master workstation with SCSI boot and tape drives, and complete software configuration

  • Operating system mini-root in tape format

  • Load script for loading filesystems from tape to boot-disk

  • One 1/4" QIC-320 tape (more for larger boot-disks)

  • Additional SCSI tape drive (optional).

    You can procure the mini-root from the operating system vendor. The load script can be written from scratch or you can use the one in Listing 1.

    Implementing the Procedure

    The subsections that follow present detailed instructions for implementing the procedure.

    1. Create the Master Software Configuration

    Set up the Master with all system files, user files, and application software. Keep the files unique to each Slave generic, so that, using operator input, the load script can automatically change them to Slave-unique files during production.

    For example, our machines have hostnames defined in the file /etc/rc.local, which means that this file is different on each Slave. In our case, the Master generic file /etc/rc.local would contain the following command:

    /bin/hostname XXXXX

    At production time, the load script will prompt the operator for the hostname of the Slave currently being loaded. The load script will then copy the generic file /etc/rc.local from the production tape to the Slave boot-disk. If the operator enters "GRUMPY" for the Slave name, the load script will then change the generic file into the Slave-unique file containing the command:

    /bin/hostname GRUMPY

    Each file on the Master that contains Slave-unique information should be made generic, and the load script should be written to change that file from generic to Slave-unique.

    2. Place the Mini-Root on the Master Boot-Disk

    Place the vendor distribution tape containing the mini-root in the Master tape drive. Then, from the Master, copy the mini-root from the tape to the directory /tmp by executing the command:

    dd if=/dev/rmt0h of=/tmp/miniroot ibs=1024 obs=8192 conv=sync

    See the sidebar "Device Issues" for details on the use of the dd(1) command with tapes.

    This procedure copies every file from the Master to the production tape, including the mini-root. Because the mini-root is not used during normal operation, placing it in the directory /tmp ensures that it will be removed automatically on Slave boot-up.

    3. Place the Load Script on the Master Boot-Disk

    The load script performs the following functions on the Slave during production:

    -- Partitions the boot-disk, using the chpt(8) command.

    -- Writes the boot-blocks (usually supplied as part of the mini-root) to the boot-disk, using the dd(1) command.

    -- Creates two filesystems on the boot-disk, using the mkfs(8) command.

    -- Restores each filesystem dump from the production tape to the boot-disk, using the restore(8) command.

    -- Performs Slave-specific editing of generic files using operator inputs and the sed(1) command.

    -- Checks boot-disk filesystem integrity, using the fsck(8) command.

    -- Shuts the mini-root down, using the sync(1) and halt(8) commands.

    You can create a Bourne shell load script, to perform these functions, or you can use the one shown in Listing 1. Keep in mind that the commands in the mini-root are very few and very primitive (see the sidebar, "Required Mini-Root Functions"). The load script can also be written to interactively accept command arguments from the operator at production time.

    In this particular example, the operator enters three command arguments (Slave hostname, IP address, and swap partition size); all the other arguments are predetermined and hard-coded into the load script.

    When your load script is debugged, place it on the Master boot-disk in the file /tmp/loadscript.

    4. Create the Production Tape from the Master

    The mini-root, load script, and two filesystems dumps are written sequentially to the production tape by executing the following commands from a Bourne shell on the Master:

    arg="ibs=8192 obs=1024 conv=sync"
    mt rewind
    dd if=/tmp/miniroot of=$of $arg
    dd if=/tmp/loadscript of=$of $arg
    dump 0usdf 21600 16000 $of /
    dump 0usdf 21600 16000 $of /usr

    Note the tape device driver (of) in the above commands is no-rewind (i.e., nrmt0h as opposed to rmt0h), so that files can be written sequentially. The mt(1) command ensures the tape is completely rewound and ready for writing. The dd(1) command sequentially writes the files /tmp/miniroot and /tmp/loadscript from the Master boot-disk to the production tape. The dump(8) commands sequentially write level 0 dumps of the Master filesystems / and /usr to the production tape. (See the sidebar "Device Issues" for details on the use of the dd(1) and dump(8) commands with tapes.)

    This completes the creation of the production tape.

    5. Create Multiple Copies of the Production Tape

    Copies of the production tape can be made either by repeating steps 1 through 4 above or by making tape-to-tape copies. The procedure for tape-to-tape copies is straightforward:

    a) Set up the Master with the additional tape drive.

    b) Place the source tape in the default drive (e.g., rmt0h).

    c) Place the destination tape in the second drive (e.g. rmt1h).

    d) Copy the mini-root and load script from the source tape to the destination tape by executing the following commands from a Bourne shell on the Master:

    mt rewind
    mt -f $d rewind
    dd if=$s of=$d bs=1024
    dd if=$s of=$d bs=1024

    e) Copy the filesystem dumps from the source tape to the destination tape by executing the following commands from a Bourne shell on the Master:

    dd if=$s of=$d bs=10240
    dd if=$s of=$d bs=10240

    Note the tape device drivers (in the variables s and d) in the above commands are no-rewind. The filesystem dumps must be written with a block size of 10240 bytes, as this is the size the dump(8) command uses to create the dump files, and the size the restore(8) command uses when restoring them.

    7. Create Slaves from the Production Tape

    Once the production tapes have been made, creating Slaves is quick and easy. From each Slave, perform the following steps:

    a) Place the Slave in console (maintenance) mode (some machines can be placed in console mode with the operating system command shutdown -h now; others may require some other command or cycling power).

    b) Put the production tape into the Slave tape drive.

    c) At the Slave console mode prompt, boot the mini-root from the production tape by executing the following console command:

    boot 3/tz5/vmunix

    (This is a DEC 5000/240 console command to boot the mini-root from the tape drive at SCSI ID#5; consult your machine's maintenance documentation for details about your system.)

    d) Once in the mini-root Bourne shell, set your preferred erase keystroke by entering the mini-root command:

    stty erase '^?'

    Note: some mini-roots may boot into a utility menu. If this is the case, choose an option from that menu that will place you in a mini-root Bourne shell.

    e) Make the special files for the tape and boot-disk drives by entering the mini-root commands:

    cd /dev
    MAKEDEV tz5 rz0

    f) Position the production tape at the load script by entering the mini-root command:

    mt fsf 1

    Forward-spacing the production tape one file (i.e., skipping past the mini-root to the load script) is necessary because booting the mini-root usually rewinds the tape.

    g) Copy the load script from the production tape to the mini-root filesystem by entering the mini-root command:

    dd if=/dev/nrmt0h of=/loadscript \
    ibs=1024 obs=8192 conv=sync

    Note the use of the no-rewind device.

    h) Execute the load script by entering the mini-root command:

    sh /loadscript

    i) Answer any load script questions appropriately.

    When the load script is finished executing, it will shut the machine down, at which point you can boot it into service!

    This is the end of the procedure.


    At HSSC, our system load for one boot-disk is about 354Mb on one 660Mb disk. Our serial-based method of copying the Master disk took about 30 minutes, so one operator could generate two Slaves per hour.

    The parallel procedure presented here also takes about 30 minutes to create one Slave. But with five copies of the production tape, one operator can load five machines in parallel in about 30 minutes, which is about ten machines per hour, with practically no production hassles.

    About the Author

    Packey Velleca graduated from Floria Institute of Technology in Melbourne, FL with a BSEE in 1988 and is employed by Harris Space Systems Corp. He currently works with a group of administrators for a small system of real-time computers with UNIX-based operator workstations. He can be reached via email at