There is an I/O error in the hard disk in my MacBook Pro running Mountain Lion and as I start it up, a progress bar fills up and then it shuts down on its own. I attempted to recover the files in single-user mode and try to fix it by rebuilding the catalog btree as in this answer:
fsck_hfs -Rc -d /dev/disk0s2
Unfortunately it encountered numerous errors as it approached the part with a disk error. Since then the Macintosh HD does not mount in single-user mode and I am only left with the Mac OS X Base System.
Running df -hl
on the 500GB drive gives the following:
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
root_device 1.2Gi 1.1Gi 106Mi 92% 280978 27978 91% /
of which 1.2GB represents the Mac OS X Base System.
fsck_hfs -l /dev/disk0s2
gives:
** Checking catalog file.
Missing thread record (id = 18)
File record has hard link chain flag (id = 38468309)
File has incorrect number of links (id = 38468309)
(It should be 1 instead of 2)
...
Missing thread record (id = 216712)
...
Incorrect number of thread records
(4, 202)
Incorrect number of thread records
(4, 202)
** Checking multi-linked files.
Incorrect number of file hard links
** Checking catalog hierarchy.
** The volume could not be verified completely.
And /sbin/fsck/ -fy
gives:
** The volume Mac OS X Base System appears to be OK.
I tried to manually mount the drive with
mount -t hfs /dev/disk0s2 "/Volumes/Macintosh HD"
but it didn't work:
hfs_mounts: failed to mount non-root inconsistent disk
hfs_mount: hfs_mountfs returned 22
mount_hfs: Invalid argument
How do I correctly rebuild the catalog btree and remount disk0s2 (which is the Macintosh HD)?
cd: /lost+found: No such file or directory
/Users
, the wholeMacintosh HD
was gone. Attempting to mount manually would give errors likefailed to mount non-root inconsistent disk
andhfs_mountfs returned 22
.