rsync help the gramma
Dale Farnsworth
dale at farnsworth.org
Thu Dec 9 08:02:18 MST 2010
Bryan wrote:
> This is true - if you change the destination folder you do copy
> everything because rsync does not know you copied anything before.
This is true in the general case. However, you can tell rsync about
the files you copied before with the --compare-dest, --copy-dest,
or --link-dest options.
> Rsync syncs. Thus if you wish to sync /my/files/ and
> /media/my/backupfiles/ it copies everything from files to back up
> files on the first run then every subsequent run it copies changes.
> But if I ask it to now sync my/files/ and /media/my/NEW/backupfiles/
> it must first copy every thing again because non of the files in
> /my/files exist in /media/my/NEW/backupfiles/
If you use
rsync -a --link-dest=/media/my/backupfiles /my/files/ /media/my/NEW/backupfiles/
any files that are unchanged since the previous backup to /media/my/backupfiles
will not be copied by rsync. Instead, they will be hardlinked from
/media/my/backupfiles to /media/my/NEW/backupfiles. IMHO, rsync is
simply amazing.
Many scripts use this feature of rsync to give you incremental backups
that look like full backups. Bryan mentioned rsnapshot, which I haven't
used, but looks interesting. I use dirvish. I set it up to do an
automated nightly backup of the several systems I have at home.
Here is a list of my toplevel backup directories for one system:
base $ ls
./ 20100103/ 20100801/ 20101017/ 20101125/ 20101202/
../ 20100207/ 20100905/ 20101024/ 20101126/ 20101203/
20081005/ 20100307/ 20100912/ 20101031/ 20101127/ 20101204/
20090104/ 20100404/ 20100919/ 20101107/ 20101128/ 20101205/
20090405/ 20100502/ 20100926/ 20101114/ 20101129/ 20101206/
20090705/ 20100606/ 20101003/ 20101121/ 20101130/ 20101207/
20091004/ 20100704/ 20101010/ 20101124/ 20101201/ 20101208/
Dirvish has left me nightly backups of the last 15 days and weekly
backups of the last 3 months, monthly backups for the last year,
and annual backups prior to that. (Dirvish backed up nightly for
the last two years, but has culled older backups according to the
schedule I gave it.)
Each of the directories contains a full snapshot of the files at
the time they were backed up. Note that there is no redundancy.
There is only one copy of each file that hasn't been changed, with
links to it appearing in multiple directories.
-Dale
More information about the PLUG-discuss
mailing list