Ameer
Ameer

Reputation: 1028

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

I get the below error message when I try to rsync from a local hard disk to a USB disk mounted at E: on Windows 10.

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

My rsync command is as below (path shortened for brevity):

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

I actually need to set modification times (on directories as well) and rsync actually sets modification times perfectly. It only fails to set times on root of the USB disk.

Upvotes: 0

Views: 18904

Answers (1)

CristiFati
CristiFati

Reputation: 41116

I experienced exactly the same problem.

  1. I created a dir containing one text file and when trying to rsync it to an removable (USB) drive, I got the error. However, the file was copied to the destination. The problem is not reproducible if the destination is a folder (other than root) on the removable drive
  2. I then repeated the process using a fixed drive as destination, and the problem was not reproducible

The 1st difference that popped up between the 2 drives, was the file system (for more details, check [MS.Docs]: File Systems Technologies):

  • FAT32 - on the removable drive
  • NTFS - on the fixed one

So this was the cause of my failure. Formatting the USB drive as NTFS fixed the problem:

  1. The USB drive formatted as FAT32 (default):

    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/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/StackOverflow/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/StackOverflow/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. After formatting the USB drive as NTFS:

    cfati@cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/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/StackOverflow/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/StackOverflow/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
    

As a side note, when I was at step #2., I was an idiot and kept the --delete arg, so til I hit Ctrl + C, it deleted some data. Luckily, it didn't get to delete crucial files / folders.

Upvotes: 2

Related Questions