Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a problem rsyncing my folders. In my home there is folder named "workspace". Recently I changed its content a lot, creating new directories, deleting old ones. New folders were successfully rsynced to external disk but deleted folders are still on external disk, not deleted. Same if I rsync to my other backup network location. While trying to investigate the reason I tried this two commands:

    rsync -nav --delete --exclude='.gvfs' --exclude='.cache' --exclude='.thumbnails' /home/OURDOMAIN/myname/workspace /run/media/myname/VERBATIM/backup/myname > dryrun.txt

and after this dry run the dryrun.txt file contains all the files and folders from workspace folder to be deleted marked with "deleting", that's ok. But i want to run my rsync command for whole home directory, but it's not working. With command:

    rsync -nav --delete --exclude='.gvfs' --exclude='.cache' --exclude='.thumbnails' /home/OURDOMAIN/myname /run/media/myname/VERBATIM/backup > dryrun2.txt

Now dryrun2.txt lines marked with "deleting" are only for some recently deleted files in .local and .config. Nothing for workspace directory.

Why is it not working as I expect? New folders are copied, but deleted folders are not deleted. I am not using file masks as you can see. I think problem is not in my exclude dirs. As shown by dry run it is also not a problem of permissions. Thanks for help.

rsync version 3.0.9 protocol version 30

Additional note: If i create some nonempty directories and do rsync, they are copied successfully. When I delete those folder and do rsync, they disappear in backup only if folder is directly in /home/OURDOMAIN/myname (such as /home/OURDOMAIN/myname/deleteme). But nested directories like /home/OURDOMAIN/myname/tmp/deleteme stay with all their content and are not deleted.

share|improve this question
    
Add a trailing slash to the source folder, otherwise this should work. Also check for IO errors in your logs, this is one of the reasons deletions are aborted. Also try adding --delete-exclude. –  drcelus Feb 27 '13 at 8:53
    
Thanks. A trailing slash on the source changes the behavior to avoid creating an additional directory level at the destination. If I add trailing slash to source than I need to add "myname" to target to sync to right directory. It makes no change to my problem, nonexisting content of "workspace" directory is not deleted. Also tried with --delete-excluded but also makes no change - workspace content is not in excluded list so this was expected. –  Martin Feb 27 '13 at 9:40
    
Thanks again, IO was the reason, as you suggested. –  Martin Feb 28 '13 at 9:09

2 Answers 2

up vote 2 down vote accepted

rsync returns:

23 Partial transfer due to error

Explanation is : permission denied in different folders disabled deleting, I thought that denied directories were skipped, a quote from the man page :

If the sending side detects any I/O errors, then the deletion of any files at the destination will be automatically disabled.

share|improve this answer

If it is a backup and it should always be an up to date copy of your home folder, you can try using --ignore-times.

share|improve this answer
    
Thanks. Yes, it should be backup with completely same content (except exclude list of course). Unfortunately --ignore-times is not helping as I tried now. Makes sense because if I run only for "workspace" subfolder, than command works as I need. –  Martin Feb 27 '13 at 9:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.