Auto Mount USB

Brian Miller bmiller at lablaw.org
Mon Aug 18 20:20:55 UTC 2008


Thanks for the feedback

Keep in mind the original post I indicated that I was running a version
installed by the pfsense firewall installation ISO(www.pfsense.org) 

Looks like it is drastically trimmed down version of BSD 6.2 many
commands are missing. Man, amd, camcontrol, etc. Also the I can't get
the pkg_add to install packages. I think because pfSense is using it for
it's own package store. 

Yes you are correct; I was just pulling out the drive with out
dismounting. 

Not a big deal. I will be sure to just mount and dismount the USB drives
manually. They are just there to store a config and log backup on the
firewall. I am doing this so that if I have a failure or attack or some
other type of crash. I will be able to check out the latest config and
logs. A cron job is scheduled to copy these files to the USB drive every
so often.




-----Original Message-----
From: Roland Smith [mailto:rsmith at xs4all.nl] 
Sent: Monday, August 18, 2008 4:11 PM
To: Brian Miller
Cc: freebsd-questions at freebsd.org
Subject: Re: Auto Mount USB

On Mon, Aug 18, 2008 at 12:06:38PM -0400, Brian Miller wrote:
> All,
> 
> Not sure how to word all of this. I am trying to auto mount my USB
tumb
> drive in FreeBSD (The version that comes with PFSense) I believe most
of
> my troubles are related to lack of knowledge.
> 
> I can mount the drive just fine with the mount command. I also was
able
> to add it to the fstab and have it mount at boot.
> 
> However if the drive is removed it has to be mounted again. How do you
> get it to mount back up with out having to run the mount command
again?

You'd have to use an automounter, like amd(8) that comes with FreeBSD.  
 
> Also I noticed while playing with it that the device assignment keeps
> changing each time it is plugged back into the system. Started with
> /dev/da0s1, then da1s1, then da2s1, da3s1 and so on. Which means I
have
> to change my mount comand every time.

This should not happen. The devfs filesystem that FreeBSD uses removes
device nodes if the devices are removed (unless the devices are still in
use). 

Are you unmounting the filesystem on the thumbdrive before removing the
drive from the USB port? If not this could be the cause of the
problem. Note that removing a mounted drive can crash your system!
_Always_ unmount a filesystem _before_ removing the device it is on.

[As an aside, FreeBSD's disk device drivers and filesystems predate
"hot"
removeable devices by a considerable margin; they were written with the
(implicit) assumption that disk devices are not removed while the system
is running. Although work has been done in DragonflyBSD (a derivative of
FreeBSD 4) to fix this, those changes haven't made it into FreeBSD
6/7.x.]

If you have device nodes for devices that aren't there anymore, you can
try running 'camcontrol rescan all' as root.

If the filesystem on the thumbdrive has a label FOO, you should see that
label as a device node in /dev/msdosfs/FOO (for FAT* filesystems) or
/dev/ufs/FOO (for UFS formatted drives). Unlike the da devices this
doesn't depend on the sequence in which devices are plugged in. Labels
can be made with tunefs(8) (for UFS filesystems) or newfs_msdos(8) for
msdos filesystems.

Roland
-- 
R.F.Smith
http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much
appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID:
C321A725)


More information about the freebsd-questions mailing list