Does files-from work with --delete?

Philip Pokorny ppokorny at penguincomputing.com
Wed Nov 11 12:55:53 MST 2009


I am trying to use rsync (3.0.6) to keep two directories as exact 
duplicates.  I would normally run:

   rsync -av -S --delete  /path/to/src/  /path/to/dst/

to do this.  Unfortunately, the directories have become rather large 
(2TB, a million files) and so the tree walk has become a prohibitively 
time consuming part of the operation.

However, I have a way to generate a list of file changes since the last 
replication that is much faster.  I would like to provide this list to 
rsync using --files-from, but I'm not clear on how to represent 
deletions.  If I list the file that I know exists in the destination 
that needs to be deleted (because it no longer exists in the source), I 
get this:

$ find src dst -print
src
src/a
src/b
src/c
src/c/d
src/c/a
src/p
dst
dst/a
dst/b
dst/c
dst/c/d
dst/c/a
dst/c/p
$ cat list
/p
/c/p
$ ./rsync-3.0.6/rsync -av -S --delete --files-from=list -n src/ dst/
building file list ... rsync: link_stat 
"/home/ppokorny/_work/_customers/_ga/_rsync_test/src/c/p" failed: No 
such file or directory (2)
done
p

sent 61 bytes  received 15 bytes  152.00 bytes/sec
total size is 0  speedup is 0.00 (DRY RUN)
rsync error: some files/attrs were not transferred (see previous errors) 
(code 23) at main.c(1039) [sender=3.0.6]

I am curious how a remote repository that is providing files-from lists 
to clients would represent deletions?  In the code, I can see that when 
parsing the files-from list, no special handling is done when link_stat 
returns a file-not-found error, which I suspect is the cause of the 
message above.

I can also imagine terrible damage that could result from enabling --del 
and trusting a remote repository to provide a files-from list.  But this would seem to be an 
essential feature for keeping two directories equivalent using files-from.

If modifying the file sending code to detect the link_stat "not found" 
error and if --delete is enabled, sending that as a delete request (is 
there such a thing in the protocol?) is the right thing, then I'll work 
on a code patch.

Thanks,
Phil P.

-- 
Philip Pokorny, RHCE, Chief Arch. & Sr. Dir. HW & Field Eng.
Tel: 415-954-2823   Cell: 415-370-0835
Fax: 415-954-2899   Toll Free: 888-PENGUIN
PENGUIN COMPUTING, INC.
www.penguincomputing.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.samba.org/pipermail/rsync/attachments/20091111/43d01372/attachment.html>


More information about the rsync mailing list