5. First Stage Restore

5.1. Booting

The first thing to do is to verify that the hardware time is set correctly. Use the BIOS setup for this. How close to exact you have to set the time depends on your applications. For restoration, within a few minutes of exact time should be accurate enough. This will allow time-critical events to pick up where they left off when you finally launch the restored system.

5.1.1. Finnix

One option for booting Finnix is the "toram" option, which lets you move the whole kazoo into RAM. That in turn should let you load another CD, with your first stage data, into the CD drive.

5.1.2. Knoppix

These instructions will probably work with other CD-ROM or USB pen Linuxes, but you may have to vary them to suit.

Before booting Knoppix, make sure your ZIP drive (or substitute) is installed on a parallel port, either /dev/lp0 or /dev/lp1. Knoppix does not load the parallel port ZIP drive driver for you. Instead, use the command modprobe ppa (as root) to install it.

Boot Knoppix as usual. I find it faster and more useful to boot to a console. At the boot menu, use the command "knoppix 2". Then become the root user, with su -. For the password, just hit return.

5.1.3. tomsrtbt

Before booting tomsrtbt, make sure your ZIP drive is installed on a parallel port, either /dev/lp0 or /dev/lp1. The start-up software will load the parallel port ZIP drive driver for you.

The next step is to set the video mode. I usually like to see as much on the screen as I can. When the option to select a video mode comes, I use mode 6, 80 columns by 60 lines. Your hardware may or may not be able to handle high resolutions like that, so experiment with it.

5.2. Restoration

These instructions assume you are running tomsrtbt. If you are using a different Linux for your restore system, you may have to adjust these instructions a bit. For example, you should always run these scripts as root even if some other user gives you the requisite privileges.

Once the restoration Linux has booted and you have a console, mount the ZIP drive. It is probably a good idea to mount it read only. On tomsrtbt:

# mount /dev/sda1 /mnt -o ro

Check to be sure it is there:

# ls -l /mnt

On Knoppix or Finnix, you may want to make a directory under /mnt and mount it there, like so:

# mkdir /mnt/zip
# mount /dev/sda1 /mnt/zip -o ro

Now cd into the mounted device, and into the bin directory below it. On Finnix, for example:

# cd /mnt/zip/bin

The scripts assume you are in this directory, and call data files relative to it. At this point, you can run the restoration automatically or manually. Use the automated restore if you don't need to make any changes as you go along.

One consideration here is whether you have multiple hard drives. If your Linux installation mounts partitions on multiple hard drives, you must mount the root partition first. This is to ensure that mount point directories are created on the partition where they belong. The script first.stage will run the scripts to mount the drives in the order in which they are created. If you have created them (in the script save.metadata) in the order in which they cascade from root, the mounting process should work just fine.

If you have multiple hard drives, and they cross-mount, you are on your own. Either combine and edit the scripts to mount them in the correct order, or do it manually.

5.2.1. Automated

The automatic process calls each of the manual scripts in proper order. It does not allow for manual intervention, say for creating file systems that this HOWTO does not support. To run the first stage restore automatically, enter the command:

# first.stage

If you want to check for back blocks, add the -c option.

5.2.2. Manually

Run the script(s) that will restore the partition information and create file systems. You may run them in any order, so long as they build dependencies in the correct order. You can read the script first.stage to get an idea of the order. e.g.:

# ./make.dev.hda

If you want to check for back blocks, add the -c option.

This script will:

  • Clean out the first 1024 bytes of the hard drive, killing off any existing partition table and master boot record (MBR).

  • Recreate the non-LVM partitions from the information gathered when you ran make.fdisk.

  • Make ext2 and ext3 file systems on non-LVM partitions and Linux swap partitions as appropriate. If you provide the -c option to the script, it will also check for bad blocks.

  • Make some types of FAT partitions.

Now is a good time to check the geometry of the drive. Sometimes different versions of Linux pick up different geometries, so the geometry implicit in the file dev.hdX is incorrect. To force it to be correct on Knoppix, edit make.dev.x. Use the -C, -H and -S options to fdisk to specify the cylnders, heads and sectors, respectively. Those you can get from the file fdisk.hdX. Then re-run it.


If you have other operating systems or file systems to restore, now is a good time to do so. When you've done that, reboot to your restoration Linux and continue your first stage restoration.

If you have LVM volumes to restore, now is the time to run make.lvs and mount.lvs.

Now run the script(s) that create mount points and mount the partitions to them.

# ./mount.dev.hda

Once you have created all your directories and mounted partitions to them, you can run the script restore.metadata.

# ./restore.metadata

This will restore the contents of the ZIP drive to the hard drive to give you a minimal bootable system.

You should see a directory of the ZIP disk's root directory, then a list of the archive files as they are restored. Tar on tomsrtbt will tell you that tar's block size is 20, and that's fine. You can ignore it. Be sure that lilo prints out its results:

Added linux *

That will be followed by the output from a "df -m" command.

5.2.3. Finishing Touches

If you normally boot directly to X, you could have some problems. To be safe, the first stage script changes the run level in /target/etc/inittab to 3. Note: different distributions use different run level schemes. 3 works on Red Hat derived distributions; it may not on others.

You can now gracefully reboot. Remove the medium from your boot drive if you haven't already done so, and give the computer the three fingered salute, or its equivalent:

# shutdown -r now


# reboot

The computer will shut down and reboot.