Skip to content

Instantly share code, notes, and snippets.

@scottopell
Last active March 26, 2025 09:24
Show Gist options
  • Save scottopell/595717f0f77ef670f75498bd01f8cab1 to your computer and use it in GitHub Desktop.
Save scottopell/595717f0f77ef670f75498bd01f8cab1 to your computer and use it in GitHub Desktop.
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

If Disk Utility is unable to repair, consider trying this:

  1. In Disk Utility, ensure that the drive is not mounted, eject it if it is mounted.
  2. Use diskutil list to find the right drive id.
  3. You want the id under the IDENTIFIER column, it should look like disk1s1
  4. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  5. -d is debug so you'll see all your files output as they're processed.
  6. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
  7. Open Disk Utility and you should be able to repair here successfully.

See the apple man page below for details on the fsck_exfat utility.

Sources/Extra Reading: https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/fsck_exfat.8.html https://craigsmith.id.au/2014/07/06/repairing-a-corrupted-mac-osx-exfat-partition/ https://discussions.apple.com/thread/4154638?tstart=0

@markste-in
Copy link

I have tried your suggestions @scottopell but it has not worked for me. What should I do next?

$ sudo fsck_exfat /dev/disk2s2
Password:
** Checking volume.
** Checking main boot region.
fsck_exfat: Could not read boot region
** The volume  could not be verified completely.
$ sudo fsck_exfat -d disk2s2
Password:
Opening /dev/rdisk2s2
** Checking volume.
** Checking main boot region.
fsck_exfat: Could not read boot region
** The volume  could not be verified completely.

I got the same error and struggled quite a bit with it. I almost gave up but the solution is not that hard. You actually 'just' need to overwrite the the dirty flag (at least in my case). I wrote a little script here

https://github.com/markste-in/exfat-repair

@layerstech
Copy link

image image

Running First Aid on “layers” (disk4s1)

Checking file system and repairing if necessary and if possible.
Volume is already unmounted.
Performing fsck_exfat -y -x /dev/rdisk4s1
Checking volume.
Checking main boot region.
The volume could not be verified completely.
File system check exit code is 1.
Restoring the original state found as unmounted.
File system verify or repair failed. : (-69845)

Operation failed…

Pls help to solve this error, as not able to find SSD in fider......

@kkang386
Copy link

kkang386 commented Mar 26, 2025

Thanks for @cocotyty's post in 2022.
This saved my exfat drive from an inadvertent ejection:
brew install gdisk
sudo gdisk /dev/diskxyz
w

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment