Bootcd Backup FAQ

Contents
1. General Backup Questions
2. Create an online backup
3. Create an offline backup
4. Restore a backup
5. How to use ...
6. Known Bugs

1. General Backup Questions

1.1
Q: Can I use bootcd to backup and restore redhat or suse?
A: You can create a bootcd which contains a backup (<bootcd-with-backup>) of 
   almost any linux system (<target-system>). 
   
   You can either do this backup online, or offline. 
   Online is good, if you do not want to stop the <target-system>. but be aware 
   of the fact, that the backup of a running database may be corrupt. 
   If you want to be sure, that everything is stopped, you may prefer to create
   an offline backup.

1.2
Q: Why should I create a <bootcd-with-backup>, mentioned in the above question,
   How can I use it.
A: The <bootcd-with-backup> can be used to recover the <target-system>, even if
   it is not bootable anymore.

   The <bootcd-with-backup> can be used to restore the <target-system>
   if the harddisk has been changed to another, maybe larger, harddisk.

   The <bootcd-with-backup> can also be mounted from the <target-system>
   to restore only specific files.

   The <bootcd-with-backup> can be used to reinstall the <target-system>, with
   a changed filesystem layout.

1.3
Q: What is the difference between the debian packages bootcd and bootcd-backup
A: The bootcd package includes the command bootcdwrite which creates a life-cd 
   with your actual debian system. This life-cd can be restored with 
   bootcd2disk. If you created a life-cd with bootcdwrite you do not need 
   bootcd-backup.
   
   But if your debian system uses an initrd (most usual), you also have to 
   install the debian package bootcd-mkinitramfs to use the package bootcd. 
   Bootcd-mkinitramfs will change your initrd. If you do not want this you can
   use bootcd-backup instead which will not change anything on your debian 
   system.

   Bootcdbackup uses an extra debian bootcd which has the actual backup of 
   your system in a directory /backup. Also the harddisk configuration of
   your system is described in /backup/bootcd2disk.conf. You can also have
   non debian backups in /backup. But you will not have a life-cd running
   your backups.

2. Create an online backup

2.1
Q: How can I create a <bootcd-with-backup> with an online backup ?

A: Here is an example to create a bootcd which contains a backup 
   (<bootcd-with-backup>) of a linux system (<target-system>).

   You need space to hold an image of the backup on the <target-system>.
   We assume you found space in </var/space> and you do not want the large 
   partition </data> to be backed up, because it would not fit on one DVD.

   There is now a wizard that can help. Get it with:
     wget ftp://bootcd.alioth.debian.org/pub/bootcd/bootcdbackupwizard.tar.gz
   You can also select earlier versions. For example with:
     wget ftp://bootcd.alioth.debian.org/pub/bootcd/bootcdbackupwizard_3.08.tar.gz

   The tar includes the debian packages a README and a script to extract the
   debian packages. After extracting you can run bootcdbackupwizard.
     ./bootcdbackupwizard -d </var/space> -e </data>
     
   The bootcdbackupwizard does the following:

   1. The wizard gets the debian debootstrap package.
      wget http://ftp.de.debian.org/debian/pool/main/d/debootstrap/debootstrap_<version>.deb

   2  The wizard starts a script to create the bootcd-with-backup image.
      ./bootcddebootstrap -d </var/space> $PWD/debootstrap_<version>.deb

   3. Now some Information from the running target-system have to be selected. And
      the  file bootcd2disk.conf has to be created with this information. This can
      be done with the script bootcdmk2diskconf.
      
    . The wizard uses the script from the new created bootcddebootstrap.
      ./bootcdmk2diskconf -b >/var/space/backup/bootcd2disk.conf

   4. Now the wizard does an online Backup. If you are running databases, it
      would have been better if you had stopped them before running the wizard.
      The wizard mounts the disks used by the target-system into the chroot 
      environment. The wizard knows about this disks from bootcd2disk.conf
   
      chroot /var/space "bootcd2disk -c /backup -onlymount"

   5. Then the wizard starts the backup
      
      chroot /var/space "tar -c -C/mnt --exclude </data> -zf /backup/backup.tgz ."

   6. If you need to modify the options in bootcdwrite.conf, do this now.
      To be able to do interactive changes you had to use the option -i when
      starting bootcdbackupwizard.

      vi /var/space/backup/etc/bootcdwrite.conf

   7. Unmount the previously mounted filesystems of the target-system:
     
      chroot /var/space "bootcd2disk -c /backup -onlyunmount"

   8. Create the image:
      
      chroot /var/space bootcdwrite

   9. Now use your favorite tool to burn the CD/DVD.


