Date: Mon, 25 May 2009 21:26:48 +0200 From: Roland Smith <rsmith@xs4all.nl> To: Kelly Jones <kelly.terry.jones@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: Using rsync for versioned backups without --backup Message-ID: <20090525192648.GB39139@slackbox.xs4all.nl> In-Reply-To: <26face530905242339g448b7047s72fcff768a2346f1@mail.gmail.com> References: <26face530905242339g448b7047s72fcff768a2346f1@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--LyciRD1jyfeSSjG0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > I could use --backup, but that would create a 1G file each day, even > though I only "really" need the 1M that's changed. >=20 > 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.=20 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 --=20 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) --LyciRD1jyfeSSjG0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkoa8PgACgkQEnfvsMMhpyWRXACfb9FYiBWO0aevXbIrNobBCxg1 ZUQAni0nGpH31qcdVjIkdQIFJNO4iX9g =Cebb -----END PGP SIGNATURE----- --LyciRD1jyfeSSjG0--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090525192648.GB39139>