Best Linux server backup system?
gist.github.com
gist.github.com
Unfortunately most backup software designers seem to think in an extremely one-dimensional way about how backups should work and I do not know about one tool that offers all the flexibility you need for real life backups.
There is really room for invention here.
IMHO BackupNinja shows the right direction: it is a meta-tool that helps you to manage several different backup strategies. This is the way to go, but it should be generalized and have an API and several GUI options (web, qt, rest).
Also some more brain could be put into the application, like a nice wizard will ask you to define how you would like to have your backup and select the right tools for you:
[ ] source
[ ] it is a database
[ ] which one: ________________
[ ] very big files (oh, I already know about this)
[ ] Mickysoft client
[ ] Outlook
[ ] other crapsoft that needs special handling
[ ] look up the plugin repo for the best way to handle this
[ ] Linux / *BSD
[ ] destination
[ ] encrypt backups
[ ] versioning
[ ] frequency
[ ] make backup files browsable by filesystem tools
[ ] also browsable for users (readonly)
[ ] make backups available via samba
[ ] make backups available via nfs
[ ] make backups available via web gui
[ ] where to browse: ________________
[ ] import csv with usernames
[ ] auto-generate login link for users (no future support hassle)
[ ] decide which is the best (set of) tool(s)
[ ] and just do it and let me do the real work
Certainly there is some more to it, but maybe you get the idea.If you are bored and do not know which should be your next project, please release the world from all these backup pains (and wasted hours and weeks) and build it, thanks! Good Luck!
I think YAML based configuration would make it very easy to work with once created and offer ends less possibilities of integration and generation from/to other applications.
If someone made this - I would donate them money.
Bonus points for a nice visualisation of backups and when they expire etc...
When you use our snapshotting, RAM-state, cpu cache and disk-state are all captured and can be resumed in seconds later. This all happens without a hypervisor.
This sort of obfuscates the need for doing any configuration storage (you snapshot systems at an initial state and then you can bring up new machines at that initial state without config files. If you need to pass an argument to a machine on boot you can do it programmatically by passing the shell commands [2]).
[0] http://crd.lbl.gov/departments/computer-science/CLaSS/resear... [1] https://www.terminal.com/snapshot/c81e6215eba5799335a45b6936... [2] https://blog.terminal.com/tutorial-terminal-startup-scripts-...
Check out Deltaic, designed precisely for this:
I was describing a meta tool that would act like an experienced backup admin and setup the whole process / environment. E.g. this tool would configure network shares or a webserver with authentication to access the data, that deltaic restored.
However, such a tool does not exist, so I will study deltaic when there is some more time to waste with backup research. :)
I was focusing on the lower-level building blocks.
Pros: it's stable, supports several different transfer methods, is completely simple (and still flexible) to admin, and it's totally reliable. It does file deduplication and compression and manages its own pool very efficiently. I've had it responsible for networks of 50+ systems before and it worked without any trouble. It has a sensible and reliable email notification system. It gets the basics really right, which for some reason seems to be a problem with a lot of other backup software. The documentation is good. The developer is friendly, has been working on it for over a decade now, and is easy to reach by email. There's a quiet mailing list with some folks that have used BackupPC for Truly Large Networks and know it about as well as the developer. Version 4.0 is pretty awesome. It has saved my butt a few times and a client's butt at least twice. Also, it's free, assuming you have a server somewhere to run it on; it's not a SaaS or PaaS or YaWaaS, so there's no monthly cost.
Cons: it doesn't do encrypted backups. It's written in Perl, so that's probably a deal breaker for some people who don't know any better. Initial setup can be a bit of a pain, especially if you're new to it. The web interface doesn't use jQuery or LESS or CSS3 transitions or a lot of stock photography, so some people might find it scary-looking. It doesn't hold your hand, you'll have to be comfortable with the CLI every once in a while if you need to do something fancy (like, say, restore a batch of files to their original locations using a text file as input -- which I've done with it, btw). It won't make you coffee in the morning.
Backup data rests on a seperate, encrypted partition.
On the complaint that it doesn't do encryption -- That is one item that I'd like to seek some advice on. My plan is that if you want encryption, then use a LUKS encrypted filesystem on the target (communications to the target is already encrypted with ssh). The main reason is that I'm not a cryptographer, and even if I use existing libraries there is still a strong chance that I'd miss something and end up using them wrong. Just for example -- to do it right, you would add unique salt to each object you are encrypting (from the client side). That would then render any type of deduplication useless on the backend side, since multiple files with the same contents would have different encrypted contents.
That being said, I am adding code that lets you have replicas to other storage devices (tape, cloud, other disk based storage). So you would do your primary backup to a local disk device (that possibly has an encrypted volume), then the secondary stage would be packing files together into an (encrypted) object, for sending to a remote location.
I've got a small list going, after I redo the web site I'll put up a planned feature list along with comparisons with other backup utilities. If anyone has ideas to contribute, either drop me an email or open an issue on the Github page.
Thanks.
Edit: On the encryption side, am I correct in thinking that multiple files with the same contents should encrypt to different streams (via a random salt)? Also, should the file names themselves be encrypted? Finally, metadata, such as mod date, file size, and checksum -- should that all be encrypted too? Thanks.
The variation: Run snebu locally, and have the file vault loaded on an iscsi device targeted to the remote backup server. Then you can run LUKS locally, and not have to worry about trusting the remote server. Just make sure you send a copy of the sqlite database file (containing the backup catalog) to the remote volume after a backup. However, this still doesn't address having a remote encrypted volume that multiple clients can send to (in that case, you will need to do the other approach of sending to a local server under your control, then replicating it with a plugin that supports encryption [to be developed yet]).
Note, this method should work for any of the other backup utilities that don't support encryption also.
The solution is: on the client side, include an optional encrypting tar filter, which takes a tar file as input, and encrypts the file contents of each file within the archive, delivering a tar file output with regular headers, but compressed encrypted files. I'll probably have to take some liberties with the tar file format, but as long as the snebu backend is similarly modified (to recognize a pre-compressed and encrypted file segment), then I should be able to get it to work without any major compromises.
The only issues with my current plan are: 1) Multiple files with the same contents will still be de-duplicated, which may leak some information (if an attacker already knows file A's contents, and B is marked as being a copy of A, then the attacker will know what file B is). 2) The metadata (file name, size, owner, possibly SHA1) will still be visible. Although I may just use the SHA1 of the encrypted version as the file reference. 3) Sparse files will still show where the "holes" in the files are, unless you tell it not to preserve file sparseness.
If you control the server the main purpose of encryption is to protect the backups even if somebody gains access to the backup server. An encrypted filesystem isn't a good solution because by design the backup server has the key. This only protects against intruders that are foolish enough to power down the server. As long as the server is running, an encrypted filesystem offers no protection at all.
The problem is though, that the last time I've checked, it was excessively simple- it didn't support individual files selection.
From what I can remember, a lot of the slowness came from GPG, and specifically files being compressed before encryption. Disabling compression speeds things up, but trades off disk space (and security).
I wonder what it'd take to reengineer the thing to take advantage of multicore -- being CPU-bound on a single core is I think what makes it slow.
It is a bit unclear if you haven't been looking at other snapshot management utilities. Many other tools have various dependencies which may or may not work on your chosen operating system.
So generally the requirements are:
- ZFS running on the volume you want to snapshot
- Bourne shell
- Gregorian calendar
As far as OS X goes, I'm not sure how many people run ZFS in production but I know there were some people working on it. I've never used it but it still seems to be updated: https://github.com/openzfsonosx/zfsOur strong suit is the ability to point any SSH tool you like at our storage (rsync, mostly, but some folks point duplicity or unison).[1]
Also, as we run on ZFS and have daily/weekly snapshots enabled by default, you can just forget about incrementals or versions or datasets ... just do a dumb mirror to us every day and we'll maintain, live, browseable, in your account, what is essentially an offsite "Time Machine".
We have an HN readers discount. Email and ask about it.
[1] http://www.rsync.net/resources/howto/remote_commands.html
While you might disqualify it due to lack of built in encryption, you should note that given that one of your comments implies you control the server where the backups enter cold storage that you can encrypt the disk/array where the backups are stored independent of the backup tool used to copy the data to the backup server.
The offsite backups are on USB drives that are encrypted.
We just created a shell script to automate that, and run the database dumps prior to running rsnapshot.
It uses ZFS to do the heavy lifting of managing deltas and deduplication and rsync to do the snapshots. Combined with backup-client (https://github.com/realgo/backup-client) it can run as non-privileged users and trigger database dumps or snapshots, LVM snapshots of virtual machine instances, etc...
We have had it running internally on clusters of 10 backup servers, and several external backup servers over ~a decade, and it has worked very well.
At one point we switched to BackupPC, but ended up switching back to this after around a year. BackupPC implemented its own rsync code, which (maybe this is fixed now) didn't support incremental file-data transfers in the rsync version 3 protocol, so large systems could take hours to build the file index and then hours to re-walk the file-system to send the data. Larger systems were taking longer than 24 hours and tons of IOPS to backup.
It also wasn't very efficient, when we switched back to ZFS, we consolidated 4 Backup PC servers down to one with ZFS holding the same data. The biggest issue there was log and database files, big files that had small changes resulted in the whole file getting stored multiple times. Particularly Zope ZODB files killed us, they are append-only and we had users with 2+GB files that had small changes every day.
Yes it's hard to approach (we spent ~2 weeks to learn and test it before deploying in production) but it had the features we needed:
* scheduling
* retention policies (store for 1 year then rotate, multiple tapes, etc...)
* backup on DST tapes
Perhaps, if you just need to backup a single server, Bacula isn't the right solution or, at least, is overkill :-)
- Uses native OS tools (tar, gzip, gpg in my case) for the actual backups and restores, and includes the actual command used to create the archive in the header of the archive! You can use this to restore it without Amanda in the event of an emergency.
- Supports on-disk backups in a holding area for quick restores
- Supports S3 as a virtual tape library
- Supports vaulting (i.e. moving an archive from one tape library to another)
- Your choice of client, server, or no compression & encryption
- Highly scriptable
- Works over SSH, among other methods
- Catalog data is easily backed up itself via simple OS commands, and stored in S3.
The systems I backup are all in AWS, so this is ideal for me. I've frequently thought it would be ideal to adapt Amanda's script agents to creating EBS snapshots, but I simply haven't had the time. It's on my someday-maybe list. Remember to vault your backups to another region!
(Edits: formatting)
An example was that a restore of ~200 GiB of VM snapshots took over a day from a NAS to the server in question.
Usually, the backups take about an hour to write out, so reading data from attic does take significantly longer.
This is probably because dedup is non-trivial to restore from (it can involve lots of random reads/disk seeks).
It's probably also wise to roughly group the backup systems by algorithm-class (e.g. separate rsnapshot from rdiff-backup from duplicity from attic/obnam/zbackup) since they result in different bandwidth and storage properties. Duplicity will need a full re-upload to avoid unbounded growth of both storage and restore-time, but such a re-upload is prohibitive for DSL users.
i've been using the above as a really half assed way of doing backups on a server. using a nas instead of a usb hdd. very glad to benefit from the experience of others here.
: )
jwz's method is fine for disaster recovery, but it doesn't work for recovery from other kinds of errors (including human) since it only saves the last copy of the files.
In our case, the most important backups are the databases (servers can be rebuilt from config management), and having past copies definitively helps.
With rdiff-backup, we can restore the databases from any day for the past couple of years, and since it's incremental, it doesn't really take up much space.
zx2c4@thinkpad ~ $ cat Projects/remote-backup.sh
#!/bin/sh
cd "$(readlink -f "$(dirname "$0")")"
if [ $UID -ne 0 ]; then
echo "You must be root."
exit 1
fi
umount() {
if ! /bin/umount "$1"; then
sleep 5
if ! /bin/umount "$1"; then
sleep 10
/bin/umount "$1"
fi
fi
}
unwind() {
echo "[-] ERROR: unwinding and quitting."
sleep 3
trace sync
trace umount /mnt/mybackupserver-backup
trace cryptsetup luksClose mybackupserver-backup || { sleep 5; trace cryptsetup luksClose mybackupserver-backup; }
trace iscsiadm -m node -U all
trace kill %1
exit 1
}
trace() {
echo "[+] $@"
"$@"
}
RSYNC_OPTS="-i -rlptgoXDHxv --delete-excluded --delete --progress $RSYNC_OPTS"
trap unwind INT TERM
trace modprobe libiscsi
trace modprobe scsi_transport_iscsi
trace modprobe iscsi_tcp
iscsid -f &
sleep 1
trace iscsiadm -m discovery -t st -p mybackupserver.somehost.somewere -P 1 -l
sleep 5
trace cryptsetup --key-file /etc/dmcrypt/backup-mybackupserver-key luksOpen /dev/disk/by-uuid/10a126a2-c991-49fc-89bf-8d621a73dd36 mybackupserver-backup || unwind
trace fsck -a /dev/mapper/mybackupserver-backup || unwind
trace mount -v /dev/mapper/mybackupserver-backup /mnt/mybackupserver-backup || unwind
trace rsync $RSYNC_OPTS --exclude=/usr/portage/distfiles --exclude=/home/zx2c4/.cache --exclude=/var/tmp / /mnt/mybackupserver-backup/root || unwind
trace rsync $RSYNC_OPTS /mnt/storage/Archives/ /mnt/mybackupserver-backup/archives || unwind
trace sync
trace umount /mnt/mybackupserver-backup
trace cryptsetup luksClose mybackupserver-backup
trace iscsiadm -m node -U all
trace kill %1Actually I think this is how most solutions started...
lru-size=1024
upload-queue-size=512
See http://listmaster.pepperfish.net/pipermail/obnam-support-obn...
The only novel thing is its use of symmetric encryption keys which are used to encrypt the data and are included in the backup repository, encrypted by your regular private gpg key. This allows giving additional gpg keys access to the backup after it has been made. http://liw.fi/obnam/encryption/
(Which is useful for eg, backing up a server. You can make a dedicated gpg key for that server, but give your personal gpg key access to the backups to restore later.)
Anyway, the generation of the symmetric encryption key is what needs an entropy source. AFAIK this is done once per repository.
* use of pkbdf2(passphrase)[0:32] as encryption key?
* is AES correctly used? there are many pitfalls
I would be much more comfortable with it using gpg for encryption.Furthermore, all the crypto config depends on gpg defaults or your gpg.conf. Whether this is good or bad depends on whether you are OK with gpg's defaults that are chosen for a non-Obnam use case and whether you like tweaking gpg config.
While figuring this out, I started wishing that Obnam used libsodium instead of gpg to avoid configuration and especially gpg-agent. (libsodium didn't exist when Obnam was created.)
Did you try Keychain¹? I've used it in the past to auto-sign deb packages, and it was simple to set up.
Having to be aware of tools like this is the problem when you face the requirement of having to set up gpg-agent and you don't already know how to do so in an environment where a desktop environment from your distro hasn't done it for you.
PASSPHRASE="myBackupGpgKeyPassphrase" duplicity ...
I use one gpg key per machine for backups, so having the passphrase in cleartext on that machine is not much of a problem.I finally ended up by sending encrypted gpg tar files to a remote backup machine (you may want to cross-backup machines) (without using any intermediate file)
(sorry if formatting breaks)
#!/bin/bash #
# list of local directories to be backuped DIRS="/home /media"
# destination directory target DEST="/data/backups"
# gpg encryption email GPGEMAIL="homer@example.com"
# remote ssh as user@pachine REMOTESSH="homer@backup.example.com."
# remote ssh additional args REMOTESSHARGS="-i /root/.ssh/id_backup"
for i in ${DIRS} ; do if test -d "$i" ; then
f=${DEST}/$(echo $i | tr '/' '_' | sed -e 's/^_//').tgz.gpg tmp=${DEST}/_tmp
echo "backuping $i to remote $f encrypted with pgp" >&2 /bin/tar cf - ${i} \ | /usr/bin/gpg --quiet --batch --encrypt --compress-algo zlib --recipient ${GPGEMAIL} -o - \ | /usr/bin/ssh -p ${REMOTESSHARGS} -o BatchMode=yes -o Compression=no ${REMOTESSH} \ "cat > $tmp && mv $tmp ${f}"
else echo "error: $d does not exist" >&2 fi done
Other than that my vote is on ZFS snapshots reliable.
I agree with ZFS but I think it shines as a last resort backup (like rsync.net offers) and not as a main backup system since it doesn't do incremental and deduplication and so on...
You can request any schedule of days/weeks/months you want, and their (very small) space usage counts against your paid quota. The first 7 dailies are always free (don't count).
What this means is you can just do a dumb rsync to us. No incrementals, no expiring datasets, no logic at all - just rsync to us every night and our snapshot rotation schedule does the rest for you. Just browse right in (using the SSH/SFTP based tool of your choice[1]) and grab a file from 6 days ago.
Email us and ask about the HN readers discount for new customers.
[1] Like filezilla, or SSHFS, or our windows drive mapper
Then there is the feature that ZFS has checksums, so that when you write to disk you know what you get otherwise you can get corruption. RAID5-60 for me is a gamble that you can get hidden write disk errors unless there is checksums in software on a higher layer.
Always scrub your ZFS source and backup pool.
(1) IBM software seems so be designed by smart people for really hard scenarios, but it all gets buried under tons of enterprisey crap and UIs designed by monkeys...
1. Drop the excruciatingly slow and clunky web console and learn to use the CLI (really, it's horrible);
2. Resist the urge to throw your arms up in disgust because the syntax and concepts seem foreign (it probably won't look so foreign to mainframe people, and it isn't actually bad, just different);
3. ??
4. Realize the CLI and storage concepts are actually very powerful.
Back In Time is basically just a GUI wrapper around rsync that manages snapshots for you. I used to have an rsync script that did the same thing manually, but it's great to have a tool that manages the snapshots for you so you don't have to remember to update the symlinks individually.
Unlike rsync[1], Back In time does incremental backups, so you save on storage space if your files don't change often.
[0]https://wiki.archlinux.org/index.php/Back_In_Time
[1] by default, that is - you can use rsync to achieve incremental backups, which is what BIT does
It has a modern looking web-ui too: http://www.bareos.org/en/bareos-webui.html
And then make hard-links of all files to another folder, named BACKUP_yymmdd
This way, the backup is incremental, and you have snapshots of older versions of the backup, where there is structural sharing between snapshots.
It does provide lots of flexibility, though, you can restrict who gets to restore which files onto which servers, for example, or the ability to backup to different targets.
Regarding clock sync, that hasn't been a problem for ages: “Note, on versions 1.33 or greater Bacula automatically makes the necessary adjustments to the time between the server and the client so that the times Bacula uses are synchronized.”
What makes things a pain on Linux is applications have parts strewn all over the filesystem. My stuff has a /home, why isn't there an /OShome, and an /Appshome?
All of them reside under `/usr`. At least with my distro.
> My stuff has a /home, why isn't there an /OShome, and an /Appshome?
With monolithic repositories,* how would you code it?
* Ie. system and apps come from the same source, unlike eg os x where the distincion is clear.
Imho it's ideal to have the application handling the data also create the backups. And then transport them to remote locations via any means viable or any of the in the article mentioned backup systems again. Though having the application back things up vs backup software, i tend to think there is less tuning required, less chance on external locks etc etc.
But the same applies to that. These 'other data formats' from other sources too, could also be replicated from the software handling them, assuming again! :o)
edit
Speaking from a perspective where i have seen many parties that went wrong with their '3rd party backup application', i tend to try to replicate most from the application themselves to other (safe) locations, then to rely on a 3rd party app which got setup in 2005, but in the meantime received little attention. Hence i prefer to look at the application generating/receiving/handling the data.
Attic seems promising. Does anyone have any experience of that versus bup?
So does Arq (OSX backup software), as well as Glacier.
This makes large-size backups very cost-effective.
I mean, some of the newer ones (e.g. Attic, Bup) certainly do look good, but you need a full-fledged Linux server at the other end, as opposed to being able to just shove it into S3/Glacier - this to me is a drawback.
https://spideroak.com/faq/questions/67/how_can_i_use_spidero...
You need block-level deduplication to work well with things like VM images.
I've got a solution in the works specifically for KVM images, that hopefully I'll be able to finish up the next time I get a week off of work. The way I'm planning on handling that (at least for LibVirt based VMs) is to use libguestfs to create an equivalent to the `find` command (with all the -printf options that it supports), and to generate tar file output of selected files from the VM. (Snebu is designed around only requiring find/tar on the client side -- so anything that can produce this output will work). Although I don't like that libguestfs actually fires up a VM in order to work with the image files -- I may work on an approach to read the qcow2 file images directly. Again, looking forward to a vacation this spring so I can pound out that module.
So while yes, there's no "native support" it's definitely not hard to add.
While this is just a random google result[1] as I don't have access to the aforementioned snippet, you'll get the idea I hope.
If duplicity had an option to chose a backup ancestor, you could use backup2l with duplicity.
backup2l is strikingly simple and very effective at managing restores from it's incremental backup hierarchy.
In one of my tests (more than 2 years ago), the backup efficiency of daily, 3-level hierarchical tar (such as backup2l) vs Duplicity for a 1 year period was only 15% greater yet giving much more redundancy in case of failure.
If you consider how simple archives are and can be restored in case of problems, it's almost a no brainer.
And it has a neat curses based GUI called NinjaHelper
That's correct, Backupninja can use Duplicity as a backend: https://labs.riseup.net/code/projects/backupninja/wiki/Dup
This example keeps the days worth of filesystem backups:
rm -rf backup.3
mv backup.2 backup.3
mv backup.1 backup.2
cp -al backup.0 backup.1
rsync -a --delete source_directory/ backup.0/
More details: http://www.mikerubel.org/computers/rsync_snapshots/Trinkup is a script that automates this approach, somewhat like rsnapshot:
Performance, it's super damn fast. Because the ZFS snapshot itself is just a stream you can also compress it on the wire.
Flexibility. You don't need to send the snapshot to another ZFS server. You could just take the ZFS snapshot streams and store them on say S3 compressed and re-assemble them. This would take custom tooling but it's definitely possible.
You can restore super quickly to an older version if you haven't deleted the local snapshots.
Similar to above but if you don't want to restore (as in make said snapshot the current active dataset) you can create a writable clone of one of the snapshots to play with it before committing to a restore or just to "go back in time" and play with something.
As a bonus you also now have your data on ZFS which has tons of great benefits apart from the point in time snapshots.
* Assumes remote is available 100% of the time. Recovery from downtime at the remote probably requires some manual intervention to get things back in sync.
* If the remote is in a different physical location with limited bandwidth between the hosts, compressing the stream on the fly isn't going to be particularly efficient with bandwidth.
I've built some scripts to help[3], dumping the necessary incremental streams into a local directory and then compressing them with lrzip[4]. This decouples the host and remote systems and the zfs streams compress really well: a 33Mb incremental stream I have here compresses to 4.4Mb with lrzip. Once you have a directory of compressed streams you can push them wherever you want (a remote server where you convert them back into zfs snapshots, giving you a live filesystem; S3 buckets etc.) You also are able to restore using standard operating system tools.
I'd assume btrfs is comparable, but haven't tried it myself.
[1]: https://github.com/zfsonlinux/zfs-auto-snapshot
[2]: see https://github.com/adaugherity/zfs-backup for example
[3]: currently in my local fork of zfstools at https://github.com/mhw/zfstools/blob/master/bin/zfs-save-sna...