1. Computing & Technology

Discuss in my forum

Backup and Recovery How-To

By , About.com Guide


   Linux Complete Backup and Recovery HOWTO
   Prev        Next

4. Creating the Stage 1 Back Up

Having made your production backups, you need to preserve your partition information so that you can rebuild your partitions.

The script To Do list scans a hard drive for partition information, and saves it in three files. The first is an executable script, called To Do list (where "x" is the name of the device file, e.g. hda). Second is To Do list , which creates mount points and mounts the newly created partitions on them. The last, To Do list , is the commands necessary for fdisk to build the partitions. You specify which hard drive you want to build scripts for (and thus the file names) by naming the associated device file as the argument to To Do list . For example, on a typical IDE system,


   

bash# make.fdisk /dev/hda

spits out the scripts To Do list , To Do list and the input file for fdisk , To Do list .

In addition, if To Do list encounters a FAT partition, it preserves the partition's boot sector in a file named dev.xy , where x is the drive's device name (e.g. sdc, hda) and y is the partition number. The boot sector is the first sector, 512 bytes, of the partition. This sector is restored at the same time the partitions are rebuilt, in the script To Do list .

Fortunately, the price of hard drives is plummeting almost as fast as the public's trust in politicians after an election. So it is good that the output files are text, and allow hand editing. That's the most difficult but most flexible way to rebuild on a larger replacement drive. (See the To Do list .)

Other metadata are preserved in the script tomsrtbt . The script saves the partition information in the file fdisk.hda in the root of the ZIP disk. It is a good idea to print this file and your /etc/fstab so that you have hard copy should you ever have to restore the partition data manually. You can save a tree by toggling between two virtual consoles, running fdisk in one and catting /etc/fstab or /fdisk.hda as needed. However, doing so is error prone.

You will also want to preserve files relevant to your restoration method. For example, if you use nfs to save your data, you will need to preserve hosts.allow, hosts.deny, exports, etc. Also, if you are using any network-backed restoration process, such as Amanda or Quick Restore, you will need to preserve networking files like HOSTNAME, hosts, etc. and the relevant software tree.

The simplest way to handle these and similar questions is to preserve the entire etc directory.

There is no way a 100 MB ZIP drive is going to hold a server installation of a modern distribution of Linux. We have to be much more selective than simply preserving the whole kazoo. What files do we need?

  • The boot directory.

  • The /etc directory and subdirectories.

  • Directories needed at boot time.

  • Device files in /dev.

To determine the directories needed at boot, we look at the boot initialization file /etc/rc.sysinit . It sets

* License

* Backup and Recovery How-To Index

©2012 About.com. All rights reserved.

A part of The New York Times Company.