Using Rsync to Mirror Data to a FAT32 Partition
Rsync is a useful tool for mirroring data between two locations. I use it regularly to mirror my music and photo directories from my Mac Book Pro to an external hard drive. The external hard drive is formated FAT32 so it can be used on Windows, Linux, and OS X.
I quickly noticed, however, that rsync was copying all the files each time when it should copy only those that changed. After some research, I realized why. By default, rsync checks a file's size and modification date to determine if it has changed. FAT32 timestamps only have 2 second resolution, so the modification times didn't match. Adding the --modify-window=1 option to rsync reduces the accuracy with which rsync compares modification times, preventing the copying of files that haven't really changed.
The full command I use is below:
rsync
-a # recurse into subdirectories and preserve most metadata
--del # delete files on dest that aren't on src
--exclude=".*" # ignore dotfiles; don't want .DS_Store from the mac
--modify-window=1 # needed when copying to/from FAT32
--stats # optional, gives some stats at the end
source/
dest/