new option suggestion '--backup-only'

Takeru KOMORIYA komoriya at
Fri Sep 5 22:40:12 EST 2003


On Fri, 5 Sep 2003 01:10:54 -0700
jw schultz <jw at> wrote:

> > How about adding now option '--backup-only'  that means making
> > backups only and don't change any destination files?
> > 
> > (I posted similar patch a month ago, but the patch was made for
> >  nightly snapshot of 20020808, which was tooo old! Laugh at me...)
> > 
> > I want to use rsync with LVM snapshot to make incremental backups
> > like below:
> > 
> >   1) Make LVM snapshot of file system and mount it.
> >   2) Compare it to yesterday's snapshot, and backup files which
> >   are
> >      updated or deleted.
> >      ex) rsync -a --delete --backup
> >      --backup-dir=/backup/backup_on_$DATE
> >   3) Delete yesterday's snapshot.
> > 
> > The problem is that LVM snapshots are read-only, so I need rsync
> > not to modefy any destination files.
> > 
> > I made trial patch against latest CVS, and this works fine for me.
> > 
> > With this patch, new options '--backup-only' is added, and the
> > '--backup-dir' option implies '--backup' for convinience.
> Let's see if i understand what you are talking about.
> The LVM stuff about snapshots and today vs. yesterday is
> snow so i'll eliminate it.  What i describe is partly based
> on your description of this as an extension of --backup that
> doesn't change the "destination".
> You want to compare tree A with tree B and for those files
> that differ copy from tree B to an empty backup tree (tree C)
> with no change to trees A or B.  The result being that tree
> C is a sparse tree (a characteristic of --backup-dir).
> If all are trees are local this would amount to
> 	rsync -a --compare-dest=$tree_A $tree_B $tree_C

Thanks for your advice! That's what I need.
I'm ashamed of my rash patch.

"--compare-dest" options looks very good, but I have one problem:
When I tried "rsync -a --compare-dest=$tree_A $tree_B $tree_C",
rsync made many empty directories in $tree_C(empty backup tree).

I'm going to find how to avoid creating empty directories, though I
may accept them...

Takeru Komoriya
 komoriya at

More information about the rsync mailing list