For a very very long time, I’ve wanted a proper backup solution for Linux.
What I want ∞
It’s simple, really.
-
Mirror everything from source A to destination B.
- Mirror also means: Delete anything from destination B which is not on source A
- Do it in an efficient way, so I don’t have to mirror the whole partition every time.
-
Don’t suck.
I know now that because I’m asking the obvious common-use case, I’m somehow asking the impossible.
I’ve used a HELL of a lot of different tools for doing Backups. I don’t even want to go through how disappointing they all have been. I don’t want to have to hack together a solution. I want a program that will “just work”. Again, I seem to ask the impossible.
I’ve played with all kinds of RAID options, as far back as when softRAID on Linux wasn’t even alpha yet. That’s not a solution that I want, for reasons I don’t want to get into here.
I want to focus on two tools: Unison and rsync.
Unison ∞
I had Unison lined up to be the major contender. I was even using it for a while.
Except today I learned that it was being a complete dumbass. I almost b0rked my system because I trusted it. This was what I was using.
unison cmd -times -batch -ui text -force "${1:-.}" -root "${1:-.}" -root "${2:-.}"
Unison also leaves behind all kinds of temp files if it’s aborted for whatever reason. I found these commandlines to be useful:
find "${2:-.}" -type f -name '.unison.*.unison.tmp' -exec rm -fv "{}" ; find "${2:-.}" -type d -name '.unison.*.unison.tmp' -exec rm -rfv "{}" ;
I have no clue how I was fooled into thinking Unison actually did anything. All kinds of files were being completely ignored. I don’t even have the strength to troubleshoot this kind of nonsense.
It really is no wonder that people get “stuck in their old ways”. Especially with software, disappointments are around every corner.
Seriously, I was about to repartition and trust a couple of Unison mirrors to do a restore.
rsync ∞
rsync is the king. And it’s horrifyingly annoying to use, like any decent Linux commandline tool.
This isn’t so bad:
rsync -av --delete /source/ /dest/
This one is a bit better:
rsync --archive --bwlimit=10000 --verbose --delete-before --progress /source/ /dest/
However, I’ve reproduced issues where rsync cannot deal with a filesystem which is nearly full. Two exact partitions, and one cannot be mirrored to the other.
Summary ∞
When you have 700,000 files and 15 years of work put into it, a good backup solution gets to be important.
What I really REALLY want is what the new Linux filesystems will be capable of – full data checksumming. So. Much. Win. (update: see Btrfs!)
