Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Feb 2006 01:59:21 +0000
From:      Daniel Bye <freebsd-questions@slightlystrange.org>
To:        freebsd-questions <freebsd-questions@freebsd.org>
Subject:   Re: automount external usb hard drive?
Message-ID:  <20060215015920.GB69337@catflap.slightlystrange.org>
In-Reply-To: <20060215010144.99360.qmail@web60018.mail.yahoo.com>
References:  <20060215010144.99360.qmail@web60018.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--PmA2V3Z32TCmWXqI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Feb 14, 2006 at 08:01:44PM -0500, Peter wrote:
> Hi, is it possible to have an external USB hard drive automounted once
> connected? =20

It certainly is - you need to create a hook for for your device in
/etc/usbd.conf.  To find out the required details, run usbd from the
command line:

 # /etc/rc.d/usbd stop
 # usbd -dv

Connect your device, and take a note of the values for the device-attach
event.  For example, this is what I get when connecting a Disgo Lite USB
key drive.

usbd: device-attach event at 1139967116.311696000, disgo, vendor 0x08ec:
  vndr=3D0x08ec prdct=3D0x0008 rlse=3D0x0100 clss=3D0x0000 subclss=3D0x0000=
 prtcl=3D0x0000
  device names: umass0

This is what the corresponding entry in /etc/usbd.conf looks like:

device "Disgo Lite USB Key"
       devname "umass[0-9]+"
       vendor 0x08ec
       product 0x0008
       release 0x0100
       attach "sleep 3; mount -t msdosfs /dev/`camcontrol devlist | awk
'/disgo/ {print $NF}' | sed -e 's/(\(.*\))/\1s1/'` /mnt/disgo"

Note the "attach" command must be one continuous line - you can't break
up long commands to prettify the file.  The attach command here works for=
=20
me - you might need something else, depending on your specific=20
requirements.  For example, if you regularly attach more than one
storage device, you will certainly want a smarter way of handling them!

Of course, you will need to make sure you explicitly unmount the file
system before detaching the device.

man usbd, man usbd.conf and man camcontrol for more details.

Dan

--=20
Daniel Bye

PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc
PGP Key fingerprint: 3B9D 8BBB EB03 BA83 5DB4 3B88 86FC F03A 90A1 BE8F
                                                                     _
                                              ASCII ribbon campaign ( )
                                         - against HTML, vCards and  X
                                - proprietary attachments in e-mail / \

--PmA2V3Z32TCmWXqI
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFD8or4hvzwOpChvo8RAtvTAJ0Ydn/Ua+mFA7l80x5zSLFE8CLCeACgyuQH
rH24odc3X8vxrfTU2pCDgzI=
=UHyo
-----END PGP SIGNATURE-----

--PmA2V3Z32TCmWXqI--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060215015920.GB69337>