3. Create an offline backup

3.1
Q: How can I create a <bootcd-with-backup> with an offline backup ?

A: For the example below, we assume, you have another system with debian 
   installed (<debian-system>). You can use this to create a <mini-bootcd>. 
   Then you can boot the <target-system> with the <mini-bootcd>. 
   You can copy the data from the <target-system> to the <debian-system>. 
   And then you can use the <debian-system> to create the needed 
   <bootcd-with-backup>.

   To do this you need enough space on the <debian-system>. For the example
   below, we assume there is space in the directory </space> on the 
   <debian-system>. Also maybe not all data from the <target-system> will fit 
   on one DVD. So we assume we have found the directory </data> on the 
   <target-system> which can be backuped separately and should not go to
   the <bootcd-with-backup>.

   Do the following steps:

   1. Create backup directory on your <debian-system>:

       <debian-system># mkdir /backup

   2. Run bootcdmk2disconf from <debian-system> on the <target-system> and 
      copy the result back to the <debian-system>

      <target-system># scp <debian-system>:/usr/share/bootcd/bootcdmk2diskconf /tmp
      <target-system># /tmp/bootcdmk2diskconf -b >/tmp/bootcd2disk.conf
      <target-system># scp /tmp/bootcd2disk.conf <debian-system>:/backup/bootcd2disk.conf

   3. Create a <mini-bootcd> from the <debian-system> with bootcdwrite.
      <debian-system># bootcdwrite

   4. Burn the <mini-bootcd> to a DVD.
      
   5. Boot the <target-system> from the <mini-bootcd> and mount the system you 
      want to backup to /mnt.
      
      bootcd2disk -c /backup -onlymount

   6. Backup the system you want to backup:

      tar -c -C/mnt -zf - . | \
        ssh -c blowfish root@<debian-system> "cat >/backup/backup.tgz"

   7. Create the <bootcd-with-backup> from the <debian-system>

      <debian-system># bootcdwrite

   8. Now use your favorite tool to burn the CD/DVD.


4. Restore a backup

4.1
Q: How do I reinstall from a <bootcd-with-backup>

A: To install a new system with the <bootcd-with-backup>, boot the 
   new system from the <bootcd-with-backup> and run

   1. bootcd2disk -c /backup

   Before you run this command you can set specific configuration options
   in /backup/bootcd2disk.conf

   The RESTORECMD defined in bootcd2disk.conf defines how the backup is
   restored. Because we restore a backup no files will be modified.
   If you restore your backup to another hardware, this may require changes
   in the files included in the backup (/etc/fstab). 

5. How to use ...
5.1
Q: How to use bootcddebootstrap
A: # become root
   export http_proxy=... # only if needed
   apt-get install --reinstall --download-only debootstrap
   /usr/share/doc/bootcd-backup/examples/bootcddebootstrap -i /var/cache/apt/archives/debootstrap_*.deb

6. Known Bugs

6.1
Q: Does bootcdbackup support selinux
A: Yes, but no full support.
   If selinux is enabled, bootcdbackupwizard uses star instead of cpio, 
   to save selinux attributes. But after restore with bootcd2disk the 
   system only works with manual interaction. The system first comes up 
   in single user mode. Than the partition with the file /etc/selinux/config 
   has to be mounted rw. For example "mount -o remount,rw /" and the line 
   SELINUX=enforcing in /etc/selinux/config has to be changed to 
   SELINUX=permissive. After reboot everything should work.

   This problem may only result from some missing options to star. Maybe
   someone finds out the correct options in future.
