Can I mount an ISO image directly with mount?

Wayne Sierke ws+freebsd-questions at au.dyndns.ws
Mon May 30 11:54:21 PDT 2005


On Mon, 2005-05-30 at 11:01 -0400, Steven Friedrich wrote:
> I believe I read a posting over a year ago, that stated that you could mount 
> an ISO file directly with mount.
> 
> I searched the archives but couldn't find it.
> I searched the FAQ and handbook as well.
> 
> I do see a section in the handbook about doing it with vn, but I want to know 
> if it's possible with mount alone.

This works for me on 5.4...

mount_cd9660 -o ro /dev/`mdconfig -a -t vnode -f /path/to/file.iso` /mount-point


and hopefully won't have dramatic consequences if the mdconfig fails!

I don't have any 4.x systems so you'd have to compare the options for
vnconfig(?) if that's what you have.

I don't have the script-fu to suggest how you might set about undoing it
all in one line, since you'd have to do an unmount before you could
perform the required mdconfig -d, and hence lose the chance to do
something like:

mdconfig -d -u`mount | grep "/mount-point" | cut ... `


so you'd probably have to script it. Although ...

set mdvar=`mount | grep "/mount-point" | cut -c 8-8` && umount /mount-point && mdconfig -d -u $mdvar && unset mdvar


seems to work (but comes with a multitude of disclaimers about fitness
for purpose and possible health risks!). Hopefully you're not looking
for command-line shortcuts.


Wayne




More information about the freebsd-questions mailing list