4

I am trying to mount a HFS+ partition in hybrid .dmg file to a local folder.

I found a HFS+ superblock in it (as per instructions in here) and tried to associate it with /dev/loop0 and then mount:

losetup -o MY_HFS_SUPERBLOC_OFFSET /dev/loop0 image.dmg
mount -t hfsplus /dev/loop0 /mnt/cdrom/

However when I ran last command from list above, I get this message:

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

dmesg | tail:

[12130.800828] hfs: failed to load catalog file

I am positive that I'm specifying correct MY_HFS_SUPERBLOC_OFFSET, I followed this Technical Note from Apple on structure of HFS+ partitions and found a matching copy of Volume Header in the end of .dmg file.

How would I mount this image?

All suggestions appreciated!

David C.
  • 103
  • 4
Art
  • 297
  • 4
  • 12
  • A related blog post I saw recently: http://rwmj.wordpress.com/2009/10/25/unpack-a-mac-dmg-installer-using-guestfish/ – CesarB Oct 27 '09 at 16:19

5 Answers5

2

Not convinced this is going to help all that much, but based on the source of the driver for HFS, it looks like it's struggling to find the b-tree detailed in that technical note. Unfortunately I don't have such a file to even experiment with.

372 HFSPLUS_SB(sb).cat_tree = hfs_btree_open(sb, HFSPLUS_CAT_CNID);

373 if (!HFSPLUS_SB(sb).cat_tree) {

374 printk(KERN_ERR "hfs: failed to load catalog file\n");

375 goto cleanup;

376 }

Unfortunately every link I've dug up based on that is talking about using Linux live disks to fsck broken HFS partitions rather than mounting a dmg image.

Twirrim
  • 673
  • 4
  • 8
1

I had a similar issue even after decompressing the DMG to a normal disk image. Turned out the issue was because my DMG was a Hybrid (FAT+HFS) image and wasnt correctly recognised by the HFS driver.

Check out the following link for a way to do it [ http://www.64lines.com/mounting-hfs-plus ]

Tricky
  • 376
  • 2
  • 5
  • Sorry, just noticed the link I posted is same as original poster... so only missing step was to decompress the DMG. – Tricky Jan 09 '13 at 14:17
1

Dumb answer, but what happens if you just try and do:

mount -t hfsplus image.dmg /mnt/cdrom
LapTop006
  • 6,466
  • 19
  • 26
0

Some googling turns up Acetone ISO as an open source tool that can deal with DMG-formatted ISO images. I don't know if it will grok the HFS+ metadata, but if all you need is file contents, maybe it will do the job?

Walter Mundt
  • 354
  • 1
  • 4
0

DMG file format by Mac OS/Apple is a compressed file format. It seems you have found accidentally correct signature sequence in a compressed file and gone 1024 bytes backwards to partition start offset accoding to the article you referenced.

You can uncompress the file dmg with p7zip under windows and linux (I haven't tried under linux) or convert it to uncompressed iso with dmg2iso or another utility.

Hope, that helps...

Best Regards...