All right, guys. I ran into this problem early today and it looks like I manage to get my MacBook Air up and running. As I am on vacation there are no any Apple Geniuses areound for 1 thsnd miles min 😉 And I wanted my laptop back badly ) So I had to do something..
Problem diagnosis
1. Rebooted my MacBook Air (El Capitan, latest), an Apple logo and progress bar appears.. progress bar moved almost to the end and black screen and see my mac as it was switched off. Repeated 3 times - same result. Computer shuts down before showing users welcome screen.
2. Cmd + I and see what logs are saying. I am sorry, I did not realized I will be writing this - I did not take screenshot. Anyway - on the disk mounting process /sbin/fsck started, diagnosed some errors, failed to repair (split second) and shot system down.
3. Cmd + S and have a single user mode. Thanks G.. it did not reboot. Also it did not mount fs. It proposes to run two commands
/sbin/fsck -yf
/sbin/mount /
4. I ran fsck - with an interesting result - it stuck with "CreateNewBTree returned -34" and then "disk full"
5. Checked with "df" command - I had 8GB free space of 512GB. Small. Let's kill rm -rf /Users/<my user>/Downloads. Now i have 24GB - no way.
6. fsck - no luck, still the same result. Then I realized it tries to rebuild BTree - it does not cares about size of the files. It cares about number of nodes (# of dirs and files!). And recently I played with git and created thousands of files in my development dir.
SO, diagnosis:
1) IT LOOKS LIKE FS NODES INDEX GOT CURRUPTED SOMEHOW
2) TOO MANY FILES (NODES) IN FS MADE IT IMPOSSIBLE FOR FSCK (AND GUI REPAIR TOOL) TO COPE WITH IT
Solutions research
#1: turn of fsck check on boot and then clean up the drive
#2: clean up nodes
I choosed to try #1 and failed. Did a lot of research on how to turn off fsck in /etc/fstab etc.. You should get device UID and make a custom line in /etc/fstab file with 0 0 at the end to prevent fsck to check this device. Too risky, not clear how it will work on El Capitan.
Then I went to #2..
Solution
1. Cmd + S
2. rm -rf /Users/<my user>/Sites (here a LOT of files was created by git)
..after 1-2 min of deletion..
3. /sbin/fsck -yprd /dev/disk0
..now it fixes things..
4. shutdown -r now
5. Let it boot up (will take a LOOONG time). Then for mee it booted up in Safe mode.
6. Reboot once again - ok, we have system up and running.
Few comments to Apple guys -
1) how f. did you come up with error -34 for this situation??? Can you make this whole fsck_hfs messaging more clear and helpful? Like "Okay, you have too many nodes and FS got corrupted. Pleas rm -rf ..X..files.. and press Y to repair."
2) there is need an easy way to turn off fsck on bootup manualy without risking to crush the system (fstab and /sbin/vifs are ridiculus stupid rudiments in 21st century)
3) repair tool (GUI) should be more clever than fsck. Now it is not (I suppose it is just dumb GUI for fsck_hfs).
As you can imagine, all these steps are made with back and forth try-and-error approach. Frankly I am really upset I've lost 4 hours wrestling back and forward to get my Mac back working. There is no really deep advise on this topic in Google, and a lot of people struggling with this symptoms. That's why I wrote this post (another +0,5 hour lost).
Hopefully, this will save a few hours of yours. Russian engineering force is awaken 🙂 All best wishes! Peace! Andrey