From owner-freebsd-questions@FreeBSD.ORG Tue Jan 8 16:38:18 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id DC09E56F for ; Tue, 8 Jan 2013 16:38:18 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from asbnvacz-mailrelay01.megapath.net (asbnvacz-mailrelay01.megapath.net [207.145.128.243]) by mx1.freebsd.org (Postfix) with ESMTP id A7214BF1 for ; Tue, 8 Jan 2013 16:38:18 +0000 (UTC) Received: from mail8.sea5.speakeasy.net (mail8.sea5.speakeasy.net [69.17.117.53]) by asbnvacz-mailrelay01.megapath.net (Postfix) with ESMTP id 0C6F7A72CD9 for ; Tue, 8 Jan 2013 11:38:11 -0500 (EST) Received: (qmail 2643 invoked from network); 8 Jan 2013 16:38:11 -0000 Received: by simscan 1.4.0 ppid: 30362, pid: 13832, t: 0.1898s scanners: clamav: 0.88.2/m:52/d:13495 Received: from unknown (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail8.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 8 Jan 2013 16:38:11 -0000 Received: from lowell-desk.lan (lowell-desk.lan [172.30.250.8]) by be-well.ilk.org (Postfix) with ESMTP id 52E5F33C1D; Tue, 8 Jan 2013 11:38:05 -0500 (EST) Received: by lowell-desk.lan (Postfix, from userid 1147) id 1010439855; Tue, 8 Jan 2013 11:38:05 -0500 (EST) From: Lowell Gilbert To: schultz@ime.usp.br Subject: Re: Backup with mtree and rsync? References: <20130105161256.49797e7viwwtqfc8@webmail.ime.usp.br> Date: Tue, 08 Jan 2013 11:38:05 -0500 In-Reply-To: <20130105161256.49797e7viwwtqfc8@webmail.ime.usp.br> (schultz@ime.usp.br's message of "Sat, 05 Jan 2013 16:12:56 -0200") Message-ID: <44obgztytu.fsf@lowell-desk.lan> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jan 2013 16:38:18 -0000 schultz@ime.usp.br writes: > I have been wondering whether it is possible to create a backup system > using mtree and rsync. Essentially, the user would create a mtree > specification of the source directory and copy it over to the destination > directory with rsync. Any changes in the destination could then be > detected before restoring with the mtree specification, which should > contain strong hashes of the files and should not contain the nlink > keyword. > > The problem is that mtree would be too slow. It would recompute the > hashes of big files even when they did not change from the last backup. > Therefore, I would like to ask if there is an easy way to accomplish > the following. > > Let a mtree specification of a directory from a certain point in the > past be given. Also, assume that a (regular) file below that directory > has not changed if its current modification time (mtime) equals > its modification time in the past specification. > Produce as output the new mtree specification for the directory without > reading these files. > > This is somewhat like rsync does to perform incremental backups. Except that you have a spec for mtree to be sure the backup copy hasn't been corrupted. I don't see any way to do this directly. What you probably want to do is use find(1) to pick out the new files to check, and then merge the changes into the old mtree(8) spec. Not trivial, but the spec syntax is intended to be easy to parse, so it shouldn't be that hard either. > P.S.: As an aside, is there an utility in the base system that can > reproduce the behavior of `rsync --delete -a dir0/ dir1/`? It's possible that the mtree support in tar(8) might be able to do it, but it would probably be a lot slower.