From: Sam Leon on
On 08/06/2010 10:41 PM, T o n g wrote:
> 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
>


--delete-before will delete everything in the destination directory that
is not in the source directory. Also using regex stuff for --exclude can
be tricky because it is a different syntax than what most people are
used to with bash shell.

Sam


--
To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org
Archive: http://lists.debian.org/4C5CD76D.2070104(a)net153.net