A TundraWare Inc. Technical Note
Author: | Tim Daneliuk (tundra@tundraware.com) |
---|
Version: | $Id: baremetal.rst,v 1.102 2014/08/22 23:05:22 tundra Exp $ |
---|
Many commercial and open source solutions exist to solve the problem of creating backups that can be restored to "bare metal". That is, restoring a system image back to a disk when the machine will no longer boot or a disk has to be replaced. Image backups are preferred when rebuilding systems so you don't have to manually reinstall every application, system setting and so forth.
The purpose here was to do just that - create images capable of being "poured" onto, say, a blank, new hard drive, but using only standard linux commands and tools.
The idea is to make an image snapshot right after you build a machine, and anytime thereafter you make significant changes to its operating system and application configuration. You might do this, say, right before patching a server so that, if patching breaks the server to the point where it will no longer boot, you can just "pour" the previous image onto the disk.
To do this, we reboot our target machine using the Linux System Rescue CD. This CD has all the tools on it we need to do both image creation and restoration. You can find the iso image for this disk here:
http://sourceforge.net/projects/systemrescuecd/
You will also need access to a place to store and retrieve your images. In the examples below, we used a NAS nfs share, though you could also use another local hard drive, SAN connected storage or even a USB-connected drive.
In our examples below, we're imaging a CentOS 6.5 machine. The only thing we need to image is the operating system itself. In this example, we know there are 2 partitions of interest:
sda1
- The/boot
partitionsda2
- The rest of the operating system, in this case contained in LVM containers
The idea is that if the machine were to go dead, a disk failed, or what have you, this would be sufficient to get the replacement booting properly again. Presumably, you could then restore any data files you have from your standard backup/restore tools.
mount nas1:/shared /shared # Mount shared storage
This seems to work fine in the limited configuration that was tested.
The upside of this approach is that you can use standard Linux commands to do imaged backups of your machine.
There are two downsides:
- You cannot do this while the machine is up and running.
- Every block in the partition gets copied whether it is used or not.
In theory this should also work on SAN-booted machines so long as the exact same LUN (WWID and size) is presented for the restore as was used for the backup. However, this was not tested and theory and Reality usually collide in rather nasty ways. Mr. Murphy is not our friend.
Same story for VMs. Not tested. It's unclear whether a VM booted from a rescue disk would see the underlying disk storage (VMDK or whatever).
Again, theoretically this should work with other operating system partitions and data partitions. But ... not tested.
This document is Copyright (c) 2014, TundraWare Inc., Des Plaines, IL 60018, All Rights Reserved.
Permission is hereby granted for the free duplication and dissemination of this document if the following conditions are met:
- The document is distributed in whole and without modification, preserving the content in its entirety.
- No fee may be charged for such distribution beyond a usual and ordinary fee for duplication.
- You acknowledge that this document describes an EXPERIMENTAL PROCEDURE for learning purposes. It has not been tested in all possible hardware, software, operating system, and network configurations. You should not trust this approach unless you prove these procedures are satisfactory in YOUR OWN ENVIRONMENT.
- By using this material in any way, you acknowledge you are doing so at your own risk. You agree to hold TundraWare Inc. harmless for any damage, direct or indirect, that this may or does cause to your computational environment, including, but not limited to, your or others' hardware, software, network, or data. You FURTHER AGREE TO HOLD TUNDRAWARE INC. HARMLESS FOR ANY ECONOMIC DAMAGE OR ANY OTHER ADVERSE CONSEQUENCE, DIRECT OR INDIRECT, CAUSED BY THE USE OF THIS MATERIAL.
You can find the latest version of this document at:
http://www.tundraware.com/TechnicalNotes/Baremetal
A pdf version of this document can be downloaded at:
http://www.tundraware.com/TechnicalNotes/Baremetal/baremetal.pdf
This document produced with emacs
, RestructuredText
, and TeXLive
.