Section 11.7. Alt-Boot Filesystem Method


11.7. Alt-Boot Filesystem Method

This example uses tar to back up and recover Linux partitions and ntsfclone to back up and recover Windows partitions. This requires the system to be offline (booted into Knoppix). This process should work with Linux and any Windows version that uses NTFS.

11.7.1. Create the Bare-Metal Backup

Use the following steps to create a bare-metal backup of your system.

11.7.1.1. Back up the important metadata

Back up the MBR by running the following command:

# dd if=/dev/hda of=/backups/mbr bs=512 count =1

This procedure also requires you to know which partitions are which format, especially the Windows partitions. You should record this data by backing up the output of fdisk -l, backing up the fstab file, and making a text file that contains any additional necessary information.

In our example, /dev/hda1 is /boot, /dev/hda2 is /, and /dev/hda3 is the Windows partition.

11.7.1.2. Boot the system from alternate media

Insert the Knoppix CD, boot into Knoppix, and open up a terminal window. Knoppix, by default, starts up KDE (a windowing environment) as user knoppix. You then need to switch to the root user (which has no password initially).

knoppix@0[knoppix]$ su -

11.7.1.3. Back up the operating system with a native utility

The first thing you have to do for this procedure to work is to mount an NFS directory as /backups:

# mkdir /backups # mount nfsserver:/data08/curtis /backups

See the previous section "Assumptions"if either DHCP or NFS isn't available.


You then need to mount the various partitions as filesystems.

# mount /dev/hda1 # mount /dev/hda2

You can use whatever method you like to back up the operating system at this point. For this example, we chose tar for the Linux partitions and ntfsclone for the Windows partition. While you could use tar on the Windows partition as well, we felt that ntfsclone was more likely to preserve any Windows ACLs.

Our example has one partition mounted as /boot, and the rest of the OS on /:

# cd /mnt/hda1 # tar cf /backups/boot.tar . # cd /mnt/hda2 # tar cf /backups/system.tar --exclude /mnt --exclude /boot --exclude /backups .

Alternatively, you could also use compression. This may speed up or slow down the backup, depending on where the bottleneck is.

# cd /mnt/hda1 # tar cfz /backups/boot.tar.gz . # cd /mnt/hda2 # tar cfz /backups/system.tar.gz --exclude /mnt --exclude /proc --exclude /boot --exclude /backups .

Now you need to back up the Windows partition. ntfsclone is not a filesystem utility per se because it does not back up on the file level. It's really an image backup utility that understands NTFS filesystems.

# ntfsclone --save-image --output /backups/ntfs-clone.img /dev/hda3

11.7.2. Perform a Bare-Metal Recovery

Use the following steps to recover your system from bare metal.

11.7.2.1. Boot the system from alternate media

The first step in recovering this system is to place the Knoppix CD into the CD drive and boot 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

See the previous section "Assumptions"if either DHCP or NFS isn't available.


11.7.2.2. Restore the boot block and prepare the new root drive

For restoring by partition, you need to restore the MBR and partition table and then restore each partition. You can 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. Since our fstab backup showed that /dev/hda1 and /dev/hda2 were ext2 filesystems, run the following commands:

# mkfs t ext2 /dev/hda1 -L /boot # mkfs t ext2 /dev/hda2 -L /

You do not need to prepare the NTFS partition; it's restored with the ntfsclone command.

11.7.2.3. Restore the operating system

You are now ready to actually restore the operating system. We use tar to restore the Linux partitions and ntfsclone to restore the Windows partition. You need to mount the partitions:

# mount /dev/hda1 # mount /dev/hda2

Now 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

Now you need to restore the Windows partition that's on /dev/hda3. Use the ntfsclone utility to do that:

# ntfsclone --restore-image /backups/ntfs-clone.img  --overwrite /dev/hda3 

All you need to do now is eject the Knoppix CD and reboot.





Backup & Recovery
Backup & Recovery: Inexpensive Backup Solutions for Open Systems
ISBN: 0596102461
EAN: 2147483647
Year: 2006
Pages: 237

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net