Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
  6. 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

@AravindaSetty
Copy link

AravindaSetty commented May 6, 2021

Thank you this was very useful, I had an 8TB drive crashed got all the data recovered....

@xiaodiwong
Copy link

xiaodiwong commented May 21, 2021

I'm getting an error saying- "Can't open /dev/rdisk2s2: Resource Busy". What do I do?

I was stuck with "Resource Busy" too, but a comment on the Source link (on craigsmith.id.au) describes how to find and kill the process locking the resource which worked for me.

ps -ax | grep disk2 (but your disk)
13699 ?? 11:52.83 /System/Library/Filesystems/hfs.fs/Contents/Resources/./fsck_hfs -y /dev/disk2s2

sudo kill 13699

Once the offending process is killed, I got an OS prompt about an error mounting the drive (something along the lines of it being mounted in read only mode, don't remember the wording). After that the drive mounted in Finder and Disk Utility and I was able to run "First Aid" using "Disk Utility"

i did exactly the same and i manage to reach to the step whereby i am able to run "First Aid" using "Disk Utility", however, i get stuck at first aid for very very long time and it doesn't move on from there, anybody can help me?

@T3kbug58
Copy link

T3kbug58 commented Jun 1, 2021

Hi I tried the above. After the drive debug on a 6TB WD Elements usb hard drive Took more than 12/hrs whew...the message said "everything seems to be ok" received No errors. Back to square one the drive shows but still won't repair in disk utility tried almost everything since mid March of this year. One thing I did notice maybe that's the problem I go to the drive icon right click go to "Get info" my Storage Info is wrong it says Modified:Monday, December 31,1969 at 11:00PM and under General: Created: Wednesday,December 31,1969 at 7:00PM Modified: Monday, December 31,1979 at 11:00PM. The format, capacity, available space left on partion info are correct. The drive content did show on windows but Not in Mac the format is Exfat there is a 'Back Up" partion also.When I run Diskutil: I get this message "Updating boot support partitions for the volume as required.Unable to unmount volume for repair.Operation failed..." The drive did open once the files were accessible. When I reboot my Mac I'm back to square one. Any ideas on how to fix this problem. I ran fsck in single mode diskutil in terminal all that.At least I got some good Mac lessons. Please Help Thanx

@markveronin
Copy link

markveronin commented Jun 15, 2021

I'm getting password enter doesn't work and I don't have a password for the computer or the drive

@T3kbug58
Copy link

T3kbug58 commented Jun 15, 2021

@donymvarkey
Copy link

donymvarkey commented Jun 19, 2021

I am not able to erase my drive. It's 240gb ssd. While I try to erase my disk in disk utility, it is stuck saying "Waiting for partitions to activate". Is there any way to fix this issue?

@shashwattiwari
Copy link

shashwattiwari commented Jul 5, 2021

➜  ~ sudo fsck_exfat disk2s1
fsck_exfat: Opened /dev/rdisk2s1 read-only
** Checking volume.
** Checking main boot region.
   Main boot region is invalid. Trying alternate boot region.
** Checking alternate boot region.
   Alternate boot region is invalid.
** The volume  could not be verified completely.

Any update for this?

@alokrawat050
Copy link

alokrawat050 commented Jul 27, 2021

~ sudo fsck_exfat disk4s1
fsck_exfat: Opened /dev/rdisk4s1 read-only
** Checking volume.
** Checking main boot region.
Main boot region is invalid. Trying alternate boot region.
** Checking alternate boot region.
Alternate boot region is invalid.
** The volume could not be verified completely.

I am also facing the same ↑, anyone solve this?

@nkp0009
Copy link

nkp0009 commented Aug 13, 2021

I was stuck with "Resource Busy" too, but a comment on the Source link (on craigsmith.id.au) describes how to find and kill the process locking the resource which worked for me.

ps -ax | grep disk2 (but your disk)
13699 ?? 11:52.83 /System/Library/Filesystems/hfs.fs/Contents/Resources/./fsck_hfs -y /dev/disk2s2

sudo kill 13699

Its working for me thank you so much

@akashrajpal
Copy link

akashrajpal commented Sep 7, 2021

I'm getting an error saying- "Can't open /dev/rdisk2s2: Resource Busy". What do I do?

I used activity monitor and killed the "fsck" activity. Then it worked. It was as simple. If it does not work try killing in activity monitor in safe boot (press shift while booting)

PS: sudo fsck command did not work for me in command S commamd line, neither it worked for me in recovery mode terminal.

The ntfs disks are so delicate. I wish there was a crashproof partition system.

@krsnk
Copy link

krsnk commented Nov 25, 2021

➜ ~ sudo fsck_exfat disk2s1 fsck_exfat: Opened /dev/rdisk2s1 read-only ** Checking volume. ** Checking main boot region. Main boot region is invalid. Trying alternate boot region. ** Checking alternate boot region. Alternate boot region is invalid. ** The volume could not be verified completely.

Did anyone solve this yet? I beg you tell how

@bonatoc
Copy link

bonatoc commented Dec 8, 2021

@krsnk — Did you try from the Terminal:

diskutil list

The volumes listed should show your disk ("rdisk2s1") and possibly its partitions.

Then, copy paste this (replace "disk2") in the example below with your disk's or partition's name (of course, remove "(but your disk)").

sudo ps -ax | grep disk2 (but your disk)

you should get the process number keeping your disk busy:

13699 ?? 11:52.83 /System/Library/Filesystems/hfs.fs/Contents/Resources/./fsck_hfs -y /dev/disk2s2

Then execute:

sudo kill 13699

In the example above, "13699" refers to the process currently busy, but it should be a different number on your machine.

After killing the process, the drive should mount, with a Finder's warning.

@mutoo
Copy link

mutoo commented Dec 11, 2021

Thanks, this fixed my Seagate SSD which can not be mounted

** Checking active bitmap.
Checking bitmap cluster 2
Read      offset = 0x000001f00000  length = 0x020000
Read      offset = 0x000000100000  length = 0x001000
Read      offset = 0x000000105000  length = 0x001000
Read      offset = 0x000000108000  length = 0x001000
Read      offset = 0x000000109000  length = 0x001000
Read      offset = 0x00000010a000  length = 0x001000
Read      offset = 0x00000010b000  length = 0x001000
   The bitmap needs to be repaired.
0000001B: FF should be BF
0000029B: FF should be 47
0000029C: FF should be CE
000002A0: FF should be 7F
000002A1: FF should be C3
00000402: FF should be FB
000004A6: FF should be FA
000004A7: FF should be F7
000004AF: FF should be 1F
000004B0: FF should be 00
000004B1: FF should be 00
000004B2: FF should be 40
000004B3: FF should be C7
000004B4: FF should be FC
000004B9: FF should be 7F
000004BA: FF should be EF
000004BC: FF should be FB
000004BD: FF should be DF
000004BE: FF should be 8C
000004BF: FF should be FE
000004C1: FF should be FE
000004CA: FF should be DD
000004CE: FF should be 07
000004CF: FF should be 00
000004D0: FF should be 00
000004D1: FF should be 00
000004D2: FF should be B0
000004D5: FF should be 9F
000004D7: FF should be 7F
000004D8: FF should be FC
00000504: FF should be EF
00000512: FF should be 3F
00000513: FF should be F8
00000537: FF should be FB
0000055A: FF should be EF
0000055B: FF should be 03
0000055C: FF should be E2
0000055D: FF should be 3C
0000055E: FF should be DF
0000055F: FF should be 97
00000561: FF should be 39
00000562: FF should be FE
00000563: FF should be C3
00000567: FF should be BF
00000568: FF should be FE
0000056E: FF should be FB
0000056F: FF should be 9F
00000570: FF should be 96
00000571: FF should be F8
00000573: FF should be 7F
00000574: FF should be F0
00000578: FF should be BE
0000057B: FF should be FD
00000580: FF should be 07
00000581: FF should be FE
00000582: FF should be 6F
00000583: FF should be FB
00000585: FF should be EF
00000587: FF should be F1
00000588: FF should be BE
00000589: FF should be D8
0000058A: FF should be FE
00000594: FF should be 87
00000595: FF should be EF
000005B6: FF should be 7F
000005BF: FF should be FD
000005CA: FF should be 8F
000005D2: FF should be 1F
000005D3: FF should be FE
000005D4: FF should be 7F
000005D5: C3 should be C0
00003B13: 0F should be 2F
Repair? yes
Checking bitmap cluster 3
Read      offset = 0x000001f20000  length = 0x020000
Checking bitmap cluster 4
Read      offset = 0x000001f40000  length = 0x020000
Checking bitmap cluster 5
Read      offset = 0x000001f60000  length = 0x020000
Checking bitmap cluster 6
Read      offset = 0x000001f80000  length = 0x020000
Checking bitmap cluster 7
Read      offset = 0x000001fa0000  length = 0x020000
Checking bitmap cluster 8
Read      offset = 0x000001fc0000  length = 0x020000
Checking bitmap cluster 9
Read      offset = 0x000001fe0000  length = 0x020000
192 clusters were marked used, but not referenced
0 clusters were marked used and CLUST_BAD
1 clusters were marked free, but referenced
** Rechecking main boot region.
** Rechecking alternate boot region.
Write     offset = 0x000001f00000  length = 0x020000
fsck_exfat: Couldn't write 131072 bytes at offset 32505856, errno 9: Bad file descriptor

There is an error at the end, but it seems OK. I can mount the SSD now, and everything comes back.

@bonatoc
Copy link

bonatoc commented Dec 13, 2021

After the disk becomes accessible again, I would advise to backup your data and reformat the hard drive using "Mac OS journaled" as the format.

While Mac OS X states exFAT partitions are compatible, it's probable we come across these problems in part because of that.

Making your hard drive fully compatible with OS X's file system can prevent future problems to arise.

@akashrajpal
Copy link

akashrajpal commented Dec 13, 2021

@krsnk
Copy link

krsnk commented Dec 15, 2021

@bonatoc
Thank you, but I've already gone mad, gave up and bought a macbook.

@sleaze
Copy link

sleaze commented Dec 29, 2021

Thank you this was helpful.

@JingboXia
Copy link

JingboXia commented Jan 25, 2022

It works. Thanks.

@soonergrrrl
Copy link

soonergrrrl commented Jan 26, 2022

Did anyone ever solve this:

sudo fsck_exfat -d disk4s1
Opening /dev/rdisk4s1
fsck_exfat: Opened /dev/rdisk4s1 read-only
** Checking volume.
** Checking main boot region.
fsck_exfat: Invalid jump or signature
Main boot region is invalid. Trying alternate boot region.
** Checking alternate boot region.
fsck_exfat: Invalid jump or signature
Alternate boot region is invalid.
** The volume could not be verified completely.

It does not appear to be something busy, but I don't know enough about Terminal/DOS to be able to read this and see what is wrong. Disk Utility tells me that there is an orphaned cluster that can't be fixed when I try to run First Aid. So, I tried this route, but it isn't working either...

@cocotyty
Copy link

cocotyty commented Feb 1, 2022

sudo gdisk /dev/disk2
just w
Everything become ok!

@mitchelldmiller
Copy link

mitchelldmiller commented Feb 23, 2022

Open Disk Utility and you should be able to repair here successfully.

I forgot that Volume was open in Disk Utility - stuck on "resource busy" - while I found / applied this fix.
Unmountable USB disk was automagically mounted by disk utility, after fsck_exfat - Thank you!

@harrisondesbrosses
Copy link

harrisondesbrosses commented Feb 24, 2022

Thank you, there seems to be a larger issue with ex_FAT volumes and M1 macs + Monterrey...

@stars-island
Copy link

stars-island commented Mar 11, 2022

Thank you for summarizing and sharing your idea about this!

Just wondering if it is safe to do this with my drive which has already stored piles of data. I just searched online but found nothing saying about that.

(I would say I am lazy but I have little spared storage for my large drive to backup data...)

@kurianoff
Copy link

kurianoff commented Mar 13, 2022

I gotta pay you for this advice, cause I thought I lost my disk drive forever. THANKS A LOT!!!

@sandeepr79
Copy link

sandeepr79 commented Mar 24, 2022

Awesome advice, I tried so many things in last couple of weeks without luck. Thanks a lot.

@edubskiy
Copy link

edubskiy commented Mar 24, 2022

@krsnk — Did you try from the Terminal:

diskutil list

The volumes listed should show your disk ("rdisk2s1") and possibly its partitions.

Then, copy paste this (replace "disk2") in the example below with your disk's or partition's name (of course, remove "(but your disk)").

sudo ps -ax | grep disk2 (but your disk)

you should get the process number keeping your disk busy:

13699 ?? 11:52.83 /System/Library/Filesystems/hfs.fs/Contents/Resources/./fsck_hfs -y /dev/disk2s2

Then execute:

sudo kill 13699

In the example above, "13699" refers to the process currently busy, but it should be a different number on your machine.

After killing the process, the drive should mount, with a Finder's warning.

Thanks, man. You saved my day!

@jazzsequence
Copy link

jazzsequence commented Apr 4, 2022

Props for this. This is exactly what I needed to get my external drive working again. 👍

@onlyabhi52
Copy link

onlyabhi52 commented Jun 6, 2022

any one has faced this issue while launching the terminal - /dev/fd/14:type:296: bad option: -t

@gg4u
Copy link

gg4u commented Jun 28, 2022

Has anyone ever run into this , and can offer a solution?

It could be a bug of Apple..

sudo fsck_exfat -d disk1s2
....
Read      offset = 0x00001e2ba000  length = 0x001000
--- [1] Evicted 1 buffers (4096 bytes; 1 pages)
Read      offset = 0x00001e2bb000  length = 0x001000
Assertion failed: (result->data == NULL), function fsck_exfat_cache_recycle, file /SourceCache/exfat/exfat-66/fsck/fsck_exfat_cache.c, line 248.

laptop powered off while copying files to external drive.
Disk utilies from the GUI mac can't repair the disk.
Disk is now read only.

Please advise.

@Czechmix
Copy link

Czechmix commented Jul 16, 2022

I was able to run the sudo, but it didn't ask me for anything else after it was done. The drive now shows up in Disk Utility and I am currently doing the repair on a 4TB WD Red. It's been going for the past 4 hours stating "Checking system hierarchy". Hoping in the distant future this will resolve it not mounting to the desktop.

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