Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Mar 2009 15:52:43 +0100
From:      Polytropon <freebsd@edvax.de>
To:        Peter Steele <psteele@maxiscale.com>
Cc:        questions@freebsd.org
Subject:   Re: How to auto-detect a USB drive?
Message-ID:  <20090311155243.57fdcb25.freebsd@edvax.de>
In-Reply-To: <10423240.561236782522127.JavaMail.HALO$@halo>
References:  <7280394.541236782303889.JavaMail.HALO$@halo> <10423240.561236782522127.JavaMail.HALO$@halo>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 11 Mar 2009 07:42:04 -0700 (PDT), Peter Steele <psteele@maxiscale.com> wrote:
> I want to have a process running on my FreeBSD box that
> automatically detects when a USB drive is inserted. What's
> the easiest way to accomplish this? I know I could simply
> monitor /var/log/messages and look for the appropriate
> events to appear, but is there a more elegant way? 

The system will monitor it itself. :-)

My question to you would be: What exactly do you mean by
"automatically detect"? The drive *is* automatically detected.
Should it be mounted afterwards?

The creation of the device files (after system startup) is
controlled by the file /etc/devfs.rules.

You can use automounters to automatically mount devices when
they appear. In order how to determine file systems, slices
and partitions on such an USB device, you could, for example,
have a look at how FreeSBIE does it.

Additionally, there are already tools integrated in KDE and
Gnome that automount USB devices.


-- 
Polytropon
>From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...



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