Bare Metal Recovery

Most us don't take the time to plan for disaster recovery. One excuse is not wanting to figure out what to do. One excuse down—this article gives you the step-by-step.
Preparation

First, do your normal backups on their regular schedule. This article is useless if you don't do that.

Next, build yourself a rescue disk. I use tomsrtbt, available at http://www.toms.net/~toehser/rb/. It is well documented and packs a lot of useful tools onto one floppy diskette. There is an active list for it, and the one question I had was quickly and accurately answered. I like that in a product my shop may depend on one day.

Next, figure out how to do the operating system backup you will need so that you can restore your normal backup. I followed Preston's advice and used an Iomega parallel port Zip drive. They get approximately 90MB of useful storage to a disk. Since the scripts I developed for the stage one backup save about 30MB of data, one Zip disk should be plenty for the job at hand.

Installing the Zip Drive

Much of this is covered in the Zip Drive HOWTO (www.linuxdoc.org/HOWTO/mini/ZIP-Drive.html), so I'll show you exactly what I did. Your mileage may vary. You may have already done a lot of this, in which case your setup may vary. For me the procedure was simplified by not having a printer share the parallel port with the Zip drive.

First, install the driver for the Zip drive, and make a mount point for it:

[root@tester /etc]# modprobe ppa
[root@tester /etc]# mkdir /mnt/zip

Insert a suitable line into your fstab:

/dev/sda4       /mnt/zip        vfat    noauto  0 0
Save fstab. Put a Zip disk in the drive. Then you should be able to mount the Zip drive:
[root@tester /etc]# mount /mnt/zip
[root@tester /etc]# ls -l /mnt/zip
total 277
drwxr-xr-x  2 root   root    16384 Dec 31  1969 .
drwxr-xr-x  7 root   root     1024 May 11 08:34 ..
-rwxr-xr-x  1 root   root   265728 Jan 30 1998 50ways.exe

Putting ex2fs on the Zip Disk

Zip drives come formatted for MS-DOS or Windows (FAT) or the Mac. The FAT format is somewhat inefficient for what we are doing, although not fatally so. Our test computer setup put about 26MB onto the Zip disk, so you can skip installing the ext2fs on your Zip disk.

Here is how to replace the FAT file system on the Zip disk with an ext2fs. First, unmount the Zip drive:

[root@tester /etc]# umount /mnt/zip

Then run fdisk and see what you have:

[root@tester /etc]# fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 64 heads, 32 sectors, 96 cylinders
Units = cylinders of 2048 * 512 bytes

Device Boot     Start   End     Blocks  Id      System
/dev/sda4  *    1       96      98288   6       DOS 16-bit >=32M

Command (m for help):
For reasons known only to Murphy and Iomega, FAT Iomega Zip disks have only one partition, partition four. Delete the offending partition:
Command (m for help): d
Partition number (1-4): 4

Command (m for help): p

Disk /dev/sda: 64 heads, 32 sectors, 96 cylinders
Units = cylinders of 2048 * 512 bytes

Device Boot     Start   End     Blocks  Id      System
Per the Zip drive HOWTO, we will make a new partition as partition 1:
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-96): 1
Last cylinder or +size or +sizeM or +sizeK  ([1]-96):  96
Displaying the partition table indicates that it was marked as a Linux ext2fs partition for us, so we don't have to change the file system id:
Command (m for help): p

Disk /dev/sda: 64 heads, 32 sectors, 96 cylinders
Units = cylinders of 2048 * 512 bytes

Device Boot     Start   End     Blocks  Id      System
/dev/sda1       1       96      98288   83      Linux native
Use the w command to write the partition table and exit. We now have to make a file system on the freshly minted partition:
[root@tester /etc]# mke2fs /dev/sda1
mke2fs 1.12, 9-Jul-98 for EXT2 FS 0.5b, 95/08/09
Linux ext2 file system format
File system label=
24576 inodes, 98288 blocks
4914 blocks (5.00%) reserved for the super user
First data block=1
Block size=1024 (log=0)
Fragment size=1024 (log=0)
12 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
  8193, 16385, 24577, 32769, 40961, 49153, 57345,
  65537, 73729, 81921, 90113

Writing inode tables: done
Writing superblocks and file system accounting information: done
Now we go back to fstab and add a new entry:
/dev/sda1    /mnt/zip    ext2   noauto    0 0
This lets us specify which file system we have on the Zip disk by mounting the device file rather than the mount point. For example:
[root@tester /etc]# mount /dev/sda1
The order in which you place the two lines in /etc/fstab is important. The first one determines whether the default partition mount will try to mount if you specify /mnt/zip. So put this line above the entry you made earlier. We will use this in the script that saves the stage one data to the Zip disk.

______________________

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState