Automating mounting of ISO images
glarkin at FreeBSD.org
Wed Mar 23 19:48:23 UTC 2011
-----BEGIN PGP SIGNED MESSAGE-----
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.
You can put something like this in /etc/rc.conf to get the device files
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 (http://bit.ly/fuwn5n) 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,
http://www.FreeBSD.org/ - The Power To Serve
http://www.sourcehosting.net/ - Ready. Set. Code.
http://twitter.com/sourcehosting/ - Follow me, follow you
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the freebsd-questions