[CentOS] an rsync question

Stuart Barkley stuartb at 4gh.net
Wed Feb 27 17:38:30 UTC 2013


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.20130101

I'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



More information about the CentOS mailing list