Eclectica Daybreak over Colburne Passage near Sidney, BC, Canada filler
shim shim shim shim
shim Home shim Software shim Avocations shim Services  
shim shim shim shim
 SSL Certificates
 Self-Check Digits
 Bare Metal Reload
      Mailing Lists
 FTP Backup
Bare-Metal Recovery using a Linux-on-a-floppy Boot/Rescue Disk


Move an EnGarde installation from one hard drive to another.

This procedure was tested by copying a working EnGarde installation from
a 6.4GB drive to a 2.1GB drive that replaced it in the same machine. The
archive was created on and restored from an NFS mount. Other media are
equally valid; for example, tape, or a third physical drive.

It helps to understand the procedure below if you know that the machine
this was tested on is named "cypress", and the NFS host is "sequoia".

Additional Software Required

A Linux-on-a-floppy boot/rescue disk. I can recommend tomsrtbt, available at:

This procedure was tested with version 1.7.361.

Summary Procedure

1. Boot with tomsrtbt and tar everything to other media.
2. Replace the machine's disk drive.
3. Reboot with tomsrtbt and partition and format the new drive.
4. Restore everything from the archive media.

Disk Configuration

EnGarde is installed by default into four partitions as follows:

/dev/hda1  swap
/dev/hda2  /
/dev/hda3  /home
/dev/hda4  /var

In the procedure below, EnGarde is reinstalled onto a single partition,
resulting in the following configuration:

/dev/hda1  Swap
/dev/hda2  /

This is acceptable for the intended use of the machine tested here. However,
this procedure could be modified to change the partitioning to any desired
scheme, including one with multiple disks. To do this, create the necessary
directories and mount the various partitions on them as desired. Create only
the directories actually needed for this; for example, a separate disk could
be used for /var/spool/mail. A sample configuration might be:

/dev/hda1  swap
/dev/hda2  /
/dev/hda3  /home
/dev/hda4  /var
/dev/hdb1  /var/spool/mail

User and Group Considerations

The first time I did this, I lost file ownership information. This may be
because I used the wrong arguments to tar (actually pax on tomsrtbt), but I
solved the problem by making certain all EnGarde users were valid in the
tomsrtbt configuration. This is easy, because tomsrtbt defines only three
users and one group; simply merge the files as shown below.

Unix Socket Considerations

Unix sockets (mode srw-rw-rw-) do not archive properly; they lose the 's'
and become ordinary files. EnGarde comes with a number of programs that use
these sockets. Some of them, notably postfix, recognize this problem and
re-create the sockets as necessary. Others do not. In particular,
syslog-ng does NOT.

What this means is that when you start the machine on the new drive, logging
does not work at all. To fix this, the sockets must be deleted before the
machine is rebooted so they can be recreated. The details are listed below.

Detailed Procedure

1. Boot with tomsrtbt and go to the /mnt directory:

# cd /mnt

2. Mount the drive to be copied:

# mkdir cypress
# mount -t ext2 /dev/hda2 cypress
# mount -t ext2 /dev/hda3 cypress/home
# mount -t ext2 /dev/hda4 cypress/var

2. Mount the temporary storage drive:

# mkdir sequoia
# mount -t nfs -o rsize=8192 -o wsize=8192 sequoia:/home sequoia

3. Fix up the passwd and group files, and save copies:

# grep -v root cypress/etc/passwd | grep -v shutdown | grep -v halt >>/etc/passwd
# cp cypress/etc/group /etc/group
# cp /etc/passwd sequoia
# cp /etc/group sequoia

4. Create the archive:

# cd cypress
# pax -w -p e -f /mnt/sequoia/cypress.tar .

5. Power off the machine, and physically exchange the drives.

   Note: Make sure that the BIOS recognizes the new drive.

6. Boot with tomsrtbt and prepare the new drive:

# dd if=/dev/zero of=/dev/hda bs=512 count=1
# fdisk  
# mkswap /dev/hda1
# mke2fs /dev/hda2  

7. Mount the partitions to be restored:

# cd /mnt
# mkdir cypress
# mount -t ext2 /dev/hda2 cypress
# rmdir lost+found

8. Mount the temporary storage drive:

# mkdir sequoia
# mount -t nfs -o rsize=8192 -o wsize=8192 sequoia:/home sequoia

9. Fix up the password and group files again:

# cp sequoia/passwd /etc
# cp sequoia/group /etc

10. Restore the archive to the new drive:

# cd cypress
# pax -r -p e -f /mnt/sequoia/cypress.tar

11. Perform post-installation procedures:

# rm dev/log
# rm var/chroot/named/dev/log
# vi etc/fstab  

12. Install the boot partition and reboot (remove floppy!):

# chroot /mnt/cypress /sbin/lilo
# shutdown -r now

That's it; the machine should be just as it was when you last powered it down.


The core of this technique came from

  Unix Backup & Recovery
  First Edition, November 1999
  W. Curtis Preston
  ISBN: 1-56592-642-0
  Published by O'Reilly 

November 25, 2001
Please send comments and corrections to the author.
Researched and written by Marcus Redivo.
Permission to use this document for any purpose is hereby granted, providing that the copyright information and this disclaimer is retained. Author accepts no responsibility for any consequences arising from the use of this information.