Automating mounting of ISO images

four.harrisons at four.harrisons at
Thu Mar 24 16:28:05 UTC 2011

Hash: SHA1

On 3/23/11 2:49 PM, Ryan Coleman wrote:
> I have a folder full of ISOs that we're sharing on the network instead of having the discs available (seems like a good idea, right?)
> But I want to automate the process on boot instead of having to write a static script  to do the work.
> Disc images are located in /mount/disc_images/ (all are ISOs)
> They need to mount into /mount/office_files/images/FILENAME [without the .iso extension]
> How can I do this? I've always been given these types of scripts in the past at an old job but I don't have access to those examples anymore.

Hi Ryan,

You can put something like this in /etc/rc.conf to get the device files
created automatically:

mdconfig_md0="-t vnode -f /mount/disc_images/Image1.iso"
mdconfig_md1="-t vnode -f /mount/disc_images/Image2.iso"
mdconfig_md2="-t vnode -f /mount/disc_images/Image3.iso"

Because these devices (/dev/md0, /dev/md1, /dev/md2) will be created
before /etc/fstab is processed, you can then add the following entries
in that file:

/dev/md0    /mount/office_files/images/Image1    cd9660    ro    0    0
/dev/md1    /mount/office_files/images/Image2    cd9660    ro    0    0
/dev/md2    /mount/office_files/images/Image3    cd9660    ro    0    0

Check out the rc(8) man page ( for more information
about how the startup scripts work, as well as the one that processes
the device creation directives above - /etc/rc.d/mdconfig

Finally, you can always add your own custom startup scripts to
/usr/local/etc/rc.d if you need to do something that the standard
startup scripts can't handle.

Hope that helps,
- -- 
Greg Larkin           - The Power To Serve     - Ready. Set. Code. - Follow me, follow you
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla -

freebsd-questions at mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscribe at"

More information about the freebsd-questions mailing list