License: -------- This HOWTO and the accompanying programs are licensed under the GNU GPL License version 2. The file COPYING should accompany this HOWTO detailing the license terms. It not, please visit this URL 'http://www.gnu.org/licenses/gpl.txt' to read the terms THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. Overview: --------- This document shows how to restore a server from scratch in case of a catastrophic failure. This kind of procedure is also known as a 'bare metal' restore. It is not necessary to install linux before restoring. It is a relative easy procedure. The procedure works well in case you have to buy a new disk and go from there. As always, be prepared and do your homework. Make sure you meet the requirements mentioned in the next section. It is a manual process, I like it that way, I am in full control. It is not difficult, and it works. I have successfully restored mail servers in a few hours. That response time is good enough for me. Even though I use GRUB, you can use LILO as the bootloader. This procedure uses GRUB to start the server for the first time after the restore. Once the server is running, it is a matter of running 'lilo' or 'grub' to reinstall the preferred boot loader. **Important** Try the procedure before you really need it. Be comfortable with 'fdisk' and your bootloader. Requirements: ------------ 1. Access to tar files on a separate machine throug means of NFS, FTP or similar. The important thing is that you have access to them even is your harddisk was blown away. This procedure requires that access to the tar files is through a network as the CDROM reader is filled with the recovery CD. Once I find a rescue diskette with reiserfs support this requirement will change. 2. Make sure you know your disk's partition layouts. 'fdisk -l /dev/hda' displays the first IDE disk's partition table The partition layout is saved together with the tarfiles, as is raidtab. 3. You have compiled 'star' and copied '/opt/schily' to CDROM, DVD, NFS-server or similar. 4. A disaster recovery CDROM, I use Linux BBC (lnx-bbc) and Knoppix regularly. lnx-bbc is a 50 MB download, Knoppix is 700 MB. 5. A floppy disk with GRUB installed so that it boots into the GRUB shell. Example settings used in this HOWTO: ------------------------------------ This disk is /dev/hda, three partitions: /dev/hda1: /boot approx 30 MB, formatted with ext2 file system /dev/hda2: swap partition /dev/hda3: / approx 10 GB, formatted with reiser file system The backup is split on several tar files: / in root-fs.tar /boot in boot-fs.tar /home in home-fs.tar /usr in usr-fs.tar /var in var-fs.tar /opt in opt-fs.tar The kernel is called 'vmlinuz.suse' and is located in /boot directory An initrd image is used. It is called 'initrd.suse' and is located in /boot directory I assume that the backups were taken using my script 'systembackup.sh' Procedure: ---------- 1. Replace the harddrive if necessary. 2. Boot the server, I use Knoppix in this example. On the boot option line write: 'knoppix lang=dk 2' this gives a danish keyboard layout and console display, no need for a GUI. 3. Partition your new disk similar to the old one. Use 'fdisk' 4. Format the partitions. Make sure you know the versions. For example, reiserfs may be 3.5 or 3.6 format. Format the boot partition 'mkfs.ext2 /dev/hda1' Format the root partition 'mkfs.reiserfs /dev/hda3' 5. Mount the partitions 'mount -t ext2 /dev/hda1 /mnt/hda1' 'mount -t reiserfs /dev/hda3 /mnt/hda3' 6. Copy the '/opt/schily' hierarchy mentioned in 'Requirements' to /mnt/hda3. This example expects /mnt/hda3/schily to exist. 7. Copy your tar files to '/mnt/hda3/tarfiles'. This example thus expects the tarfiles to be in the /mnt/hda3/tarfiles directory 8. Restore the disk First the boot partition: (cd /mnt/hda1; /mnt/hda3/schily/bin/star -x -p -xdir -file /mnt/hda3/tarfiles/boot-fs.tar) then the root system (cd /mnt/hda3; /mnt/hda3/schily/bin/star -x -p -xdir -file /mnt/hda3/tarfiles/root-fs.tar) then /home (cd /mnt/hda3/home; /mnt/hda3/schily/bin/star -x -p -xdir -file /mnt/hda3/tarfiles/home-fs.tar) then /usr (cd /mnt/hda1/usr; /mnt/hda3/schily/bin/star -x -p -xdir -file /mnt/hda3/tarfiles/usr-fs.tar) then /var (cd /mnt/hda1/var; /mnt/hda3/schily/bin/star -x -p -xdir -file /mnt/hda3/tarfiles/var-fs.tar) the /opt (cd /mnt/hda1/opt; /mnt/hda3/schily/bin/star -x -p -xdir -file /mnt/hda3/tarfiles/opt-fs.tar) 9. You are now ready to reboot the server. Put the GRUB'ed diskette in the floppy drive and type 'reboot' at the Knoppix prompt. 10. Once you are in the GRUB shell: Type 'root (hd0,0)' to tell GRUB which partition to work on. Type 'kernel /vmlinuz.suse root=/dev/hda3' GRUB has auto completion and you can chose whatever kernel to load. A very nice feature, thanks GRUB team! Type 'initrd /initrd.suse' to tell GRUB to use that initrd image corressponding to your chosen kernel.. Type 'boot' and rejoice, the server should be starting up as usual. 11. Once the server har botted and you are logged in as rot, reinstall your boot loader You are using LILO: type 'lilo', this should do it You are using GRUB: type 'grub', when in the grub shell type 'setup (hd0)' and then 'quit' 12. Done *S* References to WWW links: ------------------------ 'star' is here: http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/star.html Linux Journal ran an article on GRUB which is still valid: http://www.linuxjournal.com/article.php?sid=4622 The Knoppix cd is here: http://www.knoppix.com/ Linux Bootable Business Card is here: http://www.lnx-bbc.org/ Doc version: $Id: server-restore-HOWTO.txt,v 1.3 2003/05/08 15:58:39 pj Exp $