Date: Tue, 08 Jan 2013 11:38:05 -0500 From: Lowell Gilbert <freebsd-questions-local@be-well.ilk.org> To: schultz@ime.usp.br Cc: freebsd-questions@freebsd.org Subject: Re: Backup with mtree and rsync? Message-ID: <44obgztytu.fsf@lowell-desk.lan> In-Reply-To: <20130105161256.49797e7viwwtqfc8@webmail.ime.usp.br> (schultz@ime.usp.br's message of "Sat, 05 Jan 2013 16:12:56 -0200") References: <20130105161256.49797e7viwwtqfc8@webmail.ime.usp.br>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44obgztytu.fsf>