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 Best 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

Jul 30, 2022 12:45 PM in response to DG001

I'm still having problem, and it is mostly MKV files but has also happened with MP4 and AVI files. I've been using cp from the terminal to copy now, and it is just really sad when an OS can't get a simple "copy" right. No telling how many of my videos have been corrupted when moving them off the laptop and onto a backup drive. It is a major data loss and I guess Apple doesn't care about data integrity if you aren't storing the data on THEIR computers. Definitely going to switch to Linux as soon as I make room for a new computer.

Jul 31, 2022 9:12 AM in response to frankthewanderer

I did a short test but could not repeat the issue:


In macOS 12.5 I Finder-copied the same 1.86 GB .mp4 movie 9 times back-and-forth between Mac mini 2018 internal SSD and an external APFS SSD but the hashes seem to be the same (see below).


Can you repeat the issue at will? Does this happen only when Finder-copying to a server? Or to another folder or volume? Via USB or Ethernet or Wi-Fi? Which file system? How large files? What is the best and easiest way to verify the hash error, preferably between multiple files in input vs output folders?


ls -al
-rwxrwxrwx@ 1 *****  staff  1862672600 Jul 24 20:32 1_generation.mp4
-rwxrwxrwx@ 1 *****  staff  1862672600 Jul 24 20:32 9_generation.mp4

md5 1_generation.mp4
MD5 (1_generation.mp4) = 7dba3f80abc532570bd8954b14a7c0d9
md5 9_generation.mp4 
MD5 (9_generation.mp4) = 7dba3f80abc532570bd8954b14a7c0d9

shasum -a 512 1_generation.mp4 
16b6262e57b125cde2b0afee71b3a3fbfeadc16b9dd3a0dbd0678dfc4950fb39b205269c2d18e4330a92b21cef17e4309d3e7e31a1ae7de3dd5190b39ea06745  1_generation.mp4
shasum -a 512 9_generation.mp4 
16b6262e57b125cde2b0afee71b3a3fbfeadc16b9dd3a0dbd0678dfc4950fb39b205269c2d18e4330a92b21cef17e4309d3e7e31a1ae7de3dd5190b39ea06745  9_generation.mp4


Jul 31, 2022 6:31 PM in response to Matti Haveri

Hi Matti,


Thanks for having a look.


It looks to me as though Apple have added a 'Copy but Corrupt It' option within Finder to prevent users easily sharing dodgy files. Files of random data copy just fine.


In my testing it only corrupts dodgy files that have been downloaded from the internet. You can copy the same dodgy file using Finder multiple times and to different destinations and the corrupted copies will all be identical. If you change the file even slightly - say prepending a couple of bytes to the start - the altered files will copy perfectly without being corrupted.


The option is probably triggered by a hash value - presumably from the first few chunks of the file so it can be corrupted during the copy. I don't know where the list of dodgy hashes is coming from - maybe the OS looks for files created by a torrent client or is downloading the hashes from somewhere else. They do seem to be stored on the local machine because the file copy is corrupted even if the local machine is offline when you perform the copy.


I did lodge a support call with Apple but they have since gone a bit silent on me which is I guess understandable if it isn't actually a bug.


Anyway there are other ways to copy files on OSX and I expect the Finder changes will be reverted eventually. After all, what could possibly go wrong with a 'Copy but Corrupt It' function built in to your OS?





Aug 24, 2022 10:02 AM in response to Steve_Agnew_NZ

Unfortunately, I have no solution. But this is the same problem I've been having since March 2022 (after I updated Monterey to 12.3). Hope this can shed some light on the problem at least.


I have a MacBook Air early-2020 (Model: A2179) and an iMac 2017 (Model: A1419, upgraded to 32GB RAM). Both installed with macOS 12.5.1 current, WiFi and wired network via AirPort Extreme (ME918Z/A) and AirPort Time Capsule (ME182Z/A).


This error occurs on both Macs, I have three LaCie d2 10TB external drives (series linked via Thunderbolt 3), one LaCie 2big RAID 28TB (USB-C) and one NAS Synology DS920+ 64TB (Wired network cable) all drives are Seagate IronWolf Pro HardDrives as all formatted to APFS except NAS which is Synology's "BtrFs" format as JBOD.


I've spent countless hours trying and troubleshooting, unplugging one drive after another, but then after a while, it happens again. Tried on both MacBook and iMac, happens anyway after a while. Can't find any pattern, other that if I copy a file to another disk, I never know if it's broken unless I test it extensively. I move many 100 video files in from large projects, and do not have any opportunity to check each individual file after transfer. Have lost over 20TB of footage and at least 1k working hours of edited video material which is now lost forever. Because I found out after a while that the copying had failed, but after deleting the originals. 🙈 So I have not been able to work properly since I found this out since March 2022. All my work is at hold, since I can't use the disks as they should. Even sent a drive to Seagate to use their recovery service and have the drive replaced, as I was sure it was the one causing all the problems. To discover soon after, that the problem was still there! I have also sent in the iMac for service, but the Apple workshop found no faults and did not change anything. Again costing me precious time and money. Googled for many hours to find something about this, but never found any useful info until this thread. 😉 Also spent several tens of hours with Seagate customer service. Seagate has really tried everything, as I was sure it was the drives until recently (now). But it makes sense that this could be a software error, so now the iMac should be downgraded to MacOS Big Sur asap. So maybe this will finally stop 👌, as I don't dare move a single file as it is now. Also spent countless hours on troubleshooting, becoming increasingly puzzled as the error occurs on all disks, but never know when and where it happens.


The only pattern I've seen is that it doesn't happen right away right after a reboot/or recently connected an external disk. And that it mainly applies to video files. When the error first occurs, if I copy the same file to each of the disks: all will contains the exact same error (for example missing 5 frames after 30 seconds) on each of the files on all the disks even the original file are fine! If I unmount the source disk, and unplug the power for 10 seconds. Then I connects again, then everything works perfectly fine again until suddenly it happens again. 🤯 And the file can be copied to any disk without missing the same error as in the example. It can take 10 minutes after you connect a USB disk, or it can take a week. But happens every time I move somewhat large projects etc (as several hundred GB or a few TB).


Incredibly frustrating, this is what I mainly do om my iMac/LaCie drives and have all this expensive equipment for. This error has made everything worthless to me. I have no words for how frustrated I am. Have almost exclusively used a mac since 2007, if it turns out that this is a software error. Then they have at the very least suffered a setback in my eyes Sorry for my bad Norwegian-English.

Aug 25, 2022 6:44 AM in response to Steve_Agnew_NZ

Just confirming I also have this issue.


it doesn’t matter if I’m copying to or from internal/external drives, the file gets corrupted (hash changes).


As a test I downloaded a really obscure video, and it still got corrupted, so I can’t see this being Apple knowing they are dodgy files!


It only does it with video files, not .ISOs etc.


It has nothing to do with whether the file was downloaded via BT.

Aug 30, 2022 11:15 AM in response to logolf

A couple of days ago one of my LaCie 10TB HHD failed big time, the one drive that I never suspected (under two years old). The one that has worked perfectly all the way. As soon as I disconnected it, the problem disappeared. Unable to provoke the error any more, so it's probably the disk that has provoked all these strange errors for five months. I never got to test the bug properly in macOS Big Sur, at this happened the same day i downgraded til Big Sur. Now everything seems to work perfectly again in macOS Monterey 12.5.1 (provoked the system with coping files from the one disk to another for two days now, all works fine). Then it was probably just a hard drive that caused it, no software bug(s). Finally it looks like I can start working again. 🥳 Very happy that I think I have found the bug after almost 6 months of troubleshooting. 😅 Thank you for for listening to my complaints! 🙈 Take care!

I guess the error was just a start of a failing disk who failed for some time (about 6 months before it revealed itself)!

Sep 1, 2022 6:21 PM in response to Steve_Agnew_NZ

An update for lurkers: I have updated to the latest 4.4.5 version of QBitTorrent and the problem has gone away. I have rechecked the files in this thread that I had used as examples and they now all download and copy correctly, so it does appear the problem was related to QBitTorrent. Thanks to all who responded - it sure was a weird problem.


Sep 2, 2022 4:12 AM in response to Steve_Agnew_NZ

How interesting and you may have guessed that I also have QBitTorrent. So are you saying that somehow QBT was preventing Finder from transferring the files correctly? How could the two things even be connected?


So in theory, if we downloaded a bunch of videos on the the older version QBT, then uninstalled QBT, Finder would have worked properly? So very confusing but I'll update and try it out again for sure now. Thanks for the update.

Sep 2, 2022 7:38 AM in response to DG001

I have also been using QBT. So it is possible that the old version QBT was corrupting the file in some way, however Finder is still at fault for corrupting the file further. Why does the "cp" command from the terminal work just fine without corrupting the file, yet Finder drag and drop corrupts the file? This is still a problem with Finder.

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 ID.