Live data from Hacker News

Ask HN: How do you backup your linux system?

news.ycombinator.com

71–80 of 86 posts

Re: Ask HN: How do you backup your linux system?

#71

Backup to external hard drive with btrfs. Rsync is used to copy the full source file system, with short exception lists for stuff I don't want backupped. After the sync, a btrfs snapshot is taken to get history. These napshots are removed with an exponential strategy (many snapshots are recent, few are old, the oldest is always kept), keeping ~30 snapshots a year. Backup takes ~10min for searching 1TB of disk space.…

> If the source had btrfs, I would use btrfs send/receive to speed it up and make it atomic.

btrfs subvolume snapshot / send are not atomic, for various definitions of atomic.

Unlike zfs, subvolume snapshots are not atomic recursively. That is, if you have subvol/subsubvol, there's no way to take an atomic snapshot of both. At least this one is obvious, since there's no command for taking recursive snapshots, so it tips you off that this is the case. Not having an easy way to take recursive snapshots, atomic or not, is a different pain point...

What's more insidious is that after taking the snapshot, you must sync(1)[0] before sending said snapshot, otherwise the stream would be incomplete! I'm invoking Cunningham's Law here and saying for the record that this is fucking retarded. I have lost files due to this...design choice.

Moreover, though is is probably a fixed bug, I used to have issues where subvolumes get wedged when I run multiple subvolume snapshot / send in quick succession. I'd get a random unreadable file, and it's not corruption (btrfs scrub doesn't flag it). Usually re-mounting the subvolume will fix it, and at worst re-mounting the while filesystem would fix it so far. I haven't had it happen for a while, but it's either due to my workaround -- good old sleep(60) mutex -- or because I'm running a newer kernel.

I can't wait until xfs reflink support is more mature: that'll get me 90% what I use btrfs for.

tl;dr: btrfs: here be dragons!

[0] https://btrfs.wiki.kernel.org/index.php/Incremental_Backup

Re: Ask HN: How do you backup your linux system?

#73
After being partially dissatisfied with various existing solutions, I have written my own backup software: file4life (http://www.file4life.org). I've been using it for the last 3 years and am currently working on a new release.

Its main advantages with respect to other approaches, at least for my use cases, are:

- metadata is stored in a single append-only file: no extra software (DB etc.) is needed;

- partial backups can be performed to separate storages. In fact, source and backup directories are not conceptually different, so a duplicate of a directory counts as a backup.

Re: Ask HN: How do you backup your linux system?

#77
post #56
post #19

I don't back up the system. Drive failures are so rare nowadays that I will reinstall more often because of hardware changes. The important stuff (projects, dotfiles) I keep on Tarsnap. I also rsync my entire home directory to an external drive every other week or so. Similar for servers but I do back up /etc as well.

Drive failures are really rare until they happen when your data is personal experience of a few devices. When you worry about a data centre or n and or rather a lot of other systems with storage then you realise that it happens with monotonous regularity. Now keeping a few short copies is also fine provided you don't make mistakes. Have you ever wanted to recover from a cock up you did six months ago or three years a…

My Tarsnap backups are versioned so I can recover dotfiles and projects from virtually any week several years back. And the projects themselves are usually under git.

Re: Ask HN: How do you backup your linux system?

#78
post #14

I've long used rsnapshot for automated incremental backups, and manually run a script to do a full rsync backup with excludes for /tmp, /sys and the like to an external drive. http://rsnapshot.org/

I use rsnapshot from cron to external USB drive encrypted with luks. I swap the drive with similar one weekly and store it offsite.

Re: Ask HN: How do you backup your linux system?

#79
Home - I back up the data areas. Dump the databases then run Back In Time which covers the home folder and my web folder. From that I can get from 0 to fully running in a few hours if necessary. And with Back In Time I have a usable portable copy of my stuff to take along when I need to.

At work we do regular TAR backups to external drives and SSH-rsync data to our sister office via VPN nightly. Backups are good for system restore then rsync back from remote to get to most recent.

Post reply on HN