rsync:无法在“/cygdrive/e/.”上设置时间:参数无效 (22)

rsync: failed to set times on "/cygdrive/e/.": Invalid argument (22)

当我在 Windows 10.

尝试从本地硬盘同步到挂载在 E: 的 USB 磁盘时,我收到以下错误消息
rsync: failed to set times on "/cygdrive/e/.": Invalid argument (22)

我的 rsync 命令如下(为简洁起见缩短了路径):

rsync -rtv --delete --progress --modify-window=5 /cygdrive/d/path/to/folder/ /cygdrive/e/

我实际上需要设置修改时间(在目录上也是如此),而 rsync 实际上完美地设置了修改时间。只是U盘根目录设置时间失败

我遇到了完全相同的问题。

  1. 我创建了一个包含一个文本文件的目录,当我尝试 rsync 它到一个可移动 (USB) 驱动器时,我得到了错误。但是,文件 已被复制 到目的地。如果目标是可移动驱动器
  2. 上的文件夹(root 除外),则该问题不可重现
  3. 然后我使用固定驱动器作为目标重复了该过程,但问题无法重现

2 个驱动器之间出现的第 1st 差异是 文件系统(有关详细信息,请查看 [MS.Docs]: File Systems Technologies):

  • FAT32 - 在可移动驱动器上
  • NTFS - 在固定的

这就是我失败的原因。将 USB 驱动器格式化为 NTFS 解决了问题:

  1. USB 驱动器格式化为 FAT32(默认):

    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/Whosebug/q045006385
    $ ll /cygdrive/
    total 20
    dr-xr-xr-x  1 cfati                       None                        0 Jul 14 17:58 .
    drwxrwx---+ 1 cfati                       None                        0 Jun  9 15:04 ..
    d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
    drwxrwx---+ 1 SYSTEM                      SYSTEM                      0 Jul 14 13:19 e
    drwxr-xr-x  1 cfati                       None                        0 Dec 31  1979 n
    drwxr-xr-x  1 cfati                       None                        0 Dec 31  1979 w
    
    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/Whosebug/q045006385
    $ rsync -rtv --progress --modify-window=5 ./dir/ /cygdrive/w
    sending incremental file list
    rsync: failed to set times on "/cygdrive/w/.": Invalid argument (22)
    ./
    a.txt
                  3 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/2)
    
    sent 111 bytes  received 111 bytes  444.00 bytes/sec
    total size is 3  speedup is 0.01
    rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
    
    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/Whosebug/q045006385
    $ ll /cygdrive/
    total 20
    dr-xr-xr-x  1 cfati                       None                        0 Jul 14 17:58 .
    drwxrwx---+ 1 cfati                       None                        0 Jun  9 15:04 ..
    d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
    drwxrwx---+ 1 SYSTEM                      SYSTEM                      0 Jul 14 13:19 e
    drwxr-xr-x  1 cfati                       None                        0 Dec 31  1979 n
    drwxr-xr-x  1 cfati                       None                        0 Dec 31  1979 w
    
  2. USB 驱动器格式化为 NTFS 后:

    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/Whosebug/q045006385
    $ ll /cygdrive/
    total 24
    dr-xr-xr-x  1 cfati                       None                        0 Jul 14 17:59 .
    drwxrwx---+ 1 cfati                       None                        0 Jun  9 15:04 ..
    d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
    drwxrwx---+ 1 SYSTEM                      SYSTEM                      0 Jul 14 13:19 e
    drwxr-xr-x  1 cfati                       None                        0 Dec 31  1979 n
    drwxrwxrwx+ 1 Administrators              Administrators              0 Jul 14 17:59 w
    
    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/Whosebug/q045006385
    $ rsync -rtv --progress --modify-window=5 ./dir/ /cygdrive/w
    sending incremental file list
    ./
    a.txt
                  3 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=0/2)
    
    sent 111 bytes  received 38 bytes  298.00 bytes/sec
    total size is 3  speedup is 0.02
    
    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/Whosebug/q045006385
    $ ll /cygdrive/
    total 24
    dr-xr-xr-x  1 cfati                       None                        0 Jul 14 17:59 .
    drwxrwx---+ 1 cfati                       None                        0 Jun  9 15:04 ..
    d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
    drwxrwx---+ 1 SYSTEM                      SYSTEM                      0 Jul 14 13:19 e
    drwxr-xr-x  1 cfati                       None                        0 Dec 31  1979 n
    drwxrwxrwx+ 1 Administrators              Administrators              0 Jul 14 13:19 w
    

附带说明一下,当我在步骤 #2. 时,我是个白痴并保留了 --delete arg,所以直到我按下 Ctrl + C,它删除了一些数据。幸运的是,它没有删除关键文件/文件夹。