by izacus · 5y ago · 0 comments
It needs to:
- Handle random sleeps / disconnects properly without corrupting backup,
- Resume backup in progress if the process was interrupted due to sync or network issues.
- Be resilient to sleeps/wakeups in a way that it won't just fail to backup the machine for months on end.
- (Bonus) Be able to skip backup when connected to mobile hotspots or other slow networks.
Any ideas? I'm very happy with Arq backup on Windows/macOS, but I just can't seem to find anything on Linux. Everything just assumes a hardwired workstation/server and completely falls apart on a laptop.
Still, I'd be surprised if mainstream backup solutions corrupt your backups in case of sleep / disconnect. That would be a pretty big bug. Borgbackup also handles resumes IIRC. Your third point is unclear, you'd have to try in practice. But if throughput * time awake < size of compressed deduplicated data, you obviously cannot expect your backup to complete. I guess you just rephrased your second point.
For the last point, personally I think I'd take care of mobile hotspots / slow networks with a script wrapper rather than expecting the backup software to handle this.
Regarding schedule that could be part of the service, but a simple cronjob can also do the trick depending on what you want exactly.
A simple crontab entry to run restic every hour should work. I tested it running every minute and that worked fine.
If there's a chance that the laptop would sleep and stop restic in a mid-backup that was started by cron, then this[1] suggestion would probably be sufficient to work around that:
[1]: https://news.ycombinator.com/item?id=25552894
What I'm not sure about is whether restic would resume backing up a large file from where it left off if interrupted, or if it must re-backup the entire file.
Perhaps someone could take the excellent Deja Dup GUI, which is a front-end for the technically inferior duplicity, and have it shell out to borg instead.
I think you should look into the 'borg' backup tool - it has become the de facto standard for remote backups because it does everything that rsync does (efficient, changes only backups) but also produces strongly encrypted remote backup sets that only you have a key to ... the remote has no access to the data.
The borg website is here:
https://borgbackup.readthedocs.io/en/stable/
and a good description of how it works and why you should use it is here:
It's literally the tool I was thinking about when I said "all tools expect a wired workstation".
I don't want to manually write bash scripts to resume and check backup status.
You can replace a command like this in your crontab:
rsync blah blah
with a command like this: rsync blah blah ; rsync blah blah ; rsync blah blah
See what I am doing there ? I sometimes deploy this hack with very spotty WAN connections but the laptop sleep/wake is basically the same thing ... you wake up the laptop and the running command bombs out and the next one starts.The reason this "works" is because rsync picks up right where it left off on a broken transfer. I believe restic and borg have similar behavior ...
If this is a strong enough use case then I have a couple ideas on how to implement it (I'll throw it in the wishlist). Otherwise, currently if you have an interrupted backup the next one will still re-use the files already on the server, even if it is part of a partial backup.
My current work around for my main linux laptop is setting rclone to run with crontab at a time that I know i’ll be online for an extended period (evenings during long homework sessions). I’ve been doing this for several years and have yet to run into major show stopping bugs, and I frequently do checksum verification on my backups.
https://joeyh.name/code/git-annex/
It lets you use git to back up large files. However, it's built for a git-sized number of files and not built for, say, your entire home directory.
If you have enough local storage, I'd put a local backup process (restic/borg/bup), and then rclone/rsync your backup repository to remote storage.
If you don't have enough local storage, you can restic or bup to a remote server reliably as long as you can complete one scan. On my laptop with a 256GB SSD, a common restic scan with cold caches takes less than 15 minutes; an hourly backup is a few hundred megs, a daily backup is often close to 2 gigs, depends on how many files you have, and how many (and how much) of them change.
Alternatively, you can do an rsync-based snapshot.
I want to avoid writing them - last time I ended up with devices not backed up for months because the backup tools ended up in a partially broken state that caused silent failures.
Hence why I want to have a tool designed for this use-case and not a bunch of bash shell scripts in cron.
I don't know if Syncthing has your bonus point, as I don't use mobile hotspots much.