The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

Things look quiet here. But I've been doing a lot of blogging at dan.langille.org because I prefer WordPress now. Not all my posts there are FreeBSD related. I am in the midst of migrating The FreeBSD Diary over to WordPress (and you can read about that here). Once the migration is completed, I'll move the FreeBSD posts into the new FreeBSD Diary website.

mounting an ISO image 2 September 2000
Need more help on this topic? Click here
This article has 5 comments
Show me similar articles
This is how to mount an ISO image. Actually, it can be used for other images as well. See the note at the end of this article for details.

If you have just created an ISO image, say with mkisofs, there is a way to mount the image and view it without creating a CD ROM.  Let's assume you have an ISO image named image.iso and it resides in the current directory.

FreeBSD 4.x

vnconfig /dev/vn0c ./image.iso
mount -t cd9660 /dev/vn0c /cdrom

When you're finished with the image, here's how you reverse the above:

umount /cdrom
vnconfig -u /dev/vn0c

Thanks to Odinn for asking about this and to blackend for coming up with it.

FreeBSD >= 5.x

As pointed out by Jim Salter in his comment and by Irritum Nihil via email, the above became deprecated in FreeBSD 5.x. Instead, you should do this:

mdconfig -a -t vnode -f /path/to/image.iso -u 1
mount -t cd9660 /dev/md1 /mnt/cdrom

To reverse the process:

mount -u /mnt/cdrom
mdconfig -d -u 1

In all cases....

NOTE: Once mounted, you cannot write to your ISO image. ISO images are readonly by design. If you want to change what is in your ISO image, use mkisofs. If you didn't create the ISO, then you could mount the image, copy everything from the image to disk, then use mkisofs to create a new ISO.

mounting any image 4 September 2000
After a question on undernet #FreeBSD, I realised that the above method can be used for any image.  As such, I've added the following note.

If you want to mount, say an msdos image, you could do it like this:

vnconfig /dev/vn0c ./image.iso
mount -t msdos /dev/vn0c /cdrom

And use the same steps as shown in the previous section to umount it.  Have a look at man mount for the various image types which you can mount.


Share
Need more help on this topic? Click here
This article has 5 comments
Show me similar articles