Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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!

share|improve this question
    
A related blog post I saw recently: rwmj.wordpress.com/2009/10/25/… –  CesarB Oct 27 '09 at 16:19
add comment

5 Answers

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.

share|improve this answer
add comment

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 ]

share|improve this answer
    
Sorry, just noticed the link I posted is same as original poster... so only missing step was to decompress the DMG. –  Tricky Jan 9 '13 at 14:17
add comment

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

mount -t hfsplus image.dmg /mnt/cdrom
share|improve this answer
add comment

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?

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.