2

I have an Ubuntu server that I'd like to backup on a daily basis. I want to be able to restore the entire system with the click of a few buttons (or keystrokes). Also, I don't want to bring down / unmount my partitions to back them up. So far what I've come up with is a combination of cron, perl, LVM, and FSArchiver.

  1. Cron fires a perl script to...
  2. Make snapshot of each partition with lvcreate -s
  3. Mount each snapshot
  4. Run FSArchiver to backup each ext4 partition to a CIFS / SMB share
  5. Unmount the snapshots
  6. lvremove the snapshots
  7. Save log files, etc.

So I could roll all this myself like I described, but if there's a solution out there that already exists (perhaps with even more features, like differential backups), I'd go for that. rysnc doesn't do backups of system files in use on a mounted drive (right?), so that's out. I've searched around, but I haven't found a single solution that does something like I've described above. Any solutions you use that work on mounted system partitions?

watkipet
  • 242
  • 2
  • 3
  • 10
  • 1
    `I want to be able to restore the entire system with the click of a few buttons` - Run your linux boxes as a virtual machine? Snapshot the VM, back that up. – Zoredache Dec 09 '13 at 23:12
  • @Zoredache - That's creative--and I might end up doing that some day. How do I backup the host on which the VMs are running, then? – watkipet Dec 10 '13 at 00:35

1 Answers1

3

First, quit trying to roll your own backup solution.
Use Real Backup Software to do your backups.

Real Backup Software is extensively tested and has been beaten on by enterprise sysadmins for years. You can be confident that when you use it you will be able to restore what you've backed up.


As to the mounted filesystem / active files problem - any backup software (rsync, tar, bareos/bacula, even the venerable cp command) will copy files that are "in use" on a Unix system.
The problem that arises is that if those files are being actively modified you don't know what state you grabbed them in -- you could have a file completely rewritten while you're backing it up, and wind up putting useless garbage on your tapes.
As a general rule in order to ensure a good, consistent backup your filesystem (or at least the subset you're backing up) must be quiescent.

The only fully-automated solution to this I know of in the wild is Windows VSS. What you're proposing with the LVM snapshot/mount/backup/umount/destroy process is basically what VSS does through its API.

You can implement the snapshot solution you described using real backup software and a little creativity (in the case of bareos you would do it with with ClientRunBeforeJob and ClientRunAfterJob scripts) so it's essentially transparent, and it's a good solution - I heartily endorse it.

Note that this still isn't a "one click" restore. You're almost certainly still gong to have to do some manual work after you restore from your backups to get back to a running system. This is why you run restore tests.

For what my opinion is worth, I think "one-click restore" doesn't exist, and anyone who tells you it does is trying to sell you software. Probably expensive software.
The closest thing to a one-click restore is running your systems as VMs, snapshotting them periodically, and backing up the snapshots like Zoredache suggested.
The same admonition about using Real Backup Software from the top of my answer still applies when you grab the VM snapshots (but you probably won't need to do LVM snapshots because the VM snapshots will be quiescent by definition after they're created.

Selection of backup software for the hypervisor is left as an exercise for the reader -- it can be anything from bareos on Linux, ArcServe on Windows, or vSphere Data Protection on a VMWare cluster depending on your needs and budget...

voretaq7
  • 79,345
  • 17
  • 128
  • 213