On Sun, May 24, 2009 at 11:39:57PM -0700, Kelly Jones wrote: > I want to use rsync to backup a large file (say 1G) that changes a > little each day (say 1M), but I also want the ability to re-create > older versions of this file. > > I could use --backup, but that would create a 1G file each day, even > though I only "really" need the 1M that's changed. > > How do I tell rsync: "while updating, also store the changes you'd > need to convert today's backup into yesterday's backup"?
I don't think rsync can do that. Essentially it is a file copying tool. You could use diff if it is a text-only file, or xdelta if it is a binary file. But both would require you to keep at least two subsequent versions of the file so a diff can be generated. You'd need to do something like this every day: diff -u foo-yesterday foo >diff-20090525 # save the diff somewhere rm foo-yesterday cp foo foo-yesterday Another possibility is to control the file with a revision control system. If the file is plain text, rcs(1) will work. If it is a binary file use a system like devel/git that handles binary files well. Say that your file is called <bar>. Since git tracks directory contents, best put it in a separate directory, and put that under git control: mkdir ~/foo mv bar ~/foo/ cd ~/foo git init git add bar git commit -a -m "Initial commit" So now you can start changing the file. Next day you see if it has changed, and if so, check in the changes: cd ~/foo git status git commit -m "Changes 2009-05-25" bar If you now make a backup of ~/foo/.git, you can always restore every checkin you did of <bar>. Roland -- R.F.Smith http://www.xs4all.nl/~rsmith/ [plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated] pgp: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
pgpZ72158oy5H.pgp
Description: PGP signature