Time rsYnc Machine (tym)
ca at dragoman.org
Sat Jul 28 04:48:58 MDT 2012
These are comments to several previous posting.
tym is a wrap: the hard work is done by rsync, with whatever limitations it might have, in particular for "non-atomic".
Each backup is a new directory; "--backup" is not used as no renaming is required.
2. Time machine implemented inside rsync
As one can observe from tym, it should be straightforward to implement a time machines inside rsync:
rsync ... --tm-source --tm-dest [--tm-machine] [--tm-log]
The correct parameters should be automatically included. Finer aspect such as atomicity could be better considered.
If it is appropriate is a different matter.
It can run properly run from cron as it is demonized.
4. Remote machine
- As long as tym is concerned, it is client-side.
- The communication is with ssh and rsync.
- No filesystem mounting is required.
- Unattended execution requires ~./ssh keys to avoid password prompting from ssh and rsync.
5. Finding the latest backup
In function MakeDest, locally (or remote with ssh), the line
; else ls $DestDir | tail -1
6. Creating new directory
Created by bash (not rsync) in function MakeDest, locally (or remote with ssh), the line
; then mkdir $DestDir
The tree below by rsync.
7. Automatic space recovery
I will put this in the wish list.
- Calculate the needed space.
- Check the maximum allocated space (it could be less than total available).
- Delete as necessary the oldest version with appropriate heuristics.
tym is "pull".
8. rsync parameters
See the function Sync, the concerned parameters are:
rsync -azhq --delete --partial
For the first run. "--link-dest" is not present: the variable "$LinkDest" is empty.
"--hard-links" is not used and there is for and against reasons. From man rsync:
"... finding multiply-linked files is expensive."
"Without this option, hard-linked files in the transfer are treated as though they were separate files."
9. Wish list
- More comments in the code
- Improve man page for tym
- Autoamtic space recovery
- tymkill: command for soft kill with SIGTERM.
- tymold: command to delete oldest backups
More information about the rsync