rescue a usb backup disk

Fri, Jun 26, 2015

So I plugged the WD My Passport mega-tera-huge USB drive into the mac, ready to do a backup and nothing appeared. That sinking feeling and the faint sound of a year’s worth of backups spiralling round the u-bend.

I went into a terminal and tried some fsck_hfs options but just got:



and other gubbins such as:

Resource busyjournal_replay returned 16

The disk was being recognised by Disk Utility but it couldn’t see into the volume. So after some digging on the internet I went into single user mode:

Shutdown the mac
Press the power button and immediately hold down CMD S

In a few seconds I was presented with a nice terminal screen and after plugging in the drive, had a look in:


to see what it was called then did this bit of magic:

fsck_hfs -yprd /dev/disk2s2

-y lets it fix error automatically. -p is for preening. -r rebuilds the catalogue B-tree. -d just keeps you informed of what it’s doing.

It ran for quite a while, checking this, checking that and finally reported these errors:

invalid leaf record count
invalid free nodes
invalid B-tree header

and proceeded to fix all the errors. It was then a case of exiting single user mode and back to normal:


What essentially had happened was the B-tree header and reality were out of sync. How that happened, I’m not sure but perhaps it was bum ejection or something did something it shouldn’t have.