1

I'm trying to recover an apparently corrupted disk. It appears that through improper shutdown the drive has been somehow killed. It's the main partition of a Macbook Pro.

I've used dd to copy the drive to an external hard drive, and now I'm trying to mount it under linux (Ubuntu) to retrieve whatever I can. (I can also try from another Mac.)

Info on the disk image from file image.dmg

image.dmg: Macintosh HFS Extended version 4 data (mounted) last mounted by: 'FSK!', created: Wed Nov 18 08:21:40 2144, last modified: Mon Mar 6 18:54:12 2147, block size: 4096, number of blocks: 121886744, free blocks: 69886793

Trying mount -t hfsplus -o loop image.dmg /mnt resulted in

mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so

from dmesg

hfsplus: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. mounting read-only.
hfsplus: invalid extent max_key_len 53348
hfsplus: failed to load extents file

running fsck.hfsplus -dr image.dmg yields

** image.dmg (NO WRITE)
Using cacheBlockSize=32K cacheTotalBlock=1024 cacheSize=32768K.
CheckForClean - found bad journal signature
Invalid Volume Header
** Checking HFS Plus volume.
Invalid B-tree node size
(3, 0)
** The volume needs to be repaired.
volume type is pure HFS+
primary MDB is at block 0 0x00
alternate MDB is at block 0 0x00
primary VHB is at block 2 0x02
alternate VHB is at block 975093950 0x3a1ec0be
sector size = 512 0x200
VolumeObject flags = 0x07
total sectors for volume = 975093952 0x3a1ec0c0
total sectors for embedded volume = 0 0x00

Something is wrong with the superblock or with the B-node tree. I've seen recommendations for DiskWarrior out there, but I it has a high price for no guarantee that it will work, so I thought I'd try my hand at it with free approaches first.

Any any any (useful) info would be greatly appreciated! Thanks!

4
  • DiskWarrior is my go-to tool for disk corruption issues. If DW can't fix it it's a seriously bad day. It might seem expensive but you can't put a price on things like family photos etc. The worst corruption I've seen was caused by a power outage as a customer was saving her work. The drive was completely unbootable and there were too many errors for Disk Utility to deal with (via Firewire Target Mode). DiskWarrior repaired the catalog file in a single pass and the machine booted properly on the next restart, much to the customer's relief and with no loss of data... Mar 6, 2015 at 13:44
  • It seems like DiskWarrior may just be the best option. I'm amazed, though, that to get the download I need to use an email address that can receive a 20MB zip file. Not actually the easiest thing to provide. What software company delivers its product by email?!
    – DanielGr
    Mar 6, 2015 at 21:11
  • Alsoft used to ship regular CDs, but they seemed to hit a bit of a brick wall when Apple released the first round of Macs that couldn't boot from anything older than 10.7 (most 2012 Macs couldn't boot DW 4, anything from 2011 or older was fine). They have since had a rethink and DW 5 now ships as a bootable USB stick (capable of booting current Macs) which also gives access to the downloadable executable. Unfortunately, as you mentioned, 20MB is a large attachment and some providers will have issues with this :-/ Mar 6, 2015 at 21:22
  • It's not the size, but rather that it's a zipped attachment, which most providers reject. I know they ship as a USB stick... but that will take ages to arrive where I live. Bummer. (Thanks all for the input and help, by the way. It's much appreciated!)
    – DanielGr
    Mar 6, 2015 at 22:08

3 Answers 3

2

In the end DiskWarrior worked... it took several iterations of repair, but it managed to restore the node list enough for me to mount it and transfer off as much as was salvageable (which wasn't everything). Then I reinstalled through the usual OSX reinstallation. Thanks for the tips.

1

If you've a Firewire port and access to another Mac (also with a Firewire port) you may be able to mount your disk on the other Mac using Target Disk Mode, depending on how seriously hosed your drive is.

It may just be a case of corrupted system files preventing startup and it's entirely possible your drive will be accessible once it's mounted on another machine.

1

Try the disk repair from Disk Utility In the recovery partition, or install DVD.

I read that the Linux hfs driver has not been updated for the latest OSX, so test a known working partition first.

Assuming you did not enable drive encryption you can pull files off the img without mounting it with dd or smarter tools, alt list.

simple txt dd example;

dd if=my.img | perl -pe 's/[^\w\s]+//g' | grep -i -A 10 -B 10 'words in file' > trimMore.txt

If the drive was encrypted (new os x only) there will be no text at all in the img.

Be sure to check SMART data before using the disk again

4
  • Disk Utility under the Mac was of no use. The drive is from a three or four years old Mac (unfortunately not in front of me at the moment, so I can give concrete info about it). I don't believe the drive was encrypted. How can I check? How can I pull individual files off with dd?
    – DanielGr
    Mar 6, 2015 at 13:30
  • @DanielGr example added Mar 6, 2015 at 13:56
  • The FireWire trick mentioned by @ScunnerDarkly is not likely to work if as DanielGr said Disk Utility was inable to mount it. Mar 6, 2015 at 14:42
  • The original post says the drive couldn't be mounted in Ubuntu, not Disk Utility. I've come across many cases where DU couldn't repair the file system although the file system was still accessible as well as the majority of files. An OS X installation may not be bootable (Yosemite is a pig for not wanting to boot following a hard shutdown) but that doesn't mean the files aren't there or inaccessible. Target Mode is always worth a shot - and will in fact be necessary if the DiskWarrior app is to be used in the interim while Daniel waits for the USB version to arrive. Mar 7, 2015 at 11:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .