11.6. Live MethodThis example uses tar to back up and recover the system at the partition level, which allows the system to be online. The procedure was tested on a Linux system. We did not test this on a Windows system because we could not identify a single utility available in Windows and Knoppix that preserves ACLs. Your experience may be different. 11.6.1. Create the Bare-Metal BackupUse the following steps to create a bare-metal backup of your system. 11.6.1.1. Back up the important metadataBack up the MBR by running the following command: # dd if=/dev/hda of=/backups/mbr bs=512 count=1 11.6.1.2. Back up the operating system with a native utilityCreate a mount point, and mount a NFS directory as /backups: # mkdir /backups # mount nfsserver:/data08/curtis /backups
You can use whatever method you like to back up the operating system at this point. For this example, we chose tar. Our example has one partition mounted as /boot, and the rest of the OS on /. # cd /boot # tar cf /backups/boot.tar . # cd / # tar cf /backups/system.tar --exclude /mnt --exclude /proc --exclude /boot --exclude /backups . Alternatively, you could use compression. This may speed up or slow down the backup, depending on where the bottleneck is. # cd /boot # tar cfz /backups/boot.tar.gz . # cd / # tar cfz /backups/system.tar.gz --exclude /mnt --exclude /proc --exclude /boot --exclude /backups . 11.6.2. Perform a Bare-Metal RecoveryUse the following steps to recover your system from bare metal. 11.6.2.1. Boot the system from alternate mediaThe first step in recovering this system is to place the Knoppix CD into the CD drive and boot up the system. A check of the partition table at this point shows the following: # fdisk -l Disk /dev/hda: 41.1 GB, 41174138880 bytes 16 heads, 63 sectors/track, 79780 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Disk /dev/hda doesn't contain a valid partition table As before, open a terminal window and switch to the root user, then mount your NFS directory: knoppix@0[knoppix]$ su - # mkdir /backups # mount nfsserver:/data08/curtis /backups
11.6.2.2. Restore the boot block information and prepare the new root driveFor restoring by partition, you need to restore the MBR and partition table and then restore each partition. Restore the MBR and partition table by running the following command: # dd if=/backups/mbr of=/dev/hda bs=512 count =1 In order to get Knoppix to recognize without a reboot that we had recovered the MBR, we found it was necessary to actually run fdisk /dev/hda and then choose w to write the partition to disk. A reboot works as well but takes longer. You also need to prepare the partitions for a filesystem restore. If the fstab backup shows they were ext2 filesystems, run the following commands. (Obviously, this part varies based on the types of filesystems you're using.) # mkfs t ext2 /dev/hda1 -L /boot # mkfs t ext2 /dev/hda2 -L / 11.6.2.3. Restore the operating systemYou are now ready to restore the operating system. Mount the partitions: # mount /dev/hda1 # mount /dev/hda2
cd to the location of the new root filesystem and run the restore commands. # cd /mnt/hda1 # tar xpkf /backups/boot.tar # cd /mnt/hda2 # tar xpkf /backups/system.tar Or, if you chose compression, run these commands: # cd /mnt/hda1 # tar xpkfz /backups/boot.tar.gz # cd /mnt/hda2 # tar xpkfz /backups/system.tar.gz All you need to do now is eject the Knoppix CD and reboot. |