Restore Windows snapshot on MacOS results in "invalid file size"

So I backed up a Windows machine using the latest version of Restic. Then I restored it to an exFAT volume on MacOS (also the latest version). I got a ton of “invalid file size” errors, and the files were corrupt.

I did a “restic check --read-data” and it says “no errors were found”.

Here’s an example TIFF that was corrupted:

I guess I’ll try to restore via Windows and hope that works…


Update: I restored the 106GiB snapshot using “–overwrite if-changed --delete” on a Windows machine and it skipped 2.921GIB and restored 103.604 GiB. So the vast majority of the snapshot restored via MacOS was apparently invalid. It’s still restoring, but this is promising.


Update 2: It restored fine on Windows. It ALSO restored fine on MacOS as long as the target was APFS (would probably work on HFS+ too).

Apparently the failure is restoring a backed up Windows profile to an exFAT disk specifically under MacOS. Now I’d expect some weirdness with “special” files deep within the AppData folder for instance - links and whatnot - but I was seeing it over 90% of the data, and even just user data in the Desktop / Documents folders.

This is unfortunate for me, because I do all my user backups using Restic, manage my main repository on MacOS, and can only transfer data between MacOS and Windows using exFAT on Apricorn drives due to office policy.

Will test more next week and see if I can’t narrow down what’s failing.

Do you have the full error message?

So if I restore to APFS, it verifies successfully. If I restore to exFAT, it does this:

verifying files in /Volumes/1TB_Secure/test
ignoring error for /Volumes/1TB_Secure/test/Alexa488_20xCA1Snap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa488_20xCA1Snap.tif: expected 4237380, got 3940355
ignoring error for /Volumes/1TB_Secure/test/Alexa488_DAPI-10xDGSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa488_DAPI-10xDGSnap.tif: expected 4237391, got 576323
ignoring error for /Volumes/1TB_Secure/test/Alexa488_DAPI-20xCA1Snap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa488_DAPI-20xCA1Snap.tif: expected 4237376, got 1883777
ignoring error for /Volumes/1TB_Secure/test/Alexa594_20xCA1Snap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa594_20xCA1Snap.tif: expected 4237380, got 2367227
ignoring error for /Volumes/1TB_Secure/test/Alexa488_4xHip.tif: Unexpected content in /Volumes/1TB_Secure/test/Alexa488_4xHip.tif, starting at offset 3101617
ignoring error for /Volumes/1TB_Secure/test/Alexa594_DAPI-10xDGSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa594_DAPI-10xDGSnap.tif: expected 4237391, got 1055306
ignoring error for /Volumes/1TB_Secure/test/Alexa594_DAPI-20xCA1Snap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa594_DAPI-20xCA1Snap.tif: expected 4237377, got 553011
ignoring error for /Volumes/1TB_Secure/test/BleachExample.tif: Invalid file size for /Volumes/1TB_Secure/test/BleachExample.tif: expected 4237372, got 3730622
ignoring error for /Volumes/1TB_Secure/test/Bright-ApoE-CA3-L-3min_10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Bright-ApoE-CA3-L-3min_10x.tif: expected 4235553, got 665204
ignoring error for /Volumes/1TB_Secure/test/Bright-ApoE-DG-L-3min_10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Bright-ApoE-DG-L-3min_10x.tif: expected 4235554, got 3585911
ignoring error for /Volumes/1TB_Secure/test/Bright-DG-L_Rb-10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Bright-DG-L_Rb-10x.tif: expected 4235563, got 1037156
ignoring error for /Volumes/1TB_Secure/test/Brightfield-HIP-1delete-4x.tif: Invalid file size for /Volumes/1TB_Secure/test/Brightfield-HIP-1delete-4x.tif: expected 4235573, got 1683319
ignoring error for /Volumes/1TB_Secure/test/Brightfield2-HIP-1delete-10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Brightfield2-HIP-1delete-10x.tif: expected 4235593, got 1928625
ignoring error for /Volumes/1TB_Secure/test/Brightfield2-HIP-rb-10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Brightfield2-HIP-rb-10x.tif: expected 4235593, got 2914512
ignoring error for /Volumes/1TB_Secure/test/PrimaryDel_488-CA120xSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/PrimaryDel_488-CA120xSnap.tif: expected 4237380, got 784074
ignoring error for /Volumes/1TB_Secure/test/PrimaryDel_488-DG20xSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/PrimaryDel_488-DG20xSnap.tif: expected 4237380, got 794890
ignoring error for /Volumes/1TB_Secure/test/PrimaryDel_594-CA120xSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/PrimaryDel_594-CA120xSnap.tif: expected 4237380, got 622479
ignoring error for /Volumes/1TB_Secure/test/PrimaryDel_594-DG10xSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/PrimaryDel_594-DG10xSnap.tif: expected 4237394, got 1254403
ignoring error for /Volumes/1TB_Secure/test/SantaCruz-Bright-Etop-DG-R_8min-10x.tif: Invalid file size for /Volumes/1TB_Secure/test/SantaCruz-Bright-Etop-DG-R_8min-10x.tif: expected 4235563, got 4223554
[0:00] 100.00%  49 / 49 files verified
Fatal: There were 19 errors

