You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

File this under Weird: In Monterey copying a file with Finder corrupts the data in the target file

I have a really odd problem where files are being corrupted when I use Finder to copy them from my MacBook Air to my Mac Mini server. I only noticed this after seeing video glitches when I went to play the files back on my TV. When I compared the local files with their copies on the server, whole sections of data had been replaced with #00 characters.


If I generate an MD5 hash then I can check the copied file against the original, which in this case shows that the source and target files are clearly different. Initially I thought it might be a problem with my wireless network, but what is really weird is that when I copy the same file from the MacBook Air to a locally attached USB SSD drive then it is corrupted in the exact same way - the MD5 for the corrupted file on the SSD is the same value as the corrupted file on my server.


The source computer is an Intel MacBook Air running the most recent Mac OS Monterey 12.3.1. The server is an older Mac Mini running Catalina 10.15.7. I don't think the old software version on the server is a factor as the same corruption happens copying the file to a local USB SSD disk. Rsync copies the file correctly to the USB SSD Drive, so I think it's the Finder drag and drop that's causing the problem. I don't recall seeing this problem before upgrading the MacBook Air to Monterey.


Has anyone seen anything like this before?


Thanks for your help,


Steve

MacBook Air (2020 or later)

Posted on Apr 30, 2022 11:38 PM

Reply
Question marked as Top-ranking reply

Posted on Aug 25, 2022 3:56 PM

OK, here is what I am seeing. I used QBitTorrent to download the file Only.Murders.in.the.Building.S02E10.1080p.WEB.H264-CAKES[TGx]. The MD5 hash for the only.murders.in.the.building.s02e10.1080p.web.h264-cakes.mkv file is f63c9b25296bdbf4ae92640c5a65456a. If I use Finder to copy it onto my USB SSD drive, the MD5 for that file is d54e47ed0557d5239a3d656dd3831241, so clearly the files are different.


If I use cp or rsync to copy the local file onto my SSD drive it copies correctly with no corruption - they have same MD5 hash as the local file.


I opened a terminal window and use the cp command to create a duplicate copy of the original .mkv file which I called test.mkv, which has - as you would expect - the same MD5 hash as the original. If I copy this file to the SSD drive it copies correctly with no corruption. Let's try something else. I opened the original .mkv file in HexFiend and used the Save As option to duplicate it without editing it. Copying that duplicate file to the SSD works correctly too.


Copying the original .mkv file over to the SSD drive once more using Finder, I get exactly the same hash as the earlier corrupted copy, so it is being repeatably corrupted in exactly the same way. I renamed the original file and then used Finder to copy it and it was corrupted in exactly the same way.


So Finder is corrupting the file during the copy, but what does it actually look like? I wrote a program to compare the two files which produced this:


Size for both files is 1421335900 bytes

Matched 135139328 bytes from 1 to 135139329

Cleared 45056 bytes from 135139329 to 135184385

Matched 851968 bytes from 135184385 to 136036353

Cleared 40960 bytes from 136036353 to 136077313

Matched 82153472 bytes from 136077313 to 218230785

Cleared 4096 bytes from 218230785 to 218234881

Matched 28672 bytes from 218234881 to 218263553

Cleared 16384 bytes from 218263553 to 218279937

Matched 43192320 bytes from 218279937 to 261472257

Cleared 94208 bytes from 261472257 to 261566465

Matched 58478592 bytes from 261566465 to 320045057

Cleared 16384 bytes from 320045057 to 320061441

Matched 42364928 bytes from 320061441 to 362426369

Cleared 40960 bytes from 362426369 to 362467329

Matched 25534464 bytes from 362467329 to 388001793

Cleared 249856 bytes from 388001793 to 388251649

Matched 10924032 bytes from 388251649 to 399175681

Cleared 57344 bytes from 399175681 to 399233025

Matched 624123904 bytes from 399233025 to 1023356929

Cleared 20480 bytes from 1023356929 to 1023377409

Matched 397958492 bytes from 1023377409 to 1421335900 <EOF>

Processed 1421335900 bytes.


The pattern of the corruption is that every so often during the copy, large parts of the data are zeroed out in the target file. The file sizes are identical. But it doesn't happen on every file - just on the original file downloaded by qBitTorrent. You programmers might have noticed some hinky numbers there.


So the symptoms are:


  1. Using Finder to copy the file results in a corrupted target file (MD5 mismatch).
  2. Source and target file sizes are identical.
  3. Large sections of the target file have been zeroed out during the Finder copy.
  4. It is repeatable. If you copy the file using Finder once more it is corrupted identically (Same MD5 as the original copied corrupted file).
  5. If you duplicate the file (using cp), Finder will copy the duplicated file correctly.
  6. If you copy the file in a terminal window using cp or rsync it copies correctly.


If you are seeing this problem please report it to Apple so we can raise awareness of it and get it fixed.



Similar questions

57 replies

File this under Weird: In Monterey copying a file with Finder corrupts the data in the target file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.