After upgrade, rclone sync wants to do a full copy not just of deltas

What is the problem you are having with rclone?

After an upgrade to the latest rclone, an rclone sync to an encrypted OneDrive remote is attempting upload everything again rather than only the deltas. This is going to take six weeks according to rclone's ETA.

The root cause seems to be that rclone is not recognising the remote files are there when doing a sync (but they are there when doing an ls or sha1sum.

I've reduced it to a sync of a single file which copies it again, even when I know it's there.

Run the command 'rclone version' and share the full output of the command.

rclone v1.68.0
- os/version: ubuntu 22.04 (64 bit)
- os/kernel: 5.15.0-101-generic (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.23.1
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

OneDrive (encrypted)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

First, confirm that the file is there and the hashes match:

borg@borghost:~$ rclone sha1sum --download ~/repos/photos/data/1/1202
35b9444a8d81a795605f1a56ef1eb6c974c85027  1202
borg@borghost:~$ rclone sha1sum --download onedrive:repos/photos/data/1/1202
35b9444a8d81a795605f1a56ef1eb6c974c85027  1202

Now try to sync that file. Should be a 'nothing to do' response

borg@borghost:~$ rclone sync -vv ~/repos/photos/data/1/1202 onedrive:repos/photos/data/1202
2024/09/20 16:38:10 DEBUG : rclone: Version "v1.68.0" starting with parameters ["rclone" "sync" "-vv" "/home/borg/repos/photos/data/1/1202" "onedrive:repos/photos/data/1202"]
2024/09/20 16:38:10 DEBUG : Creating backend with remote "/home/borg/repos/photos/data/1/1202"
2024/09/20 16:38:10 DEBUG : Using config file from "/home/borg/.config/rclone/rclone.conf"
2024/09/20 16:38:10 DEBUG : fs cache: adding new entry for parent of "/home/borg/repos/photos/data/1/1202", "/home/borg/repos/photos/data/1"
2024/09/20 16:38:10 DEBUG : Creating backend with remote "onedrive:repos/photos/data/1202"
2024/09/20 16:38:10 DEBUG : Creating backend with remote "onedriveunderlying:rclonebackups/qtvah5opb18p4g4ve2i0lh4mio/vptothej6ciusdjpca3agsgj5o/u58r1pkbe9ip1vlcarj5tntqqs/vknf9rh5le44k0v06gdv2ri0ts"
2024/09/20 16:38:16 DEBUG : 1202: Need to transfer - File not found at Destination
2024/09/20 16:38:16 DEBUG : vknf9rh5le44k0v06gdv2ri0ts: Starting multipart upload
2024/09/20 16:38:17 DEBUG : vknf9rh5le44k0v06gdv2ri0ts: Uploading segment 0/147937 size 147937
2024/09/20 16:38:19 DEBUG : 1202: quickxor = 95e2ea721717a53fd19078f121bff4caeab38aea OK
2024/09/20 16:38:19 INFO  : 1202: Copied (new)
2024/09/20 16:38:19 INFO  : 
Transferred:      144.470 KiB / 144.470 KiB, 100%, 48.156 KiB/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         8.2s

Check that the file is still there, still with matching hash:

borg@borghost:~$ rclone sha1sum --download onedrive:repos/photos/data/1/1202
35b9444a8d81a795605f1a56ef1eb6c974c85027  1202

Interestingly when I do a second sync, it recognises the file is there, but then still goes and recopies it (I think):

borg@borghost:~$ rclone sync -vv ~/repos/photos/data/1/1202 onedrive:repos/photos/data/1202
2024/09/20 16:39:17 DEBUG : rclone: Version "v1.68.0" starting with parameters ["rclone" "sync" "-vv" "/home/borg/repos/photos/data/1/1202" "onedrive:repos/photos/data/1202"]
2024/09/20 16:39:17 DEBUG : Creating backend with remote "/home/borg/repos/photos/data/1/1202"
2024/09/20 16:39:17 DEBUG : Using config file from "/home/borg/.config/rclone/rclone.conf"
2024/09/20 16:39:17 DEBUG : fs cache: adding new entry for parent of "/home/borg/repos/photos/data/1/1202", "/home/borg/repos/photos/data/1"
2024/09/20 16:39:17 DEBUG : Creating backend with remote "onedrive:repos/photos/data/1202"
2024/09/20 16:39:17 DEBUG : Creating backend with remote "onedriveunderlying:rclonebackups/qtvah5opb18p4g4ve2i0lh4mio/vptothej6ciusdjpca3agsgj5o/u58r1pkbe9ip1vlcarj5tntqqs/vknf9rh5le44k0v06gdv2ri0ts"
2024/09/20 16:39:20 DEBUG : 1202: Modification times differ by -143.88454ms: 2023-02-17 21:00:17.14388454 +1100 AEDT, 2023-02-17 10:00:17 +0000 UTC
2024/09/20 16:39:20 DEBUG : vknf9rh5le44k0v06gdv2ri0ts: Starting multipart upload
2024/09/20 16:39:21 DEBUG : vknf9rh5le44k0v06gdv2ri0ts: Uploading segment 0/147937 size 147937
2024/09/20 16:39:22 DEBUG : 1202: quickxor = 8d6737714cdb2e8e583f30e796d0691e39a98b0f OK
2024/09/20 16:39:22 INFO  : 1202: Copied (replaced existing)
2024/09/20 16:39:22 INFO  : 
Transferred:      144.470 KiB / 144.470 KiB, 100%, 72.234 KiB/s, ETA 0s
Transferred:            1 / 1, 100%
Elapsed time:         4.7s

So for some reason even when I can hash the remote file and it matches, sync either thinks it's not there or that the mod time mismatches. In either case it looks like it is trying to do a full copy for every file, for every execution.

The rclone config contents with secrets removed.

[onedrive]
type = crypt
remote = onedriveunderlying:rclonebackups
filename_encryption = standard
directory_name_encryption = true
password = XXX
password2 = XXX

[onedriveunderlying]
type = onedrive
token = XXX
drive_id = XXX
drive_type = personal

A log from the command with the -vv flag

Logs pasted above alongside the command.

But the interesting parts (to me) of the log files are as below. From the first sync command:

2024/09/20 16:38:16 DEBUG : 1202: Need to transfer - File not found at Destination
...
2024/09/20 16:38:19 INFO  : 1202: Copied (new)

and from the second:

2024/09/20 16:39:20 DEBUG : 1202: Modification times differ by -143.88454ms: 2023-02-17 21:00:17.14388454 +1100 AEDT, 2023-02-17 10:00:17 +0000 UTC
...
2024/09/20 16:39:22 INFO  : 1202: Copied (replaced existing)

Also, my upgrade was necessitated because I was seeing authentication errors as discussed here.

If it matters, the version of rclone before upgrading was whatever came with the Ubuntu 22.04.2 LTS version, which appears to be 1.53.3, which I'd been using for a few years without issue.

I have had similar issue. It was never followed up but in the meantime what worked for me was to add --modify-window 1s flag to my sync command.

Try maybe it will work for you too.

1 Like

Possible explanation:

1 Like

Thanks for the explanation. Now it is clear why it plays havoc with overlays not supporting hashes (like crypt) causing files to be re-uploaded again.

Snap; Rclone v1.68.0 release - #7 by sweh

If you can replicate this problem (I can't 'cos my uploads all completed) I'm sure @ncw would love to see some debug output :slight_smile:

Debug is in my issue and I think it is exactly the same problem. Initially I thought that it is union causing it but now I fully understand that it is crypt over onedrive.

Thanks all for the pointers, it is indeed a problem with matching the mtimes from onedrive.

I've submitted a bug:

The precision for the onedrive personal backend changed from 1s to 1ms. Normally this wouldn't be a problem but if you are using crypt then it will exhibit this upload everything again problem. See Issue #8090 for more info.

However you should be able to fix with a one time sync using the --refresh-times flag which will update the timestamps.

1 Like

( A catchup for the people who didn't read the github issue; it looks like Microsoft are migrating some drives to a different backend infrastructure which only has 1s accuracy; the fix is to revert the 1ms timing; a work-around is to add --modify-window 1s )

But I just noticed another fun consequence to this migration.

I'd noticed on my "bad" drive that it was reporting nothing in trash

OneDriveBackups:        OneDriveBackups2:       OneDriveBackups3:
====================    ====================    ====================
Total:   1.005 TiB      Total:   1.005 TiB      Total:   1.005 TiB
Used:    965.400 GiB    Used:    773.100 GiB    Used:    230.800 GiB
Free:    63.600 GiB     Free:    255.900 GiB    Free:    798.200 GiB
Trashed: 1.686 TiB      Trashed: 239.269 GiB    Trashed: 0 B

This is clearly wrong; I can see stuff in there from the webUI :slight_smile:

So I took a look at the dump body output of rclone about for a "good" and a "bad" (migrated) drive. In both cases the request is GET /v1.0/drives/xxxxx HTTP/1.1

But the responses...

Good (not migrated; 1ms drive):

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
  "driveType": "personal",
  "id": "XXX",
  "owner": {
    "user": {
      "displayName": "XXX",
      "id": "XXX"
    }
  },
  "quota": {
    "deleted": 256913083688,
    "remaining": 274770532761,
    "state": "normal",
    "total": 1104880336896,
    "used": 830109804135,
    "storagePlanInformation": {
      "upgradeAvailable": false
    }
  }
}

And the bad (migrated, 1s accuracy)

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives/$entity",
  "createdDateTime": "2024-09-22T13:48:05Z",
  "description": "",
  "id": "XXX",
  "lastModifiedDateTime": "2024-10-09T13:47:55Z",
  "name": "OneDrive",
  "webUrl": "https://my.microsoftpersonalcontent.com/personal/XXX/Documents",
  "driveType": "personal",
  "createdBy": {
    "user": {
      "displayName": "SharePoint App"
    }
  },
  "lastModifiedBy": {
    "user": {
      "displayName": "System Account"
    }
  },
  "owner": {
    "user": {
      "email": "XXX",
      "displayName": "XXX"
    }
  },
  "quota": {
    "deleted": 0,
    "remaining": 854591117721,
    "state": "normal",
    "total": 1104880336896,
    "used": 250289219175,
    "storagePlanInformation": {
      "upgradeAvailable": false
    }
  }
}

This really highlights the different backends cos the JSON is quite different.

And this definitely looks like a bug in the backend of the new migrated drive! The API is returning zero in the "deleted" attribute.

Thanks, Microsoft. You always make things "fun".

1 Like

Thank you for sharing. Now it all makes perfect sense with OneDrives I work with. Clearly two different backend versions. Zero thrash issue started few month ago (of course on some only) but as I use personal accounts where thrash content does not count against quota I just slurred over it. These are exactly accounts where web GUI is different a bit than others. And GUI has bugs too:) another thing I ignore and do not use.