Rsync to USB flash drive recopies files
Trying to rsync files to a USB drive connected to a linux server. The files sync the first time, then then next time I plugin the USB all the files sync again.
This is the command I’m using:
RSYNC_PASSWORD=12345 rsync -pvrt --dry-run --delete rsync://firstname.lastname@example.org/video/ /mount/usb/video
However if I do not unplug the USB and run rsync one more time, nothing is copied.
After doing some research it seems that FAT file systems only stores timestamps to two second accuracy. When the drive is removed and reconnected the file timestamps change up to 2 seconds.
If we update the command and use –modify-window, I’m able to rsync between disconnecting and reconnecting the USB filesystem.
RSYNC_PASSWORD=12345 rsync -pvrt --modify-window=5 --dry-run --delete rsync://email@example.com/video/ /mount/usb/video
That resolved my issue.