On Tue, Mar 7, 2017 at 12:04 AM, <the...@sys-concept.com> wrote: > I was looking at this rotating backup script > > source: > https://community.spiceworks.com/topic/34970-how-to-create-rotating-backups-of-files >
If you're looking for rotating backup solution based on rsync I'd take a look at rsnapshot. It is in the Gentoo repo, and it has been completely dependable in my experience. You get the same kind of storage you'd expect with plain rsync (just a replica directory tree that you can freely read, cp from, etc). However, it does stuff like ensure backups are complete before rotating them in, handling the rotation itself, and also linking incremental backups with hard-links to reduce storage. It isn't quite de-duplication but it gets you 90% of the benefit vs having a bunch of complete backup directories that each take up the capacity of a full backup. Basically it copies the last backup using hard links, then rsyncs over that. The result is what looks like a bunch of full backups but without all the space use. If you're looking for something even more space-efficient that is still based on rsync but which does not store its files as a simple replica directory tree then look at duplicity, which is also in the Gentoo repo. It stores the data in compact archive files like most other backup solutions, but it uses librsync to do most of the heavy lifting. If 1kb changes inside the middle of a 1TB file it only stores the extra 1kb, just as rsync would only transfer the 1kb. It also has a bunch of backend options, including a few cloud services like S3. For remote backups it is pretty smart about how it stores metadata vs data so that if the local cache gets out of sync it can just re-fetch the metadata from the cloud without having to retrieve the actual backup data, and it supports gpg. I personally use both right now. High-value files are saved using duplicity to an S3 backend, fully gpg encrypted. Since I like to mess with zfs/btrfs I also keep a full replica of those drives locally on ext4 using rsnapshot. This is very easy to restore should btrfs eat my data (and I've made use of it twice). Rolling your own can certainly be an educational experience, but IMO it is unnecessary. Of course, be sure to test recovery no matter how you end up setting everything up. -- Rich