Title: Bare Metal Recovery
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Bare Metal Recovery

A bare metal recovery will restore a server to the state it was in when the backup was made.  If new hard drives are to be installed, ensure they hold as much data as the originals.  Check the documentation if you are using a supported program for the recovery. In the example below, a server will be restored based on a backup which was performed using a live CD and a fileserver.

- The first step is to ensure that ssh connections work in the live environment.  It will be necessary to accept the keys the first time you connect.  Logout after confirming the connection.

ssh archive@backup-server

- The second step is to verify that the hard drive is available and to note the device name.  In this case the device is /dev/vda.  This procedure will work whether or not the new hard drive had previously been formatted.

# fdisk -l

Disk /dev/vda: 32.2 GB, 32212254720 bytes
16 heads, 63 sectors/track, 62415 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000e90f4

Device Boot      Start         End      Blocks   Id  System

#

- The third step is to copy the Master Boot Record (MBR) and each of the partitions from the correct path on the backup server.  Note that gzip is used to compress the data after it is transferred over the network.

ssh archive@backup-server "cat /backup/prod-server/vda-mbr.img" |\
dd of=/dev/vda

ssh archive@backup-server "cat /backup/prod-server/vda1.img.gz" |\
gunzip | dd of=/dev/vda1

ssh archive@backup-server "cat /backup/prod-server/vda2.img.gz" |\
gunzip | dd of=/dev/vda2

After the data has transferred, reboot the server and remove the live CD.  Be sure to keep the CD available where it can be found quickly in case of an emergency.