[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

why rsync wants to delete destination files



Hi,

I believed that rsync wouldn't delete existing destination files unless 
instructed so (by --delete-excluded). However, while debugging a 
(mysterious) bug, 
http://thread.gmane.org/gmane.linux.file-systems.aufs.user/2821/focus=2827
I now suspect that the rsync command used in the script was trying to 
delete existing destination files. 

Here are the (abstracted) logs:

$ find rw
rw
rw/d1
rw/d1/.wh.7
rw/d1/.wh.6
rw/.wh..wh.orph
rw/.wh..wh.plnk
rw/.wh..wh.aufs

$ find ro2
ro2
ro2/d2
ro2/d2/6
ro2/d2/5
ro2/d2/4
ro2/d2/3
ro2/d2/2
ro2/d2/1
ro2/d1
ro2/d1/.wh.2
ro2/d1/.wh.3
ro2/d1/four
ro2/d1/.wh.4

. . .
++ rsync --exclude=lost+found -aHSx --devices --specials --delete-before 
--remove-source-files '--exclude=.wh..wh.*' rw/ ro2
. . . 

$ find ro2
ro2
ro2/d1
ro2/d1/.wh.6
ro2/d1/.wh.7

See, all the previous content have gone. 

Now, try again with the an extra '--max-delete=0' option:
(http://thread.gmane.org/gmane.linux.file-systems.aufs.user/2821/
focus=2827)

$ find rw ro_mid
rw
rw/d1
rw/d1/.wh.7
rw/d1/.wh.6
rw/.wh..wh.orph
rw/.wh..wh.plnk
rw/.wh..wh.aufs
ro_mid
ro_mid/d2
ro_mid/d2/6
ro_mid/d2/5
ro_mid/d2/4
ro_mid/d2/3
ro_mid/d2/2
ro_mid/d2/1
ro_mid/d1
ro_mid/d1/four
ro_mid/d1/4
ro_mid/d1/3
ro_mid/d1/2

++ rsync --exclude=lost+found -aHSx --devices --specials --delete-before 
--remove-source-files --exclude=.wh..wh.* --max-delete=0 rw/ ro_mid
cannot delete non-empty directory: d2
Deletions stopped due to --max-delete limit (10 skipped)
rsync error: the --max-delete limit stopped deletions (code 25) at main.c
(1060) [sender=3.0.7]

I don't think the '--max-delete=0' is the correct option to choose in 
this case, but apparently it reveals that rsync does trying to delete 
destination files. 

My brain is now blocked. Anyone can give me some hints?

Thanks

-- 
Tong (remove underscore(s) to reply)
  http://xpt.sourceforge.net/techdocs/
  http://xpt.sourceforge.net/tools/


Reply to: