I made a minimal reproducible example here: rclone_issue.7z - Google Drive (the password is rclone
; I need to password protect the archive because Google Drive flags zips containing Python scripts).
Please see README.md
in the archive for more information. If you run the example, you should see something like this:
PS C:\Users\Yichi\rclone_issue> py .\reproduce_issue.py
VSHADOW.EXE 3.0 - Volume Shadow Copy sample client.
Copyright (C) 2005 Microsoft Corporation. All rights reserved.
# Omitted a bunch of VSS related stuff
C:\Users\Yichi\rclone_issue>for /L %i in (1 1 3) do (
dir \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
C:\Users\Yichi\rclone_issue\windows-shadow-bug.exe \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
certutil -hashfile \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin MD5
timeout 1
)
C:\Users\Yichi\rclone_issue>(
dir \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
C:\Users\Yichi\rclone_issue\windows-shadow-bug.exe \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
certutil -hashfile \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin MD5
timeout 1
)
The filename, directory name, or volume label syntax is incorrect.
Testing "\\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy140\\Users\\Yichi\\rclone_issue\\test_src\\test.bin"
Size read with os.Stat : 142
Size read with os.File.Stat : 142
MD5 hash of \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin:
94cde25ecffd3f73240f3d83ffd6b5e4
CertUtil: -hashfile command completed successfully.
Waiting for 0 seconds, press a key to continue ...
C:\Users\Yichi\rclone_issue>(
dir \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
C:\Users\Yichi\rclone_issue\windows-shadow-bug.exe \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
certutil -hashfile \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin MD5
timeout 1
)
The filename, directory name, or volume label syntax is incorrect.
Testing "\\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy140\\Users\\Yichi\\rclone_issue\\test_src\\test.bin"
Size read with os.Stat : 142
Size read with os.File.Stat : 142
MD5 hash of \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin:
94cde25ecffd3f73240f3d83ffd6b5e4
CertUtil: -hashfile command completed successfully.
Waiting for 0 seconds, press a key to continue ...
C:\Users\Yichi\rclone_issue>(
dir \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
C:\Users\Yichi\rclone_issue\windows-shadow-bug.exe \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin
certutil -hashfile \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin MD5
timeout 1
)
The filename, directory name, or volume label syntax is incorrect.
Testing "\\\\?\\GLOBALROOT\\Device\\HarddiskVolumeShadowCopy140\\Users\\Yichi\\rclone_issue\\test_src\\test.bin"
Size read with os.Stat : 142
Size read with os.File.Stat : 142
MD5 hash of \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin:
94cde25ecffd3f73240f3d83ffd6b5e4
CertUtil: -hashfile command completed successfully.
Waiting for 0 seconds, press a key to continue ...
C:\Users\Yichi\rclone_issue>rclone copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin C:\Users\Yichi\rclone_issue\test_dst\rclone_file\
C:\Users\Yichi\rclone_issue>dir C:\Users\Yichi\rclone_issue\test_dst\rclone_file\test.bin
Volume in drive C has no label.
Volume Serial Number is 00B2-AADC
Directory of C:\Users\Yichi\rclone_issue\test_dst\rclone_file
2023/10/11 20:37 142 test.bin
1 File(s) 142 bytes
0 Dir(s) 217,217,105,920 bytes free
C:\Users\Yichi\rclone_issue>certutil -hashfile C:\Users\Yichi\rclone_issue\test_dst\rclone_file\test.bin MD5
MD5 hash of C:\Users\Yichi\rclone_issue\test_dst\rclone_file\test.bin:
94cde25ecffd3f73240f3d83ffd6b5e4
CertUtil: -hashfile command completed successfully.
C:\Users\Yichi\rclone_issue>rclone copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src C:\Users\Yichi\rclone_issue\test_dst\rclone_directory\
2023/10/11 20:37:44 NOTICE: test.bin.jovagef2.partial: Removing partially written file on error: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 ERROR : test.bin: Failed to copy: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 ERROR : Attempt 1/3 failed with 1 errors and: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 NOTICE: test.bin.heyehip2.partial: Removing partially written file on error: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 ERROR : test.bin: Failed to copy: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 ERROR : Attempt 2/3 failed with 1 errors and: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 NOTICE: test.bin.rinarez4.partial: Removing partially written file on error: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 ERROR : test.bin: Failed to copy: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 ERROR : Attempt 3/3 failed with 1 errors and: can't copy - source file is being updated (size changed from 133 to 142)
2023/10/11 20:37:44 Failed to copy: can't copy - source file is being updated (size changed from 133 to 142)
C:\Users\Yichi\rclone_issue>dir C:\Users\Yichi\rclone_issue\test_dst\rclone_directory\test.bin
Volume in drive C has no label.
Volume Serial Number is 00B2-AADC
Directory of C:\Users\Yichi\rclone_issue\test_dst\rclone_directory
File Not Found
C:\Users\Yichi\rclone_issue>if not exist C:\Users\Yichi\rclone_issue\test_dst\copy mkdir C:\Users\Yichi\rclone_issue\test_dst\copy
C:\Users\Yichi\rclone_issue>copy /Y \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy140\Users\Yichi\rclone_issue\test_src\test.bin C:\Users\Yichi\rclone_issue\test_dst\copy\
1 file(s) copied.
C:\Users\Yichi\rclone_issue>dir C:\Users\Yichi\rclone_issue\test_dst\copy\test.bin
Volume in drive C has no label.
Volume Serial Number is 00B2-AADC
Directory of C:\Users\Yichi\rclone_issue\test_dst\copy
2023/10/11 20:37 142 test.bin
1 File(s) 142 bytes
0 Dir(s) 217,217,105,920 bytes free
C:\Users\Yichi\rclone_issue>certutil -hashfile C:\Users\Yichi\rclone_issue\test_dst\copy\test.bin MD5
MD5 hash of C:\Users\Yichi\rclone_issue\test_dst\copy\test.bin:
94cde25ecffd3f73240f3d83ffd6b5e4
CertUtil: -hashfile command completed successfully.
-----------------------------------------------------
Snapshot creation done.
Basically what happens is the script will continuously write to a file, and at the same time try to create a VSS snapshot and rclone copy
from the snapshot.
A few observations:
- The MD5 hash of the file in the snapshot doesn't change if we check a few times (waiting 1s in between). I think at this point we can say with some confidence that the file indeed isn't changing in the snapshot. For some reason
dir
doesn't work for files in the snapshot (the filename, directory name, or volume label syntax is incorrect.
). windows-shadow-bug.exe
consistently reports the same size (os.Stat
andos.File.Stat
report the same number).rclone copy \somewhere\in\snapshot\test.bin \path\to\destination
works and the destination file has the correct hash.rclone copy \somewhere\in\snapshot\parent_directory \path\to\destination
doesn't work and complain aboutsource file is being updated
- The copy command behaves mostly the same as 3 (works, correct hash).