Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can block files be mounted on osx? I tried

hdiutil attach filename

however this is terminating with

hdiutil: attach failed - not recognized

hdiutil only seems to work for iso/dmg images. On ubuntu the block file can easily be mounted with

mount -o loop filename mountpoint

Background: I used vdfuse ( to mount virtual disk files (e.g. vhd). vdfuse itself works fine and the partitions contained in the virtual disc appear as block files on the mount point.

VHD File -> /my/mountpoint/Partition1, Partition2, ...

On ubuntu the block files can be mounted via

mount -o loop /my/mountpoint/Partition1

however the -o loop option does not exist on osx.

share|improve this question
up vote 23 down vote accepted

hdiutil was the right way to go but a crucial ingredient are the parameters.

The command

hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount filename

perfectly mounts the block file as a block file system. Afterwards you can mount any fs like Chris S pointed out.

share|improve this answer
Just in case anyone gets stuck here... this command will give you something like /dev/disk1. You can run hdiutil mount /dev/disk1 to actually see the files inside. It will print out the location of the mount point, something like /Volumes/Untitled – Sam Jan 30 '12 at 19:55

Doesn't the partition have a filesystem? Usually you mount it with something like mount -t ntfs /my/mountpoint/Partition1 /mnt

share|improve this answer
thanks, this would be usually the way to go. however this would require /my/mountpoint/Partition1 to be a block device... It the same reason you cannot mount an iso by mount /path/to/iso /path/to/mountpoint – janm Aug 26 '10 at 18:26
Why not just make a memory-disk device that's file backed? Off the top of my head I think it's hdid /my/file and it will return a block device name. – Chris S Aug 26 '10 at 20:18

Your Answer


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.