21

If you disconnect a removable drive without ejecting it first, the next time you connect it, Windows or Mac run an fsck check on the disk to ensure data integrity. Windows will ask if you want to check for errors, OS X does it invisibly.

USB3 disks often disconnect inexplicably in OS X. If the disk hasn't been used for hours I know there is no issue. On Windows, I can simply decline to run the check. On OS X I just have to sit waiting for 30 minutes while the fsck thrashes my disk. This happens daily, so OS X will rapidly kill my hard drive. (This paragraph has been edited since the answers were posted.)

How can I disable this check? Can I connect via a non-native driver? Can I run something to flip the flag on the disk that tells OS X the disk was improperly disconnected? Can I change disk format? Can I disable whatever it is that sets the flag 'improperly disconnected' when I connect the drive, that is then unset on proper ejection? I'm desperate, as the Mac has a tiny hard disk and now I can't use externals. Any direction, no matter how hacky or improper, gratefully received! I have tried accessing the drive through Windows in VirtualBox or Parallels, but they can't see the drive until OS X has stopped fsck.

I believe File System State is the state/setting I need to ignore/override.

The disk is exFat with Master Boot Record, and OS X is 10.11.3. Update: this has now happened on the other USB socket with a flash disk (I'd only seen this on an HDDs that report themselves as non-removable before).

There isn't an Apple repair centre in the country I live in, the disk isn't used for frequently accessed files, I would do a check if there was a chance of corruption (ie, a disconnection during or shortly after a write to the disk), and I've always declined the check in Windows (for decades) because the only time I've had a corruption is from the check itself.

Chris
  • 469
  • 4
    I force-kill fsck_exfat from Activity Monitor. I've filed an issue with Apple that they don't provide any visual indication that this process is running. I suggested to them that they display the disk greyed out with a progress-circle overlay. – P i Oct 10 '19 at 11:30
  • much love, you've saved me thousands of dollars. It took me months to realize this was a fsck_exfat issue - after. two years I can open my HD again – Jonca33 Feb 07 '21 at 02:37

1 Answers1

20

Open Terminal and enter:

#Get the disk identifier of the ExFAT partition
diskutil list
#Get the UUID of the ExFAT volume with diskXsY being its disk identifier
diskutil info /dev/diskXsY
#Create and edit /etc/fstab 
sudo vifs

Add a line with the following content after activating insert mode (e.g with I)

#Replace the UUID below by the one found earlier!
UUID=2FECDB7A-15F0-36F9-9A47-483B9669D6DC none exfat rw,auto 0 0

Hit esc to leave insert mode. Enter :w! to write the file to disk and :q to quit vifs.

Reboot your Mac.

The last 0 should disable fsck.


An alternative method may be: rename /sbin/fsck_exfat to /sbin/fsck_exfat.paralyzed with:

sudo mv /sbin/fsck_exfat /sbin/fsck_exfat.paralyzed

Since /sbin/fsck_exfat is a link only you may also have to rename the original file: /System/Library/Filesystems/exfat.fs/Contents/Resources/fsck_exfat.


Both methods are not recommended! Instead the USB socket should be repaired.

klanomath
  • 66,391
  • 9
  • 130
  • 201
  • HUGE thanks @klanomath, I'll test each change and report back (and accept your answer). I spent hours and hours yesterday looking for these details - really grateful thanks. I'll manually fsck_exfat until I'm in a country long enough with an Apple service centre. – Chris Mar 12 '16 at 12:45
  • @Chris I can't test neither of both methods properly. So they are a bit speculative. The first one is mentioned in man fstab though. – klanomath Mar 12 '16 at 13:02
  • The UUID is not returned by diskutil info, and is not easy according to this answer (and many others). However fstab already had a line in it using LABEL=DISKLABEL. A drive I was testing with took no less time to reappear after disconnection, but it only took 3 seconds (for a 64GB flash) before I added the line so perhaps flash fscks quicker. I've added the line for my external HDD and will report back next time it disappears. Even with sudo the alternative method reports "Operation not permitted". – Chris Mar 15 '16 at 16:52
  • @Chris Using LABEL= instead of UUID= is a possible and allowed option. Renaming /sbin/fsck_exfat is also possible in El Capitan (you didn't specify your system in your question) after disabling SIP. – klanomath Mar 15 '16 at 16:57
  • My diagnosis was wrong - a different disk on the other USB socket with different cables also disconnected randomly, only this time there was nothing anywhere near laptop or cables so I doubt it is physical. It is always USB3, the HDD may be in a low power state, other USB3 devices fine, so I'm now suspecting something interfering with the USB3 external storage drivers, possibly another device making illegal operations on the bus (my Native Instruments Audio 8). (Prob unrelated, but USB3 external HDDs never connect via a USB3 hub but USB3 flash drives do, ext'nal HDDs on USB2 hub intermittent.) – Chris Mar 15 '16 at 16:59
  • Thanks been trying to avoid it but I'll disable SIP. Sorry I'm on OS X 10.11.3 – Chris Mar 15 '16 at 17:00
  • 1
    @Chris After renaming the file(s) you can re-enable SIP! After updating OS X the files may be replaced by newer versions though! – klanomath Mar 15 '16 at 17:14
  • Also added noasync to the string rw,auto to hopefully prevent write caching. – Chris Mar 15 '16 at 20:05
  • I implemented both of these solutions, and the disk improperly disconnected. When I reconnected the drive, it whirred away for 20+ minutes then appeared in Finder, exactly as before. So I'm massively grateful for the detailed solutions, but unfortunately it seems they are not working - fsck is run, and still found if renamed. I could remove execute rights on the file, but the drive didn't appear in Finder until fsck had completed (oops didn't think to check running processes). – Chris Mar 29 '16 at 13:17
  • I've since come across other people who complain that drives sometimes disconnect themselves in OS X if left connected for hours. I now connect my external HDD as little as possible, only long enough to move any files I need to a flash. I guess every OS has its irritations. – Chris Mar 29 '16 at 13:23
  • I've since noticed on several occasions that flash disks suddenly disconnect for absolutely no reason and I get the OS X whine "disconnect first..". I also have an SSD disk that won't connect unless I boot with it connected. My take-away is that OS X external drive connection is buggy and horrible, both connecting and staying connected. This is a real concern as I rely on external disks for performing shows, & if a disk disappears or doesn't work I'm in big trouble. Any tips on strengthening this very welcome indeed (aside from just bringing several identical drives-a sync and port nightmare) – Chris Apr 09 '16 at 14:28
  • 1
    @Chris I have a lot of external disks (FW/USB2/USB3) and I never encountered any problem with OS X. I use GUID/OSX Journaled consistently though. It really depends on the external disk's firmware and the controller chip (USB->SATA) and the quality of the cable. – klanomath Apr 09 '16 at 14:39
  • @ klanomath you have the patience of a saint! That is a very good point - all of my external disks are exfat. I'm now formatting a flash that disconnected and will report back after a day plugged in. Thanks enormously for tolerating my ignorant frustrations. – Chris Apr 09 '16 at 21:22
  • 1
    @ klanomath I think journaled is the answer! I no longer get the "disconnect first" error, I can disconnect and reconnect frequently and OS X is fine even if I don't eject, I can connect via USB2, 3, via 2 hubs no problem. I wouldn't even notice a brief disconnect. I work with Windows and Ubuntu users so I'll have to carry a drive with Paragon HFS+ for colleagues etc. Just installed a Parallels Access trial to try NTFS, but I suspect it's not near-kernel/native. ENORMOUS thanks @klanomath I really can't thank you enough for dragging me through this, this is an absolutely emormous relief. – Chris Apr 09 '16 at 22:42
  • Did exactly this (first method), not working. When I connect the drive it still does the same thing (runs fsck_exfat that never ends) – Can Poyrazoğlu Aug 20 '18 at 12:19
  • 2
    @CanPoyrazoğlu unfortunately I never found a way to disable the check, or the intermittent disconnections. Even bought a brand new Mac and it still disconnects disks randomly then churns away when I reconnect. Only 'solution' was to use only journalled disks so at least there isn't a massive delay while the disk checks itself. But stuff which is sensitive to even microsecond disconnection, like Docker on external disks, just doesn't work on macOS. It's shocking really that such a fundamental thing is left broken. – Chris Nov 05 '18 at 13:40
  • 4
    @Chris while I understand Apple wants everything to be 'under control' and stable, I wish they at least provided a way, even if disabled by default, to skip check for the power users. – Can Poyrazoğlu Nov 05 '18 at 17:04
  • 1
    This does not state clearly whether to add the volume UUID or the partition UUID to /etc/fstab. – Kallaste Aug 03 '21 at 04:15