From owner-freebsd-questions@FreeBSD.ORG Wed Mar 23 19:48:23 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA8B21065688 for ; Wed, 23 Mar 2011 19:48:23 +0000 (UTC) (envelope-from glarkin@FreeBSD.org) Received: from mail1.sourcehosting.net (113901-app1.sourcehosting.net [72.32.213.11]) by mx1.freebsd.org (Postfix) with ESMTP id 9FB2A8FC16 for ; Wed, 23 Mar 2011 19:48:23 +0000 (UTC) Received: from 68-189-245-235.dhcp.oxfr.ma.charter.com ([68.189.245.235] helo=cube.entropy.prv) by mail1.sourcehosting.net with esmtp (Exim 4.73 (FreeBSD)) (envelope-from ) id 1Q2U2P-0009nJ-Nr; Wed, 23 Mar 2011 15:48:21 -0400 Received: from v104.entropy.prv (v104.entropy.prv [192.168.1.104]) by cube.entropy.prv (Postfix) with ESMTP id 5CA454C13C1A; Wed, 23 Mar 2011 15:48:14 -0400 (EDT) Message-ID: <4D8A4E7E.2050403@FreeBSD.org> Date: Wed, 23 Mar 2011 15:48:14 -0400 From: Greg Larkin Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9 MIME-Version: 1.0 To: Ryan Coleman References: <21012F71-5038-45F1-98C6-72A0B1239009@d3photography.com> In-Reply-To: <21012F71-5038-45F1-98C6-72A0B1239009@d3photography.com> X-Enigmail-Version: 1.1.1 OpenPGP: id=1C940290 X-SA-Exim-Connect-IP: 68.189.245.235 X-SA-Exim-Mail-From: glarkin@FreeBSD.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail1.sourcehosting.net X-Spam-Level: ** X-Spam-Status: No, score=2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_PBL, RCVD_IN_RP_RNBL, RCVD_IN_SORBS_DUL, RDNS_DYNAMIC, TVD_RCVD_IP autolearn=no version=3.3.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SA-Exim-Version: 4.2 X-SA-Exim-Scanned: Yes (on mail1.sourcehosting.net) Cc: FreeBSD Mailing List Subject: Re: Automating mounting of ISO images X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: glarkin@FreeBSD.org List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2011 19:48:23 -0000 -----BEGIN PGP SIGNED MESSAGE----- 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 (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, Greg - -- Greg Larkin 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/ iEYEARECAAYFAk2KTn4ACgkQ0sRouByUApCAiwCfZzO8jnaKIFxuOoZotU8Ac49I MMIAni1KMFDqLe1YeMaS/LZUsgrV1PfY =JUk3 -----END PGP SIGNATURE-----