How to delete corrupted files from an inaccessible exFAT external hard drive on a Mac using terminal commands?

One of my external hard drives stopped working yesterday. I know which files got corrupted and even the path names to that group of files -- is there a way I can use terminal commands to delete those files even though the drive is inaccessible in Finder?


  • This hard drive is in the exFAT format.  I use a MacBook Air that's running Sequoia 15.3.2.
  • Disk Utility recognizes that the external drive is plugged in, but says it's not mounted. 
  • When I tried to run first aid on it I got the "found incomplete directory entry" message for pretty much all of the (thousands of) files that are in my Final Cut library. 
  • Trying to repair it using my husband's Windows PC didn't work either. The PC could view the drive and see the first level of files and folders, but wasn't able to open any of them. 
  • EaseUS Data Recovery Wizard didn't work (to be fair, I didn't let it finish. It said it was going to take 22 hours. After 5 hours it still said "0 files found" so I stopped the process) 
  • I tried assessing the health of the drive using DriveDx but it's not able to run diagnostics on the drive even after installing the SAT SMART driver and adjusting the security settings to allow kernel extensions. This must be a DriveDx issue because I have two of the exact same hard drive models and it can't run diagnostics on the functioning one either, not just the corrupted one. 
  • I tried to create an image of the disk but it didn't get past "reading whole disk (unknown partition: 0)". 


Trying to avoid going through the trouble of passing this off to a professional company (maybe I've done too much damage at this point anyways?). Hopefully that's all the necessary info that can help determine what other options I have.


I'm thinking if I use terminal to delete my Final Cut library then that should solve the issue? But I'm not sure if that's actually how that works and I'm too scared that I'm going to accidentally delete something I shouldn't.


Thanks so much for your help!!


[Re-Titled By Moderator]

MacBook Air 13″, macOS 15.3

Posted on Mar 30, 2025 7:45 PM

Reply
1 reply
Sort By: 

Mar 31, 2025 9:36 PM in response to annmakno

It sounds like you don't have a backup of the data on this damaged and/or failing external drive. Backups are extremely important for your computer & all external media (including the cloud) which contains important & unique data.


What is the exact make & model of this external drive?


You can try checking the health of the external drive on the Windows PC by using GSmartControl. There is a portable version of GSmartControl you can download & run directly from the Downloads folder so that you don't have to clutter up your Windows installation. Feel free to post the complete report here if it is able to see any SMART health information.


If DriveDx is unable to access any SMART health information on a drive, then it is not usually an issue with DriveDx, but is an issue with the drive itself (or an adapter, enclosure) used with the drive which can block access to the SMART feature of the drive. Or perhaps that drive does not support SMART. DriveDx uses the same open source utility at its core to communicate with a drive's SMART feature (the same one is also used with GSmartControl). Since Windows doesn't need any special drivers to access SMART on an external drive, it may have better results since macOS has so many new privacy & security features that could possibly prevent the special USB driver from working.


You have two options for trying to access the data on this drive yourself. You can try using the command line to manually mount the drive as read-only which usually skips any scanning.


The other option would be to boot a Knoppix USB stick on your Windows PC and use GNU ddrescue to make a low level clone of that drive to another drive or to a raw image file (this utility is already installed on Knoppix). I personally prefer to clone a drive to a raw image file so I can either work from another copy of the image file, or use that image file to as an intermediary source to clone the contents to another drive which you will try to run utilities to get access to the data. If you make a mistake, then you can use another copy of the raw image file data, or clone it back to the new destination drive to attempt other utilities. While GNU ddrescue is available for both macOS & Windows, I find using Linux is best since macOS definitely gets in the way especially if the drive is bad....Windows may do better, but I think it may also have some issues (I've never used it on Windows). Of course this requires access to at least one other drive of the same size or larger to hold a complete clone of the source. And another drive where you can store items you can rescue from the clone (you don't want to use the clone permanently even if you get it working...once the data is retrieved you can erase the clone drive to re-use it for something else).


You neglected to mention the type & size of the external drive. In order to scan the whole drive, it can take days for a healthy multi-TB Hard Drive. I'm guessing your data recovery software was performing a low level extended scan.


If the drive is failing, then you may only get one chance at recovering data from it. So choose wisely whether you attempt to recover the data yourself.


Reply

How to delete corrupted files from an inaccessible exFAT external hard drive on a Mac using terminal commands?

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