From owner-freebsd-questions@FreeBSD.ORG Mon May 25 19:26:51 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 223A310656A5 for ; Mon, 25 May 2009 19:26:51 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr13.xs4all.nl (smtp-vbr13.xs4all.nl [194.109.24.33]) by mx1.freebsd.org (Postfix) with ESMTP id 90DA88FC3C for ; Mon, 25 May 2009 19:26:50 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr13.xs4all.nl (8.13.8/8.13.8) with ESMTP id n4PJQnMg079584; Mon, 25 May 2009 21:26:49 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id E397BBA98; Mon, 25 May 2009 21:26:48 +0200 (CEST) Date: Mon, 25 May 2009 21:26:48 +0200 From: Roland Smith To: Kelly Jones Message-ID: <20090525192648.GB39139@slackbox.xs4all.nl> References: <26face530905242339g448b7047s72fcff768a2346f1@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LyciRD1jyfeSSjG0" Content-Disposition: inline In-Reply-To: <26face530905242339g448b7047s72fcff768a2346f1@mail.gmail.com> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: freebsd-questions@freebsd.org Subject: Re: Using rsync for versioned backups without --backup X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2009 19:26:51 -0000 --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 . 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 . 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--