简体   繁体   English

Rsync复制未更改的文件(USB驱动器,FAT32)

[英]Rsync copies unchanged files (USB Drive, FAT32)

I use rsync to make backups of my files located on my NAS to an USB device. 我使用rsync将NAS上的文件备份到USB设备。 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. 只要USB驱动器仍然连接到NAS,一切都可以正常工作。 That is to say, rsync copies new and changed file and nothing more. 也就是说, rsync复制新文件和更改的文件,仅此而已。

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). 但是,有时我会将备用USB驱动器用于其他用途,并将其插入其他Windows和Mac机器(但是我不触摸驱动器上的/ photo文件夹),并且在将其再次安装到NAS上时,备份时, rsync再次复制每个文件(即使它没有更改)。

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). 该驱动器以FAT32格式格式化,无法更改(我与Linux,Windows和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). 我知道这不是rsync最佳选择,但我必须处理它(我不在乎保留权限信息等等)。

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; 这是FAT32短文件名的问题; 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. 显然,默认情况下,Linux将它们转换为所有小写字母,这使rsync看到源和目标上的文件相同的能力变得混乱。

The solution is to mount the FAT32 device with the 'shortname=mixed' option. 解决方案是使用'shortname = mixed'选项挂载FAT32设备。 I believe you also need to use utf8 charset, eg 'iocharset=utf8'. 我相信您还需要使用utf8字符集,例如'iocharset = utf8'。 Then run rsync with params: -rtv --modify-window=1 然后使用参数运行rsync:-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. 在具有Trinity的Debian上,我可以右键单击桌面上的FAT32分区的图标,然后单击属性/安装,将短名称设置为混合,并确保选中了UTF-8字符集。 Hopefully there's a way to make those the defaults for all FAT32 partitions, but I haven't looked for that yet. 希望有一种方法可以将所有FAT32分区的默认值设为默认值,但是我还没有寻找。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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