Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

closed as off-topic by Zoredache, Andrew, MadHatter, mdpc, Jenny D Dec 11 '13 at 8:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve." – Zoredache, Andrew, MadHatter, mdpc, Jenny D
If this question can be reworded to fit the rules in the help center, please edit the question.

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 9 '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 0:35
up vote 3 down vote accepted

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...

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.