rsync ignores --force and will not delete non-empty directories from destination (HFS+ -> FAT32)

Simon Brown s.brown549 at btinternet.com
Thu Mar 19 07:43:13 GMT 2009


Matt McCutchen wrote:
> On Mon, 2009-03-02 at 15:46 +0000, Simon Brown wrote:
>   
>> My scenario: I am trying to rsync from an external HFS+ (USB2) to a 
>> FAT32 external NAS drive, using rsync version 2.6.9  protocol version 29 
>> (as supplied with Mac OS X Tiger 10.4.11). The data being synced is MP3 
>> music files and JPGs.
>>
>> The command I am issuing within my script is:
>>        rsync -ruxi "$sourcedir" "$destdir" \
>>         --size-only --force --log-file="$synclog" --stats --delete 
>> --modify-window=2 --out-format="%i %n%L (%b)" $* >>"$logfn" 2>&1
>>
>> The issue is that the sync works almost as expected, but fails to delete 
>> non-empty directories at the destination that no longer exist at the 
>> source. Running rsync with -n (dry-run) shows that extraneous 
>> directories will be deleted, but when I omit -n, only the empty 
>> directories are listed for deletion (and deleted).
>>     
>
> I can't help with the Apple-modified rsync.  In addition, that area of
> rsync's behavior underwent some improvements in version 3.0.0:
>
> https://bugzilla.samba.org/show_bug.cgi?id=3825
>
> Please try the latest stable rsync, 3.0.5, which you can compile
> yourself or get from Fink or MacPorts among other places.
>   
Many thanks for your reply, Matt.
I installed version 3.05 via MacPorts and the rsync command now works as 
expected, including deletion of non-empty directories.
I chose MacPorts because Fink didn't have 3.05 listed as a stable 
release (they show 3.0.4-1 as latest stable for 10.4 on PPC Macs)

Apologies for the delay in responding. After upgrading rsync I was 
initially finding that all files were being overwritten each time,  and 
took an embarrassingly long time to work out that the NAS box was 
controlling the file timestamp (always setting the mod date to the date 
of transfer) but the NAS clock was out of sync with the sending 
machine's clock, so the timestamps never matched and the files were 
always copied again. That, added to the FAT32 'even numbers only' 
timestamping was enough to keep my guessing for a long time.
>   
>> I am unsure whether I should be using -u, --size-only and 
>> --modify-window together, though I do not see a connection between those 
>> options and the failure to delete.
>>     
>
> That combination of options does seem odd (though unrelated to the
> deletion).  What are you trying to accomplish?
>   
I am trying to maintain a collection of music / photos / videos on a NAS 
box (formatted FAT32 for cross-platform use).  The shared portion of the 
NAS is  read-write for users (partner and family members), but I need to 
be able to restore it to a mirror of my current master collection 
periodically. I can't make it read-only because my cheap cross-platform 
NAS doesn't support read-only shares and I wanted to allow for it being 
taken off the network and used via direct USB connection, which meant 
that I needed to be able to re-sync the content, allowing for folders in 
the source being re-classified (moved within the hierarchy).

I had resorted to using --size-only or --checksum because I hadn't yet 
worked out that it NAS box's date value that was being used to set 
timestamps. Now that I've resolved that, rsync works fine with just -u 
and --modify-window. Googling for clues (problems setting dates on 
FAT32) taught me that I wouldn't be able to preserve modification dates, 
but setting them to the time of transfer is good enough for my purposes.

Adding the new rsync version via Macports has given it precendence over 
the pre-installed Apple version, so I also needed to update my other 
rsync scripts use -X to preserve extended attributes instead of -E.

Thanks again for responding. Apologies again for the delayed reply.

*Some links for anyone else searching on this issue:
*Mike Bombich on building patched version of 3.05 to recognise Mac 
resource forks.
--> http://www.bombich.com/mactips/rsync.html
*
*Working with FAT32 in Ubuntu Linux (covers dates, mixed case filenames, 
special characters in filenames)
--> 
http://skillfulness.blogspot.com/2008/11/working-with-fat32-in-ubuntu-linux.html

File Creation Dates on Mac OS X: Clash of the Cultures
-->  http://blog.plasticsfuture.org/2006/06/27/mac-os-file-creation-dates/

The State of Backup and Cloning Tools under Mac OS X (2006)
--> 
http://blog.plasticsfuture.org/2006/03/05/the-state-of-backup-and-cloning-tools-under-mac-os-x/

History of rsync on Mac OS X
--> 
http://patternbuffer.wordpress.com/2007/12/04/a-history-of-rsync-on-mac-os-x/




More information about the rsync mailing list