Can’t boot, fsck -ya in single user says ‘Disk full’

bootfsck

My Macbook Pro suddenly turned itself off (I believe I got a popup saying it was soon out of diskspace, but I didn't think this meant "Your OSX installation will soon be unusable"). After this, I haven't been able to boot into OSX.

Booting into single user mode and running fsck -fy bails out with the message that the "Disk full error":

** Rebuilding extended attributes B-tree.
CreateNewBTree returned -34
   Disk full error

Checking the Mac disks from Linux (I've got a dual boot), I can confirm that non of the Mac related partitions are out of diskspace:

  • the EFI partition has 180MB free (9% used)
  • the Mac Boot partition has 113MB free (82% used)
  • the main Mac harddrive has 17GB free (83% used)

Any help is much appreciated.

Best Answer

I had this same problem. After a few hours I did manage to solve it by sort of hacking the boot process. The problem is OSX detects some error upon boot and calls up fdsk to solve it. Then fsck returns error code 34 and the boot script halts the system. I tried and failed to disable the fsck call. But... I did succeed at cheating at the boot script and have fsck return a 0 exit code, which worked.. This is what I did:

Disable System Integrity Protection in Mac OS X. Instructions here.

Log in to Single-User mode (instructions here) and mount the file system as readwrite.

You need to replace /sbin/fsck with a script that returns exit 0. To do so try the following commands:

mv /sbin/fsck /sbin/fsck.backup
echo '#!/bin/bash' > /sbin/fsck
echo 'exit 0' >> /sbin/fsck
chmod +x /sbin/fsck

You might get some error messages about SIP being disabled but it did work for me. You then reboot.

Upon reboot, OS X will detect the 'problem' and call our fsck script, which will return a 0 exit code and you'll log in your system.

If you succeed I suggest you back up all your important data and reinstall OSX. If you don't, remember you don't have a proper /sbin/fsck anymore so any program relying on it (maybe Disk Utility?) might have an unexpected behavior.

Good luck.