rsync and moving files [Re: backup w/ snapshots]

Svein Halvor Halvorsen svein-freebsd-questions at
Mon Aug 29 15:12:31 GMT 2005

* Norberto Meijome [2005-08-30 00:32 +1000]
>  isn't that the whole point of having a backup? to have *another* copy of your
>  files?

Well, yes and no.

The idea is that I have a main computer that I want to backup. I want the 
backup to be (a) remote, (b) incremental and (c) random-accessible.

So I thought that every day my backup-server could rsync my main computer, 
creating a mirror of the relevant directory trees. Then, as soon as the 
rsync job completes, it takes a snapshot of the filesystem. This snapshot 
could be mounted r/o and nfs-exported back to the original computer.

Now: If I have a file /foo/test on my main computer. After the first 
rsync-job this file will be copied, assigned an inode and put on the disk 
somewhere. If I change this file, a local snapshot will be smart enough to 
just store the changed sectors that this file now occupies.

But: If I move the file from /foo/test to /bar/test on my main computer, 
rsync will create a BRAND NEW FILE in /bar (and delete the file in /foo, 
since I used the --delete option). Now this NEW file will have a new 
inode, and cover new sectors on disk. The snapshot will then tak 
considerable more diskspace. If I move a large directory tree this way, 
this will occupy huge amounts of diskspace.

If I however, make the snapshot on my local disk, this is not a problem, 
as on this local filesystem /bar/test is not a new file. 

So how can I make rsync know that the files were just moved (renamed, 
relinked), and make rsync reflect this fact on the remote mirror?

>  and I guess that yes, if the files are new in the remote system, when you
>  take a snapshot the difference with the previous snapshot will be the size of
>  the new data 

The files aren't new. Their names are!

More information about the freebsd-questions mailing list