Question: I had an HFS+ formatted drive that was going bad and wouldn’t mount at all on OSX. I created an image using ddrescue on linux, and was able to save most of it.
I can mount the drive and see the data just fine in linux using this:
mount -o loop -t hfsplus dd_image mountpoint
This doesn’t work on my OSX system since hfsplus isn’t a valid filesystem type. If I try:
mount -t hfs image mountpoint
It complains that it needs a block device. What’s the fix here?
Answer: Hmm. ?According to one source, you need hdiutil (OSX hdiutil manpage), as in
hdiutil attach -readonly cdimage.iso
What you’re trying to do is known as “loopback mounting”, that is, mounting via the loop device. ?According to Wikipedia’s article:
?
Mac OS X ?implements a native image mounting mechanism as part of its random access disk device abstraction. The devices appear in /dev as regular disk devices; reads from and writes to those devices are sent to a user-mode helper process, which reads the data from the file or writes it to the file. In the user interface it is automatically activated by opening the disk image. It can handle disk, CD-ROM or DVD images in various formats.
This suggests to me that your OSX system needs to recognize your image as a valid HFS image. ?Depending on how you created it (did you dd a partition or a whole drive?) you may be able to double-click on the image file, or you may need to give the file the right file extension (.iso or .img, perhaps). ?On Linux you could use the losetup command to associate the image file with a device like /dev/loop0 (mount -o loop does this for you, but OS X’s mount manpage doesn’t indicate any similar option).