How to mount a specific file system on a disk image?

JWWalker picture JWWalker · Jan 8, 2012 · Viewed 7.7k times · Source

I have a disk image file containing multiple file systems, such as HFS (Journaled) in addition to Joliet or UDF. I want to mount whatever non-HFS file system is there. First, I attach the image without mounting:

$ hdiutil attach -nomount path/to/image.iso

/dev/disk3 Apple_partition_scheme
/dev/disk3s1 Apple_partition_map
/dev/disk3s2 Apple_HFS

Then, the man page for mount seems to say that I can mount non-HFS file systems like this:

$ mount -a -t nohfs /dev/disk3s2 /tmp

But the response is

mount: exec /System/Library/Filesystems/nohfs.fs/Contents/Resources/mount_nohfs for /private/tmp: No such file or directory

which sounds like it just doesn't understand the documented "no" prefix for filesystem types that you don't want to mount. Is there any way to make this work, or must I know what specific file system I want to mount?

EDIT TO ADD: Would someone care to explain the negative votes and close votes?

Answer

Gordon Davisson picture Gordon Davisson · Jan 9, 2012

First, you don't want the -a option, as that tells it to mount everything listed in /etc/fstab; your disk image isn't listed there, so that's incorrect. Second, I'm not sure why the "no" prefix isn't working, but you should be able to do it by specifying the correct filesystem to use (cd9660 would be the one to use for a Joliet image). Third, if the hybrid format is done the way I've seen, you'll want to mount /dev/disk3, not /dev/disk3s2:

mkdir /tmp/mountpoint
mount -t cd9660 /dev/disk3 /tmp/mountpoint