Is there any way to have rsync compare against a file with a *different* name? What I'd like to do is compare a vm - whatsit.img against a backup - whatsit.current, that's a symlink to whatsit.timestamp, and if different, *then* make the copy (which my script will then move to whatsit.newtimestamp, and change the symlink to point to the new one, then remove the old (or maybe save an older copy or two). So: backupdir \ whatsit.20130101 (backup of whatsit.img) whatsit.current -> whatsit.20130101 whatsit.20121201 After script w/ rsync backupdir \ whatsit.20130201 (backup of whatsit.img) whatsit.current -> whatsit.20130201 whatsit.20130101 mark
On Wed, 27 Feb 2013 11:34:06 -0500 m.roth at 5-cent.us wrote:> Is there any way to have rsync compare against a file with a *different* > name?I think that rsync might overwrite or get confused by your symlinks, regardless of the actual filenames. You might be better off using something like md5sum or sha1sum or the like to compare checksums between your files and then make a new copy or not based on that result. -- MELVILLE THEATRE ~ Real D 3D Digital Cinema ~ www.melvilletheatre.com www.creekfm.com - FIFTY THOUSAND WATTS of POW WOW POWER!
On Wed, Feb 27, 2013 at 10:34 AM, <m.roth at 5-cent.us> wrote:> Is there any way to have rsync compare against a file with a *different* > name? > > What I'd like to do is compare a vm - whatsit.img against a backup - > whatsit.current, that's a symlink to whatsit.timestamp, and if different, > *then* make the copy (which my script will then move to > whatsit.newtimestamp, and change the symlink to point to the new one, then > remove the old (or maybe save an older copy or two). > > So: > backupdir > \ whatsit.20130101 (backup of whatsit.img) > whatsit.current -> whatsit.20130101 > whatsit.20121201 > > After script w/ rsync > backupdir > \ whatsit.20130201 (backup of whatsit.img) > whatsit.current -> whatsit.20130201 > whatsit.20130101I don't think you can do it with symlinks (maybe with -L??), but a hard link with the same name should work. Normally rsync builds a new copy and renames it to the old name only after completion so any other link names should keep the old data (unlike programs that would overwrite the existing data). Or just let rsync do all the work itself with the --backup-dir option. With that, if the target differs it will update it and move a copy of the outdated version into the specified directory. -- Les Mikesell lesmikesell at gmail.com
On Wed, 27 Feb 2013 at 11:34 -0000, m.roth at 5-cent.us wrote:> Is there any way to have rsync compare against a file with a *different* > name? > > What I'd like to do is compare a vm - whatsit.img against a backup - > whatsit.current, that's a symlink to whatsit.timestamp, and if different, > *then* make the copy (which my script will then move to > whatsit.newtimestamp, and change the symlink to point to the new one, then > remove the old (or maybe save an older copy or two). > > So: > backupdir > \ whatsit.20130101 (backup of whatsit.img) > whatsit.current -> whatsit.20130101 > whatsit.20121201 > > After script w/ rsync > backupdir > \ whatsit.20130201 (backup of whatsit.img) > whatsit.current -> whatsit.20130201 > whatsit.20130101I'm not quite sure what you are trying to do. A couple of things that I do include: 1) By referencing 'whatsit.current/.' you can be sure to follow a symbolic link on the destination of the rsync. I do this all the time when wanting a different destination directory name. 2) You can use the --link-dest rsync option to create a new tree based upon an older tree. I don't have an example handy but it looks something like: rsync -aH --link-dest=whatsit-current/. whatsit: whatsit-new 3) Preserve historic backups as hard links (using 'cp'). This leaves 'backup/whatsit' as the current version (slightly inconsistent during the backup operation). * rsync -aH --delete whatsit: backup/whatsit * monday-saturday: cp -rpl backup historic/daily-YYYYMMDD * sunday: cp -rpl backup historic/weekly-YYYYMMDD * clean up older daily-YYYYMMDD files after 1 month Some combination of these may help with what you are attempting. 4) I assume you are comparing the contents of the VM disk (as seen by the virtual OS) not the data blocks in the container file itself. rsync is probably not very useful for just the single container disk image file (it might have slight use for vmware disk images composed of many smaller storage segments). Stuart -- I've never been lost; I was once bewildered for three days, but never lost! -- Daniel Boone
Seemingly Similar Threads
- Updating a Data Frame
- Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?
- May I merge several increment backups to one?
- Is there a parameter in rsync to clean $BACKUPDIR before writing to it (--backup-dir=$BACKUPDIR)?
- fully-qualified symlinks & --exclude question