
 Using the tbackup rescue disk.

*** INTRODUCTION

This manual has instructions on restoring your system from scratch by
creating a small `rescue system' with trestore on your hard drive.
You need a `minimal Linux installation kit' and a `tbackup rescue
disk' to do this.  See the CREATE file for information on creating
these floppies.

If the procedure described below fails, you will have to install a
normal Linux distribution and reinstall the tbackup package.  If you
don't have the original tbackup archive file at hand, you can use the
file tbresc.tgz on the tbackup rescue disk.


*** MAKING A MINIMAL LINUX SYSTEM ON YOUR HARD DRIVE

* Choosing a partition

You first have to decide on which hard drive partition to put the
rescue system.  Some things to note:

- After booting the minimal Linux system kit from floppy you can
  inspect your partitions to see which ones are damaged.  You may even
  be able to repair them with fsck, xfsck or e2fsck.

- The rescue system needs 8-20 meg space, depending on the size of
  your minimal Linux system.  If you have less than 8 meg RAM, you will
  probably also need some swap space.

- Reinitializing a damaged Linux partition and installing the rescue
  system on it generally a good choice.

- However, if a Linux partition is only partially damaged you may
  still be able to back up some recently changed files from it once
  the rescue system is running.  Try not to overwrite things that may
  still be useful.

- Depending on the size of the minimal system you may be able to
  temporarily use a swap partition.

- Of course you also need hard disk space to restore your system
  files, so eventually you will have to recycle large partitions.
  
- Once you have a rescue system installed, you can also use it
  to back up existing, intact partitions.  Doing this may give you room
  for restoring essential system files.

- If you can run a MS-DOS backup program, you can back up the contents
  of a nonessential dos partition and install the rescue system on it.

 
* Using the minimal Linux system kit

This step should eventually leave you with a bootable Linux system on
your hard drive. This system should have a tar and gzip program and at
least 3 meg free space somewhere.

Note that it is a good idea to write protect the floppies you use.  In
rare cases however, a `root' floppy needs to be writable for the kit
to work.

1) Using the bootdisk/rootdisk and the `basic' disk set of a standard
   distribution.

   No help here, read the installation documents of the distribution.
    
2) Using customized `rescue' disks
  
   No help here.
  
3) Using the bootdisk/rootdisk of a distribution.

  The trick is that you just copy the contents of the rootdisk to a
  harddisk partition as a way of making a minimal Linux system. Here is
  how to do it:
  
  a) Follow the first part of the installation instructions of the
     distribution, up to the point of logging into the floppy system.
  
  b) Log in as root.
  
  c) Prepare a partition for the minimal system.  If you have
     8 meg RAM, an attractive option is to use a swap partition larger
     than about 6 meg for this.
    
  d) Mount the partition on /mnt. 
  
  e) Copy the floppy contents to the partition, with
  
     cp -adxP / /mnt
  
  f) Create the mount points on the partition that weren't copied
  
     mkdir /mnt/proc /mnt/mnt
  
  g) Make the partition bootable in some way, see the distribution
     documentation.


*** INSTALLING TBACKUP FROM THE TBACKUP RESCUE DISK

The first step is to boot the minimal Linux system on your harddisk.

After that, insert the tbackup rescue floppy and mount it, e.g.

  mount -t msdos /dev/fd1 /mnt

if it is an msdos format floppy in drive 1. Now do a 

  cd /mnt

[If you have no high density drives and divided the rescue disk
contents between two floppies, you must copy these contents to one
directory on the hard drive, and cd to this directory.  For example:
  mkdir /contents
  ..insert first floppy in drive 0..
  mount -t msdos /dev/fd0 /mnt 
  cp /mnt/* /contents
  umount /dev/fd0
  ..insert second floppy in drive 0..
  mount -t msdos /dev/fd0 /mnt 
  cp /mnt/* /contents
  umount /dev/fd0
  cd /contents
]


There are three automatic installation scripts on the rescue disk.
Depending on your minimal Linux system at least one of them should
work. The scripts are called

 ./install.lbt :installs shared libraries, bash, tbackup and auxiliary
                programs
 ./install.bt  :installs bash, tbackup and auxiliary programs
 ./install.t   :installs only tbackup and auxiliary programs

Here is how to choose the appropriate script: 

1) Type the command "ls /lib/ld.so".  If you get an error message like
     | ls: /lib/ld.so: No such file or directory
   use the script ./install.lbt.

2) Type the command "ls /lib/libm.so*".  If you get an error message like
     | ls: /lib/libm.so*: No such file or directory
   use the script ./install.lbt.

3) If the previous command didn't produce an error message, you see
   something like 
     | /lib/libm.so.4       /lib/libm.so.4.5.24
   note the version number, in this case 4.5.24.  Type the command
   `cat ./libversion'.  Now you get a second version number:
     | The math library on the rescue disk is libm.so.4.5.31.
   if the second version number is greater than or equal to the first,
   use the script ./install.lbt.

