Backup & Recovery

A Full Unix/Linux client recovery from a backup image requires setting up a recovery environment on the target client hardware specifically for the activity. Overwriting system files on a running system will cause it to crash and leave it in a non-boot state.

1. All system files need to be restored to an alternate disk. As such you will need to have at least two disks for this to work.
One disk with be the working OS disk with the needed NBU client software installed. It will need to have the credentials of the restoring client, as seen by the NBU Master and any Media Server in use.The second disk will be the target of the restore actions. Additional disks for any non-OS specific information can be used and their information recovered as well during the process.

2. The source client system can be as minimal as you care to have it. It needs a working OS at the same release as the backup client image. Kernel images do not have to exactly match, but it helps. The host name and IP address information needs to be properly resolved on the servers.  If the source machine of the backup needs to remain on the network during the recovery phase, you will need to "spoof" the Master Server by assigning an unused IP address to the host name for the duration of the restore. Add a temporary entry in the /etc/hosts file that has the needed host name to IP address resolution.

3. For the sake of an example, let us assume that the two disks are device paths /dev/sda and /dev/sdb.  The /dev/sda is the running server, the /dev/sdb is the image target server. 

4. On the target /dev/sdb disk, allocate all of the needed partitions of the backup image. The sizes of the partitions need to be as large or larger than the amount of data that will be recovered into them. They do not have to match what the original server partition allocations were. 

5. Create the appropriate file system type on each partition. 

6. Create a mount point directory on the source server. It can have any name you desire. Create sub-directories to match the target image paths. Here is example information:

Assume the following file systems noted in the backup image:

  /boot
  /  (the root file system)
  /usr
  /export


Create these mount points directories.
 
  mkdir /RECOVER
  mkdir /RECOVER/boot
  mkdir /RECOVER/export
    

7. Mount each file system allocation from the /dev/sdb disk to these mount points:

mount -o rw -t ext3 /dev/sdb1 /RECOVER/boot
mount -o rw -t ext3 /dev/sdb3 /RECOVER
mount -o rw -t ext3 /dev/sdb4 /RECOVER/usr
mount -o rw -t ext3 /dev/sdb5 /RECOVER/export

In the above, /dev/sdb2 will be the swap for the recovered client.

8. Create a rename file to be used for the restores of the file systems.  This will redirect the files from their normal /dev/sda location to the corresponding /dev/sdb location. As an example:

change /usr to /RECOVER/usr

9. Initiate the restore to the client using the "bprestore" command. Use the "-r" option flag to designate the rename file. You can restore file systems individually from the command line or use a list file to get all included in one action.  The "-f " option flag is used for that. I also recommend the use of the "-w" flag.  See the NBU Commands reference for more information on the "bprestore" command and the options named above.

10.  Once all of the files have been restored, you will need to install a boot image/grub loader into the recovery disk to make it bootable. Make sure that the mount table is correct on the recovery disk. Ensure that the swap partition is properly noted and will be active on reboot.

11. Shutdown the recovered client and remove the original source (/dev/sda) disk.

12. Reboot using the newly recovered disk.

If all went well, it should come up normally. Log in an verify settings.  Make changes as desired.

The above steps only covered recovering the OS disk. Data disk partitions can also be recovered.at the same time. Perform partition allocation and file system creation/mounts as needed on their individual disks. As they do not have any OS activity or side effects, you can overwrite an existing disk partition.