rsync not deleting, why?

Mark
Mark used Ask the Experts™
on
I run the following command:

rsync -rvtO --delete myUser@myHost:/backup/\* /backup/folder/

It copies the files from the source host, but does not delete files in the destination folder that no longer exist on the source. I get no error message. This rsync version is 3.0.4  protocol version 30. The --delete option on other computers just fine. the rsync user does have permission in the /backup/folder directory because I was able to delete a file in that directory by-hand logged in as the rsync user. The /backup directory is a mounted external USB drive.


Any ideas?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
more information:

I changed the rsync command to:

rsync -rvtO --delete myUser@myHost:/backup/ /backup/folder

When I ran this rsync command I got:

rsync: delete_file: unlink(2012-02-29-fullbackup.tgz) failed: Permission denied (13)

I checked the permissions on the file:

ls -l /backup/novatec/2012-02-29-fullbackup.tgz
-rw-rw-r-- 1 root backup 13017848257 2012-03-01 03:49 /backup/novatec/2012-02-29-fullbackup.tgz

Then I tried deleting the file manually and got:

rm /backup/novatec/2012-02-29-fullbackup.tgz
rm: remove write-protected regular file `/backup/novatec/2012-02-29-fullbackup.tgz'?

Now, the file is owned by root, and is in group 'backup', and has group rw permission. The user trying to rm the file is a member of group 'backup'. Why is it saying the file is "write-protected"? If I solve this mystery I should be able to get rsync working.
I've recently encountered this same behavior with an external USB drive on Centos 5.8.  I haven't found a fix yet, but my workaround has been to remount the drive, which solves the problem for smaller files, but I can't do a full tar gzip backup to the disk.

I found the following link about it, but I haven't gleamed a solution from it yet:

http://www.cyberciti.biz/tips/linux-filesytem-goes-read-only.html
Commented:
I solved the problem by making the files owned by the backup user, but that doesn't really tell me why I can't delete files owned by a different user if I have group rw permssion. I think you must be right in that it has something to do with the USB mount, even though the drive is mounted by the backup user. I thought maybe it had something to do with the file (and/or parent directory) being owned by root, but when I experimented with these same ownership configurations in a hard-drive directory I had no problem. This might be one for the Linux team to look at!

Author

Commented:
Thanks for the effort.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial