Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2008 10:32:54 -0400
From:      Chuck Robey <chuckr@telenix.org>
To:        Mark Ovens <parish@magichamster.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Stick memory USB
Message-ID:  <483ACA16.6060101@telenix.org>
In-Reply-To: <483A3F52.9040907@magichamster.com>
References:  <b0c910f50805251019q2d2b0148r84d86040d111b758@mail.gmail.com>	<4839ADF8.7090805@telenix.org> <483A3F52.9040907@magichamster.com>

next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Ovens wrote:
> Chuck Robey wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> nej ALL wrote:
>>> Hi,
>>>
>>> I'm new on FreeBSD not on unix.
>>>
>>> I want to mount automatically an usb-stick memory into my machine ?
>>> I get some problems.
>>>
>>> Need help.
>>
>> You're trying with your devfs stuff to create the file, but you have
>> to realize
>> it's a device representing a filesystem, not just a file.  What you
>> want to read
>> is the mount and fstab man pages, mount to find out how to mount your
>> memory
>> stick, and fstab to figure out how to get it to happen automatically. 
>> The devfs
>> stuff is all mistaken, I think, you want that when you want to change
>> permissions or make softlinks of devices, not to create them in the
>> first place,
>>  least that's how I';'ve always used it, and I know very well that the
>> correct
>> line in /etc/fstab WILL automount your memory stick.
>>
> 
> Are you sure Chuck? The devfs rules stuff is to allow non-root users to
> mount removable media isn't it? I followed the instructions at
> http://gphoto.sourceforge.net/doc/manual/permissions-usb.html - the
> FreeBSD-specific stuff is near the bottom of the page - but I have
> *exactly* the same problem as the OP with my mobile phone.
> 
> It is detected as da2 and da3 (phone and memory stick - mine's a SCSI
> system so da0 and da1 are the HDDs) but only the top-level device nodes
> (/dev/da[23]) are created.
> 
> I can try to mount /dev/da3 until I'm blue in the face and it always
> fails but as soon as I attempt to mount /dev/da3s1 it fails first time
> but succeeds the second time because the /dev/da3s1 device node gets
> created on the first (failed) mount attempt.
> 
> It doesn't matter whether I have an entry in /etc/fstab for /dev/da3s1
> or not, it stills fails, but creates the device, on the first attempt.
> 
> Maybe something has changed? The page I linked to above refers to
> FreeBSD 5 but I'm running 6.3-STABLE.
> 

Well, the correct method to use to mount any filesystem is to use fstab, that's
precisely what it was created for.  Going further than that (knowing that devfs
is not the normal way  to automate mounting of FSs) isn't something I've
experimented with lately, so I mistrust my knowledge.   What I do know is that
the system needs to know the type of filesystem created on the hardware before
it can possibly create those disk subentries, irregardless of any devfs entry.
Fstab is specifically set up to give that info to the system (via options on a
mount call) and you can also, using standard mount options, arrange not only to
inform the system of the FStype, but also to do it automatically if you ask for,
and even to do it as a non-root user (again, it's not a default behavior, but
mount can be optioned to do this).

I couldn't tell you that devfs couldn't be twisted to do what you're asking, but
I can tell you that fstab *was* created *specifically* to schedule & automate
all common mount operations.  As for devfs, I would normally expect you to use
it to change the permissions or ownership of disk files.  I couldn't tell you
what's possible, but I can tell you how it was designed.

If you think about it, all these disk items have needed to be done since the
very first Unix, but devfs is a relative newcomer to Unix.  It's a slick idea,
one that caused gigantic flamewars over how to automate things like device
permissions, when the basic idea of a device filesystem was being created in
FreeBSD.  That's the reason that on my system both devfs and devd exist, both do
the same main job, with a only a different take on the  problems.   However,
they were both created with the notion of how to control a device filesystem,
not to automate disk mounts.

I should admit before I quit this email that I didn't read the first mail
entirely to the end, so I missed correctly reading the initial poster's real
problem.  In embarrassment, I did read this to the end, that's why I'm being
clear about not really knowing devfs nearly as well as I know fstab (I've never
seen any  Unix without a fstab, so knowing hos it works is very important to
knowing how to react to many basic disk emergencies, just something you REALLY
ought to learn.

> Regards,
> 
> Mark
> 
> 
> 
> 
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIOsoWz62J6PPcoOkRAhzDAJ9Jbpx/Nrl0Ydr1JlPIR1NPpcX0lQCdFWuw
Z8WMpERVFzcVnEUq6dzegng=
=5rVD
-----END PGP SIGNATURE-----



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