Skip to content

Instantly share code, notes, and snippets.

@love4taylor
Forked from ChenxiSSS/fix_exfat_drive.md
Last active June 6, 2022 12:37
Show Gist options
  • Select an option

  • Save love4taylor/e28c83ae91e0f77e65580f7a459d09d5 to your computer and use it in GitHub Desktop.

Select an option

Save love4taylor/e28c83ae91e0f77e65580f7a459d09d5 to your computer and use it in GitHub Desktop.
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs since exFAT drives may or maynot randomly get corrupted.

In my case, "not ejected properly" often casue the drive in Resource busy, Volume on xxx failed to mount, File system check exit code is 1, or Timed out waiting, when try to use both Disk Utility or diskutil to mount, repair, or first aid the disk.

Possible fix is this:

  1. Use diskutil list to find the right drive id.
    • You want the id under the IDENTIFIER column, it should look like disk1s1.
    • disk1 marks the entire Disk. disk1s1 or disk1s2 marks each Volume.
  2. Usually, you want to check if the disk is occupied by one or many process.
    • You can check possible occupation via ps -ax | grep <id from above> | grep -v grep, saying disk3s1.
    • You may get something like this:
      • 13699 ?? 11:52.83 /System/Library/Filesystems/hfs.fs/Contents/Resources/./fsck_exfat -y /dev/disk3s1.
    • You need to kill the process via sudo kill 13699.
  3. Now you can try to fix the Volume via sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk3s1
    • -d is debug so you'll see all your files output as they're processed.
    • If all good, you will get Mark volume clean?, answer YES will end the debug and get ** The volume xxx appears to be OK.
    • Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
  4. After the fix, you can mount the whole Disk via diskutil mountDisk disk3 or the specific Volume via diskutil mount disk3s1

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

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