简体   繁体   中英

Rsync copies unchanged files (USB Drive, FAT32)

I use rsync to make backups of my files located on my NAS to an USB device. I use the following command:

sudo rsync -rv --modify-window=9999 --update --delete --stats --progress --log-file=/shares/Franck/log/backup_photos.log  /shares/Public/photos /USB_DRIVE/photos

Everything works fine provided that the USB drive remains attached to the NAS. That is to say, rsync copies new and changed file and nothing more.

However, from time to time I use the backup USB drive for other things and plug it to other windows and Mac machines (but I do not touch the /photo folder on the drive) and when I mount it again on the NAS and lauch a backup, rsync copies every single file again (even if it hasn't changed).

Do you know how to fix this? Thanks.

The drive is formatted in FAT32 format and that cannot be changed (I interact with Linux, Windows and Mac). I know this is not optimal for rsync but I have to deal with it (I do not care about keeping permissions informations and so on).

I've been trying to figure out the answer to this for a long time, with no success. But I've just stumbled across the answer. It's a FAT32 short-filename issue; apparently, by default, Linux converts them to all lower case, which messes up rsync's ability to see that it's the same file on the source & destination.

The solution is to mount the FAT32 device with the 'shortname=mixed' option. I believe you also need to use utf8 charset, eg 'iocharset=utf8'. Then run rsync with params: -rtv --modify-window=1

On Debian with Trinity, I can right-click the FAT32 partition's icon on the desktop, Properties / Mounting, set Short Names to mixed, and make sure UTF-8 Charset is checked. Hopefully there's a way to make those the defaults for all FAT32 partitions, but I haven't looked for that yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM