Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

Can't remove corrupted file from external drive

Hi all,


I have been working on fixing this for hours now but can't seem to find the solution. Here's what happened:


While copying over files from my macbook pro to an external drive it gave an error code (can't remember which one) and stopped the process. When I then looked at the folder that has the newly copied files there are 10 files of which one is grayed out. The drive has become very slow and when I try to delete the grayed out file it gives me the following error: The operation can’t be completed because an unexpected error occurred (error code -50).


So I have been struggling with Terminal and all sorts of commands (sudo rm –f , sudo rm -rf , ls -lO , ls -lOd .) etc etc but to no avail. I also tried to move the file from the drive, re-copy the file to the drive but nothing works.


Is there anything that I am missing here? The drive is rather important to me so reformatting is not really an option at the moment as I really need the data that is on the drive.


I hope there is something else that I can do apart from what I have tried. It seems like the file is just stuck in the copy process and therefor does not allow any other operation.


Thanks a lot for helping me out with this...


Cheers Jacob

MacBook Pro (17-inch Early 2011), Mac OS X (10.7.5)

Posted on Nov 7, 2013 4:23 AM

Reply
6 replies

Nov 7, 2013 4:56 AM in response to Djeap1977

Which drive is important to you - the MacBook Pro, or the external drive?


It sounds to me as if a hardware failure is ocurring on the external drive, and it may not recover even if you do reformat it. But some things to try first:

  • Shut down the OS and reboot - let the initial filesystem checkout see if it can fix things
  • Try removing .DS_Store (on the external drive, in the offending directory) and retry a copy operation using cp rather than the finder
  • Try DiskUtil and its 'repair permissions' option
  • The usual suspects for filesystem repair - DiskWarrior, etc.

You may need to copy/rescue files off of that external drive and use another storage opion - it may not be long for this world.

Nov 7, 2013 5:08 AM in response to JustSomeGuy

Hey JustSomeGuy,


Thanks for the response. It is the external drive that has the data I need to keep. Reboot did not do it...


What I did get done just now is going into Safe Mode and delete the problematic files there and Empty Trash. That worked - so one step closer hopefully. I did not do the .DS Store files (will do that after done writing this).


How do I do a copy with cp rather than the finder?


Repair permissions is grayed out in DiskUtil - I did do a Disk Repair in Safe Mode and that turned up without error. However, now back in normal mode - Disk Repair gives an error again saying that the drive cannot be unmounted.


Thanks for the help so far.


Cheers

Nov 7, 2013 7:41 AM in response to Djeap1977

Djeap1977 wrote:


How do I do a copy with cp rather than the finder?


It's an arcane Unix thing:

cp /path/to/old/files/* /path/to/new/files


You can find the path names by dragging and dropping an icon from Finder to a terminal window.


But the larger problem is the external drive, which sounds to me as if it has become unstable. You can copy the files to it, but if they are not restorable later - of what value is it to you?

Nov 7, 2013 8:19 AM in response to JustSomeGuy

So what ended up saving my data was staying in Safe Mode, then deleting all (and I mean ALL) the .DS Store files on the drive. Then I could suddenly transfer all the files from the External HD to my Mac. I did have unmount and re-mount the External HD before starting the copy.


After that I reformatted the drive, did all the tests on it that I could think of to see if there is an issue with the drive. The drive seems to be okay but for safety measures I am leaving the files on my Mac for now until I have my new NAS.


Thanks a lot for the help!

Nov 7, 2013 10:17 AM in response to Djeap1977

Awesome, glad that worked for you. I wrote a command I call 'rmds' that recursively removes the .DS_Store files and other detritus the OSX filesystem seems to like to have around. Until now I have not viewed them as anything but annoyances. But the fact that they got corrupted on your drive is still troubling. Keep backing your important stuff up!

Can't remove corrupted file from external drive

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