If I do it a subsequent time, I get this:

verifying files in /Volumes/1TB_Secure/test
ignoring error for /Volumes/1TB_Secure/test/Alexa488_DAPI-10xDGSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa488_DAPI-10xDGSnap.tif: expected 4237391, got 4141059
ignoring error for /Volumes/1TB_Secure/test/Alexa488_DAPI-20xCA1Snap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa488_DAPI-20xCA1Snap.tif: expected 4237376, got 3846142
ignoring error for /Volumes/1TB_Secure/test/Alexa594_DAPI-20xCA1Snap.tif: Invalid file size for /Volumes/1TB_Secure/test/Alexa594_DAPI-20xCA1Snap.tif: expected 4237377, got 1534381
ignoring error for /Volumes/1TB_Secure/test/Bright-ApoE-CA3-L-3min_10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Bright-ApoE-CA3-L-3min_10x.tif: expected 4235553, got 3418225
ignoring error for /Volumes/1TB_Secure/test/Brightfield-HIP-1delete-4x.tif: Invalid file size for /Volumes/1TB_Secure/test/Brightfield-HIP-1delete-4x.tif: expected 4235573, got 2807741
ignoring error for /Volumes/1TB_Secure/test/Bright-DG-L_Rb-10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Bright-DG-L_Rb-10x.tif: expected 4235563, got 2233438
ignoring error for /Volumes/1TB_Secure/test/Brightfield2-HIP-1delete-10x.tif: Invalid file size for /Volumes/1TB_Secure/test/Brightfield2-HIP-1delete-10x.tif: expected 4235593, got 3877713
ignoring error for /Volumes/1TB_Secure/test/PrimaryDel_488-CA120xSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/PrimaryDel_488-CA120xSnap.tif: expected 4237380, got 4003776
ignoring error for /Volumes/1TB_Secure/test/PrimaryDel_594-DG10xSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/PrimaryDel_594-DG10xSnap.tif: expected 4237394, got 1856579
[0:00] 100.00%  19 / 19 files verified
Fatal: There were 9 errors

And another time:

verifying files in /Volumes/1TB_Secure/test
ignoring error for /Volumes/1TB_Secure/test/PrimaryDel_594-DG10xSnap.tif: Invalid file size for /Volumes/1TB_Secure/test/PrimaryDel_594-DG10xSnap.tif: expected 4237394, got 2916892
[0:00] 100.00%  9 / 9 files verified
Fatal: There were 1 errors

And once more:

Summary: Restored 1 files/dirs (4.041 MiB) in 0:00, skipped 49 files/dirs 197.965 MiB
verifying files in /Volumes/1TB_Secure/test
[0:00] 100.00%  1 / 1 files verified
finished verifying 1 files in /Volumes/1TB_Secure/test (took 3ms)

Apparently if I run it multiple times on the same target restore directory, it will eventually randomly restore everything properly. Fascinating.

Maybe this is the clue? macOS is known to have issues with exFAT drives formatted by other OS (you can easily Google for details).

In general from my experience if you can use native filesystem for anything more complex than simple copying files. It apples to any OS. exFAT for me is only useful when I have no network and have to move files between very different architectures. Otherwise it is just history of IT not fit for anything modern.

Good thought, but nah, I always format my exFAT drives with my Macs. Macs can get fussy about the cluster sizes that Windows will choose sometimes. And unfortunately a big part of my job is moving data between Windows and Mac, with Apricorn drives formatted as exFAT. Also I’m pretty much the resident Mac / Linux guy. All the scientists I work for use Macs - but a lot of the administrative staff uses Windows.

Ps. If the cluster size (aka formatted by Windows) WAS the problem… the drive wouldn’t even mount, let alone randomly do this haha. Also I have done this many times. I know exFAT doesn’t handle a lot of the aliases / links, but I’ve never seen incorrect file sizes randomly appear like this. It’d be different if it was the same file every time, but it’s not. It’s (seemingly) random.

@akrabu : Those verification errors look like a bug to me. Restore errors shouldn’t only show up during the verify phase. Can you open a bug on Github? (Will probably take a bit of time until I can take a closer look).

2 Likes

Tracked here :+1:

I’ve created a patch that might solve the issue: restore: serialize file writes if preallocation is not possible by MichaelEischer · Pull Request #5553 · restic/restic · GitHub . As this is based on speculation about the underlying issue it might also not help at all.