4) Type the command "ls -l /bin/bash".  If you get an error message like
     | ls: /bin/bash: No such file or directory
   use the script ./install.bt.  If /bin/bash is a symlink or if its
   file size is smaller than 250 kb, also use the script ./install.bt.

5) You can use the script ./install.t.

Run the script by typing its name.  If all goes well, you can now run
trestore.

If you don't have the vi and/or more programs on your rescue system,
you may want to unpack the vi_more.tgz archive on the rescue disk.
Type "tar zxvf vi_more.tgz -C /" to do this.

Now you can unmount the rescue disk with "cd /" and "umount /dev/fd1"
or "umount /dev/fd0" depending on the floppy drive used.


*** RESTORING YOUR SYSTEM

In most cases, you don't want to restore your system files directly
under the / directory, as this will overwrite the rescue system.

Make a directory /sys to restore your system under:

  mkdir /sys

In trestore, you then answer `/sys' when asked for the unpack directory:
  
  | This archive was packed relative to the directory /.
  | Unpack archive in directory ---> [/] /sys
                                         ^^^^

* Restoring to another partition

If your rescue system is on a small, temporary partition you can now
reinitialize your damaged normal Linux root partition in the usual way
(fdisk, mk?fs) and mount it under /sys.

If more partitions were damaged, you can reinitialize them too and
mount them under the /sys partition at their usual place (e.g. if you
want to restore a partition that was under /usr, you need to do "mkdir
/sys/usr" and "mount -t <type> /dev/hd<partition> /sys/usr".

If the archives you need to restore also contain files that are still
on undamaged partitions, you need to mount these undamaged
partitions too at their appropriate place under /sys, and answer `n'
to the question on overwriting existing files.

If the restore is complete you should be able to make a boot disk to
start your old system from the partition you mounted under /sys.

* Restoring your system on the rescue partition

In this case, you don't mount anything under /sys.  There is a special
tool for moving the directories in /sys to / once the restore is
complete.  More about this later.  After the system is moved to / you
should be able to boot it from the rescue partition.

* Space for temporary files

Depending on the size of your backup floppies, trestore needs 0.4 to
1.7 meg harddisk space for temporary storage of floppy contents.  If
there is insufficient free space, tbackup will refuse to run.

By default, tbackup creates a directory `bulkdir' under /tmp for
temporary storage of floppy contents.  This default location is
configured in the /etc/tbackup/Config file, you may have changed it
when installing tbackup.  If you don't have much free space under /tmp
you may want to locate `bulkdir' on another partition, e.g. by making
a directory /sys/tmp and changing the Config file.  The bulkdir can
also be on a (mounted) dos partition.

If you have no editor on you rescue system to change
/etc/tbackup/Config, you can use a command line option when running
trestore:

 trestore -bulkdir /sys/tmp/bulkdir

this will create the `bulkdir' under /sys/tmp.


* Restoring the system

If you have made incremental backups, you should first restore the
full backup, and then the incremental backups, oldest one first.

The trestore documentation is in /usr/lib/tbackup/README.


*** SWAPPING SYSTEMS AND DELETING THE RESCUE SYSTEM

If you have restored your system under /sys on the rescue partition,
you will have to move the contents of /sys to / before you can boot
it.

Tbackup comes with a special tool to do this. Do

 mkdir /resc

to create a directory to move the rescue system to, and then

 /usr/lib/tbackup/bin/swaproot sys resc

This will move the rescue system directories under / to /resc, and the
restored system directories under /sys to /.  You can't do these moves
by hand with the `mv' command, as this would produce intermediate
stages that don't allow you to run `mv' anymore.

Some programs (like a running syslog daemon) may crash after the
swaproot operation, but your system should at least be stable enough
to do a reboot :) .  Note that all mounted filesystems will be moved
too, which will lead to the mount command becoming confused. 

After you have run swaproot you can delete the rescue system files:

 rm -rf /resc

---------------------------------------------------------------------------

APPENDIX (last section from /usr/lib/tbackup/README)

***  RESTORING FILES WITHOUT TBACKUP

In one particular disaster scenario, you don't have a Linux machine
with tbackup and trestore at your disposal, but need to get files from
your backups anyway.

The following text describes how to unpack a `floppy' backup set if
you don't have tbackup. 

1) get access to a unix machine with a large amount of free disk space.
2) find a way to copy the contents of MS-DOS disks to this unix machine.
3) copy the files named PARTAA.001, PARTAB.002, ... from the backup disks.
4) `cat' them all together in one large file, i.e.
        cat `ls part* | sort` >archive
5) look at the `export dea_unpackmethod=...' line in a DESCR2K file on
   one of the disks to find out if the archive is a `tar'
   or an `afio' archive.
6a) if the archive was packed with tar, use tar to unpack it.
6b) if the archive was packed with afio, unpack it with afio or cpio.
    (Afio produces cpio-format archives.)

If you don't have access to a unix machine you may have some luck with
`tar', `afio' or `cpio' ports to other operating systems (MS-DOS, VMS,
OS/2, amigaOS, ....), provided the ported versions have a sensible way
of dealing with filename limitations.

---------------------------------------------------------------------------
