16

I had an HFS+ formatted drive that was going bad and wouldn't mount at all on OS X. 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 OS X 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?

3
  • There isn't one. Disappointed me many times.
    – squircle
    Jun 7, 2010 at 23:06
  • You've gotta be kidding me... no way to mount a DD image on OSX at all? It's friggin' BSD... Jun 7, 2010 at 23:22
  • OSX file systems are HFS+ which is unique to Apple (They had to support old MacOS and so changed from the BSD system they had in NeXT). Note that this is all Unix complient
    – mmmmmm
    Jun 8, 2010 at 10:31

5 Answers 5

10

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).

4
  • 1
    I dd'd the whole drive. It's not a valid HFS+ image, as it includes a whole bunch of HFS+ partition tables, not just an image of the partition in question. Changing the file extension definitely doesn't do any good. It's also not formatted as an ISO image (headers and so on), nor is it a native mac img format (same problem). The disk utility will not mount the image at all. Jun 8, 2010 at 0:07
  • 1
    @paul: did you try the hdiutil command, or read the manpage? iso and img images don't have headers and so on; they're straight-up dd copies of partitions (so no partition tables as you'd get with dd'ing a whole drive). ISOs are called ISOs because they're often images of ISO-9660 filesystems used in data CDs. you should be able to use hdiutil. try running hdiutil imageinfo image-file-name to see if hdiutil recognizes your image as-is... hdiutil pmap image-file-name may also be useful to see if it recognizes a partition table in your image. Jun 8, 2010 at 1:43
  • 5
    @paul: the manpage gives this example for "forcing a known image to attach": hdiutil attach -imagekey diskimage-class=CRawDiskImage image-file-name Jun 8, 2010 at 1:46
  • @quackquixote : When I execute your command with image-class CRawDiskImage, i get this error: hdiutil: attach failed - no mountable file systems, i used the dd command ddrescue -v -f -n /dev/disk3s2 /Volumes/mytemp/movies.dmg ~/logfile.log . How do I proceed from here? Please help!
    – bzero
    Feb 2, 2023 at 19:47
15

I confirm quack quixote's latest comment: the diskimage-class=CRawDiskImage setting allows an image created by dd to be mounted:

hdiutil attach -imagekey diskimage-class=CRawDiskImage image-file-name

P.S. I copied it here to give it more visibility.

1
  • This didn't work in my case, i get the following error: hdiutil: attach failed - no mountable file systems, but hdiutil sees the raw image and pmap returned type unknown partition and Name = whole disk, how to proceed from here?
    – bzero
    Feb 2, 2023 at 19:48
3

I know it is an old thread but this answer would of helped me an hour ago.

Both .DD and .DMG files are RAW image files. You can simply rename the image.dd file to image.dmg. If you have a series of files make sure you name them correctly. ie image.dmg, image.o1dmgpart etc.

2

If you want to ensure the image isn't modified (i.e. if mounting for a forensic examination) be sure the use the -readonly option in your "hdiutil attach".

2

Try using the .dmg file extension, as in dd if=/dev/disk1 of=MacintoshHD.dmg or similar.

This lets you double-click and mount the image in the Finder.

You must log in to answer this question.

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