detect-renamed questions

StalkR stalkr at stalkr.net
Mon Jan 28 17:03:31 MST 2013


Hello,

I was looking for "detect renamed" feature in rsync
(https://bugzilla.samba.org/show_bug.cgi?id=2294) so used rsync-3.0.9
with patches detect-renamed.diff and detect-renamed-lax.diff.
I have 2 questions, not sure if I'm missing something (options) or if
it is working as intended and could be improved.

1) It does not detect a rename when a file is moved into another directory:
$ mkdir a b
$ dd if=/dev/zero of=a/x count=$[100*1024] bs=1024
$ rsync -a a/ b/
$ mkdir a/d
$ mv a/x a/d/
$ tree -h a b
a
`-- [4.0K]  d
    `-- [100M]  x
b
`-- [100M]  x

$ rsync -avvh --progress --detect-renamed --delete a/ b/
building file list ...
3 files to consider
delta-transmission enabled
./
deleting x
d/
d/x
     104.86M 100%   46.35MB/s    0:00:02 (xfer#1, to-check=0/3)
total: matches=0  hash_hits=0  false_alarms=0 data=104857600

sent 104.87M bytes  received 37 bytes  41.95M bytes/sec
total size is 104.86M  speedup is 1.00

File x was not detected as renamed into d/x. Is it intended?

2) Detected renamed files are hard-linked in partial-dir (.~tmp~) but
in the end it's doing a copy (slow) instead of rename/hardlink:
$ mkdir a b
$ dd if=/dev/zero of=a/x count=$[100*1024] bs=1024
$ rsync -a a/ b/
$ mv a/x a/y
$ tree -h a b
a
`-- [100M]  y
b
`-- [100M]  x

0 directories, 2 files

$ rsync -avvh --progress --detect-renamed --delete a/ b/
building file list ...
2 files to consider
delta-transmission enabled
./
found renamed: x => y
deleting x
y
     104.86M 100%   76.74MB/s    0:00:01 (xfer#1, to-check=0/2)
total: matches=10240  hash_hits=10240  false_alarms=0 data=0

sent 41.04K bytes  received 71.72K bytes  45.10K bytes/sec
total size is 104.86M  speedup is 929.93

Progress shows that the file was copied, confirmed by looking at files
during the transfer:

$ tree -ah a b
a
`-- [100M]  y
b
|-- [ 50M]  .y.CbXzNZ
`-- [4.0K]  .~tmp~
    `-- [100M]  y

1 directory, 3 files

To avoid copy, it would be better to rename (mv) or hardlink between
.~tmp~ and dest (since .~tmp~ will later be removed).

Thanks,
StalkR


More information about the rsync mailing list