Slashdot Mirror


How To Perform a Bare-Metal Backup On Linux LVM

perlow writes "Using the free System Rescue CD you can perform bare-metal backups and restores of many types of computer systems. In this article, ZDNet columnist Jason Perlow explains the multi-step procedure in detail on an LVM-based system."

11 of 34 comments (clear)

  1. Another good disaster recovery solution by lazy_nihilist · · Score: 3, Informative
    1. Re:Another good disaster recovery solution by perlow · · Score: 2, Informative

      Mondo is cool, but it is not platform independent and usable on a live CD. It requires installation and compilation on each box to build its own rescue environent.

      The objective of my procedure was to come up with a method that could back up ANY Linux distribution at a low level in a very standardized and platform independent way, without sacrificing storage or performance OR TOUCHING THE OS ON THE BOX IN ANY WAY. This works with any Linux system you boot the System Rescue CD on, it requires no package or software installs or copied files onto the system you are backing up. None of the other methods that exist right now (System Imager, Mondo, even dd) will do -all- of the things I wanted it to do. My method is klunky as it is a manual process, but some enterprising programmer could probably script this in perl or python with a simple text menuing system pretty easily and have this built into the next System Rescue CD. That's what I was hoping for.

  2. Sure - Don't. by pla · · Score: 4, Interesting

    Step 1 - If your LVM hasn't forgotten its own configuration yet, get that sucker off an LVM as fast as you possibly can.

    When I first discovered LVM (and it had already reached a quite mature V2 at that point), I thought it the greatest thing in volume management since the invention of the RAID.

    I didn't half-ass it, I took my time to learn how it works, set up and broke a few, added a new PV and grew it to make sure it worked, backed some up, recovered from deliberately broken volumes (which works great - as long as you never try to bring the broken volume online by, say, rebooting), etc. Then I turned it on and loved it.

    Then I received a hard lesson in what it means to say that JBOD has a failure rate multiplicatively proportional to that of each individual drive. And, surprise surprise, LVM amounts to nothing more than fancy OS-level JBOD, without even the performance boost of a proper RAID controller.

    Thanks but no thanks. If I want to span a volume across multiple disks, I'll use RAID 5 or 6 from now on, ThankYouVeryMuch. I can only thank Zeus that I hadn't yet gotten around to cannibalizing my old file server when the LVM one day decided to eat itself (even if I could have salvaged something from the individual drives, I couldn't once it "fixed" its configuration to reflect the new PV set).

    1. Re:Sure - Don't. by bernz · · Score: 3, Insightful

      You make sure that all your devices block devices (at least if you're in a "Real Enterprise") are at least mirrored. Just because LVM2 writes across all disks, doesn't mean you're in a single-point-of-failure mode (or RAID0 or JBOD). You just make sure your "disks" are not just a single Physical Disk, but rather a LUN composed of a RAID6 with multiple paths anf power-supplies.

      And if you're not an Enterprise, this can be done on the "cheap" with RAID6 commodity boxes running as iSCSI targets.

      If you're ever relying on a single device for ANYTHING you're doing it wrong. But LVM is perfectly safe if you do it in a responsible way. It just isn't necessarily super-cheap.

    2. Re:Sure - Don't. by drsmithy · · Score: 2, Interesting

      I didn't half-ass it, I took my time to learn how it works, [...]
      Then I received a hard lesson in what it means to say that JBOD has a failure rate multiplicatively proportional to that of each individual drive. And, surprise surprise, LVM amounts to nothing more than fancy OS-level JBOD, without even the performance boost of a proper RAID controller.

      These two statements are in conflict.

    3. Re:Sure - Don't. by pla · · Score: 2, Insightful

      If you're ever relying on a single device for ANYTHING you're doing it wrong. But LVM is perfectly safe if you do it in a responsible way.

      I agree completely - And mostly meant that as my point (with an anecdote about myself as an otherwise-knowledgeable user making a really really stupid mistake).

      LVM does work exactly as advertised - It just shouldn't have anywhere near the popularity it currently enjoys. For example, several Linux distros (Fedora comes to mind) set up an LVM by default. Ouch.

      But yes, in the right environment (low risk of, or penalty for, failure) it solves a number of problems nicely... Adding space, something RAIDs have traditionally made painful, it makes a breeze; and volume snapshots quite simply rock the casba. But for most users (pretty much any non-enterprise level user, for that matter), I would consider it far more dangerous than helpful.

    4. Re:Sure - Don't. by petermgreen · · Score: 2, Informative

      IMO the big thing that LVM offers is it makes reproportioning easier and safer.

      With traditional partitioning you have to slide the data along the drive (which requires you to take the system offline, is time consuming and will probablly screw things up big time if power fails while doing it).

      With LVM, I can add unallocated space to any volume I like quickly and easilly. If the filesystem supports online resizing I can even do it without unmounting it.

      I agree though that while LVM does have JBOD and striping capabilities that are sometimes usefull the ramifications of using them should be carefully considered before going ahead.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    5. Re:Sure - Don't. by tzanger · · Score: 2, Insightful

      LVM does work exactly as advertised - It just shouldn't have anywhere near the popularity it currently enjoys. For example, several Linux distros (Fedora comes to mind) set up an LVM by default. Ouch.

      What the heck's wrong with that? I've been doing that manually on my cheap slackware systems for ages. I don't want hard partitions, and those who do are generally too young to remember the hell of C: D: E: F: G: H: drives in the old DOS days. Take a 250G drive, put a 5G / on it and LVM the rest for /usr, /home and most importantly, /var. I don't want all that shit together, and nobody is increasing the failure rate with a single drive.

      Hell, I'm running LVM on my laptop, for christ's sake. It's just good sense.

  3. Hmm. by gbjbaanb · · Score: 3, Informative

    other features for bare-metal backup/restore involves:

    Systemimager (dead good, and also good to restoring an image to other machines too). Restores from a cd (or PXE) boot and pulls the necessary data from the server with minimal intervention.

    Any virtualisation technology - depends on your definition of 'bare metal', but if you think of it as an easy-to-restore server, then I guess it counts.

    r1soft's (paid-for) continuous backup solution. Not tried this, but many webhost type companies have said its the dogs danglies.

  4. No! You have to use BOTH! by khasim · · Score: 2, Insightful

    LVM is NOT the same as RAID5.

    LVM makes it easy to move space around on the disks, but it does NOTHING to prevent data loss from failed disks.

    Put LVM on top of a RAID 1 or RAID 5 subsystem. Then you can add / replace disks and grow the volumes to use the new space.

  5. I prefer old school backup by dnamaners · · Score: 3, Interesting

    Don't get me wrong, I love centralized backups and backup server/client software (bacula for example). However I use old school methods for a bare metal restore. For simple things blanking the free space and then make a "dd" image is all you need. However you do it, keep it simple, and there may be no need to do bare metal on the whole of a file servers data set. Once I get the core of it back up I can use my favorite software to get the system up-to-the-last-snapshot current.

    LVM and Raid can be a little complex if you boot off it so ill give some tips. A nice small boot like SLAX (may favorite) or Knoppix is needed to start any bare metal restore. Pick something that supports the hardware and had LVM and or Raid. Either make a custom disk to add your backup data to the volume or have a 2nd DVD drive. Boot and restore.

    I make my backups via simple methods like rsync and tar. I use a few simple scrips to do it all. So simple that it is easy to restore by hand if need be. This makes the restore safer as it can be done a host of ways. Not to mention these unix tools are present in all distributions. Probably the biggest reason for the old school way is that on a bare metal restore often hardware may change. New drives etc, basically failure can be a reason to upgrade etc. Many utilities can choke on big hardware changes, new drive sizes and such.

    I take detailed system information and note it in the backup as human notes. Then grab your raid & LVM configuration and write a quick script to rebuild these features via the command line. Basically just a list of the actions you take to make a file system and format them the desired files system types manually. These same scripts will also re-apply boot loader and such as well. If the volumes change after a failure I can just issue updated commands (or edit the script) and make a similar layout of the filesystem. Then just open the tar balls via script or by hand and populate the new filesystem with the files you archived. With a bit of practice all of this can be automated by scripts. But if you need to vary the procedure due to hardware changes or as a way to clone a system you can.