Looking over rsync's --compare-dest, --copy-dest, and --link-dest options, there's one thing I really wish I could do, and I've been looking for a few years now for a program that could do it: Instead of copying or hard-linking from the compare directory to the target directory, I'd like to move the files. That is, whenever the file already exists in the compare directory, it is moved forward into the target directory; but if the existing file is different or doesn't exist, then a new file is made in the target directory. The result would be that, after several backups (each to a new directory, perhaps named with the current date) the most recent directory would be a snapshot of the source, and each previous directory would have previous versions of files or copies of deleted files. (This is effectively the opposite result of --compare-dest, which gives you a snapshot of the first version of the files, with each successive directory storing only the changed files.) This makes two very common restore scenarios very simple: restoring the entire directory tree to the most recent version after a drive failure, and restoring a previous version of a single file after it was accidentally over-written, even if the modified version has since been backed up. I looked over the rsync source to see if I could add this functionality myself, but I'm really not a very good programmer and it's definitely beyond me. To someone familiar with the source, however, I have to imagine it would be a fairly straightforward feature to add... just add replace the copy operation in --copy-dest or the link operation in --link-dest with a move operation. -- Josh
Hi, I'm curious as to why you need a new option rather than just using --link-dest. Both --link-dest and --copy-dest already allow the "two very common restor scenarios" that you mention and --link-dest uses hardly any extra disk space than your --move-dest suggestion. You also get the added advantage that each previous backup continues to look like a full "snapshot". David 2008/12/9 Josh Hanson <JoshHanson@capriomgt.com>:> Looking over rsync's --compare-dest, --copy-dest, and --link-dest > options, there's one thing I really wish I could do, and I've been > looking for a few years now for a program that could do it: Instead of > copying or hard-linking from the compare directory to the target > directory, I'd like to move the files. > > That is, whenever the file already exists in the compare directory, it > is moved forward into the target directory; but if the existing file is > different or doesn't exist, then a new file is made in the target > directory. > > The result would be that, after several backups (each to a new > directory, perhaps named with the current date) the most recent > directory would be a snapshot of the source, and each previous directory > would have previous versions of files or copies of deleted files. (This > is effectively the opposite result of --compare-dest, which gives you a > snapshot of the first version of the files, with each successive > directory storing only the changed files.) This makes two very common > restore scenarios very simple: restoring the entire directory tree to > the most recent version after a drive failure, and restoring a previous > version of a single file after it was accidentally over-written, even if > the modified version has since been backed up. > > I looked over the rsync source to see if I could add this functionality > myself, but I'm really not a very good programmer and it's definitely > beyond me. To someone familiar with the source, however, I have to > imagine it would be a fairly straightforward feature to add... just add > replace the copy operation in --copy-dest or the link operation in > --link-dest with a move operation. > > -- Josh > -- > Please use reply-all for most replies to avoid omitting the mailing list. > To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync > Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html >
On Mon, 2008-12-08 at 17:23 -0500, Josh Hanson wrote:> Looking over rsync's --compare-dest, --copy-dest, and --link-dest > options, there's one thing I really wish I could do, and I've been > looking for a few years now for a program that could do it: Instead of > copying or hard-linking from the compare directory to the target > directory, I'd like to move the files. > > That is, whenever the file already exists in the compare directory, it > is moved forward into the target directory; but if the existing file is > different or doesn't exist, then a new file is made in the target > directory. > > The result would be that, after several backups (each to a new > directory, perhaps named with the current date) the most recent > directory would be a snapshot of the source, and each previous directory > would have previous versions of files or copies of deleted files. (This > is effectively the opposite result of --compare-dest, which gives you a > snapshot of the first version of the files, with each successive > directory storing only the changed files.)--backup-dir gives you essentially this, except that you would always specify the same destination, and rsync would move the changed files out of that directory each time instead of moving the unchanged files over to a new directory. -- Matt
Maybe Matching Threads
- Dirvish, --link-dest and permissions
- can't manage to get --link-dest working.
- Unintuitive backwards-incompatible behaviour with rsync -a --link-dest --size-only
- rsync --link-dest won't link even if existing file is out of date
- rsync --link-dest won't link even if existing file is out of date