Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Automatically mounting USB pens
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
barry
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 170
Location: UK

PostPosted: Sun Jul 11, 2004 12:00 pm    Post subject: Automatically mounting USB pens Reply with quote

Is it possible to have USB pens automatically mounted? Supermount isn't going to work as far as I'm aware, because the device doesn't exist until you insert the pen, and is deleted when you remove it.

It's a pain having to explain that in Windows you can insert and remove the devices while in Linux you have to mount and unmount it first.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 55446
Location: 56N 3W

PostPosted: Sun Jul 11, 2004 12:48 pm    Post subject: Reply with quote

barry,

You don't have to let devfs create and delete /dev/sda1. Take the pen drive out of devfsd control and run mknod to manually create the device special files that you need.
Supermount may work then.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
barry
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 170
Location: UK

PostPosted: Sun Jul 11, 2004 9:13 pm    Post subject: Reply with quote

I guess that might work. Any idea on what needs to be done to stop devfsd from handling /dev/sda?
Back to top
View user's profile Send private message
mariadne
n00b
n00b


Joined: 25 May 2004
Posts: 7

PostPosted: Sun Jul 11, 2004 9:27 pm    Post subject: Reply with quote

In my case, with USB removable media enabled (USB pen) when configuring the kernel (In SCSI section) I just have

/dev/sda1 /mnt/USB vfat noauto,user 0 0

in my fstab.
I then create a desktop icon for easy access.
I just plug in the USB pen, click the icon and thats just all.

In order to check if the USB pen mounts automatic, just issue the command tail /var/log/messages to see whether it is detected or not.

Spiros
Back to top
View user's profile Send private message
barry
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 170
Location: UK

PostPosted: Sun Jul 11, 2004 10:04 pm    Post subject: Reply with quote

But doing it this way still means having to unmount the pen manually before removing it. I'd like to do away with that - you can do it with a floppy disk using supermount, since /dev/fd0 is always there.
Back to top
View user's profile Send private message
mariadne
n00b
n00b


Joined: 25 May 2004
Posts: 7

PostPosted: Sun Jul 11, 2004 10:17 pm    Post subject: Reply with quote

barry wrote:
But doing it this way still means having to unmount the pen manually before removing it. I'd like to do away with that - you can do it with a floppy disk using supermount, since /dev/fd0 is always there.


To umount it you just right click on the desktop icon and select "umount". Isn't that the same with Windows, where you click the icon in the system tray so as to "remove the PnP device" safely?

Spiros
Back to top
View user's profile Send private message
vonhelmet
l33t
l33t


Joined: 06 Apr 2004
Posts: 770
Location: Somewhere in a school

PostPosted: Sun Jul 11, 2004 10:21 pm    Post subject: Reply with quote

barry wrote:
But doing it this way still means having to unmount the pen manually before removing it. I'd like to do away with that - you can do it with a floppy disk using supermount, since /dev/fd0 is always there.


Dude, you have to unmount memory sticks manually in Windows to avoid sync errors and data loss... Is it that much hassle to do the same in Linux?
_________________
My blog
nvtuner software - enhance your AGP Geforce 6800 or 6200!
Back to top
View user's profile Send private message
barry
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 170
Location: UK

PostPosted: Mon Jul 12, 2004 8:30 am    Post subject: Reply with quote

Ah, I thought in Windows you could just remove it at any time. Still, it would be possible to avoid mounting and unmounting it in Linux, I'm just trying to work out how. If devfsd didn't create and delete the device I think supermount would probably work.
Back to top
View user's profile Send private message
sabaisabai
Tux's lil' helper
Tux's lil' helper


Joined: 05 May 2004
Posts: 83
Location: Singapore

PostPosted: Mon Jul 12, 2004 8:37 am    Post subject: Reply with quote

I have managed to get it auto-mounting, using hotplug. It was very problematic though because I wasn't able to catch the event for device removal. And also, with the sync problem, I found that the data wasn't written unless I cleanly unmounted it first.
Back to top
View user's profile Send private message
barry
Apprentice
Apprentice


Joined: 01 May 2002
Posts: 170
Location: UK

PostPosted: Mon Jul 12, 2004 8:42 am    Post subject: Reply with quote

This is why I thought supermount would be suitable. From http://supermount-ng.sf.net -

Quote:
Supermount detects when you have finished activity on the subfs, and will flush all buffers to the disk before completing the operation. So, if you copy a file onto a supermounted floppy disk, the data will all be written to disk before the "cp" command finishes. When the command does complete, it will be safe to remove the disk.


Surely this applies to USB storage too.
Back to top
View user's profile Send private message
MrApples
Guru
Guru


Joined: 13 Dec 2002
Posts: 511

PostPosted: Mon Jul 12, 2004 10:10 pm    Post subject: Reply with quote

i found this a couple of months ago when having this same issue:

https://listman.redhat.com/archives/rhl-devel-list/2003-August/msg00115.html
Back to top
View user's profile Send private message
genstef
Retired Dev
Retired Dev


Joined: 13 Jun 2004
Posts: 668
Location: M/Bay/Germany

PostPosted: Tue Jul 13, 2004 10:12 am    Post subject: Reply with quote

Ivman tries to solve the iussue and it will finally be able to do so. But for the meantime I think there is a projekt called mntd, that also uses dbus and hal to detect when the device is plugged and unplugged. It will be necessary to use the sync option if you do not want to umount manually.
Back to top
View user's profile Send private message
smart
Guru
Guru


Joined: 19 Nov 2002
Posts: 455

PostPosted: Tue Jul 13, 2004 12:42 pm    Post subject: Reply with quote

As another option, we have "submount" in the portage tree.
Back to top
View user's profile Send private message
Khan
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2003
Posts: 96

PostPosted: Tue Jul 27, 2004 11:03 am    Post subject: Reply with quote

NeddySeagoon wrote:
barry,

You don't have to let devfs create and delete /dev/sda1. Take the pen drive out of devfsd control and run mknod to manually create the device special files that you need.
Supermount may work then.


Can you please provide and example of how to do this for those of us that don't know? That conf file needs a section titled "Uncomment below to tell devfsd to ignore the creation of specific devices". Examples are a wonderful thing :D Thanks.
Back to top
View user's profile Send private message
jonnevers
Veteran
Veteran


Joined: 02 Jan 2003
Posts: 1594
Location: Gentoo64 land

PostPosted: Tue Jul 27, 2004 12:59 pm    Post subject: Reply with quote

smart wrote:
As another option, we have "submount" in the portage tree.


submount/subfs [ http://submount.sourceforge.net/ ]does exactly what you want, you create an /etc/fstab record for the removable device with type "subfs". then you mount that device once.

it will create an icon on your desktop and if using Gnome 2.6, an icon under computer:///

at that point the removeable media device works exactly like the removeable devices in windows. you click on the icon, if the device has media, you see the contents, if no media found, you are told so.

subfs is a compliment of supermount. the difference is submount runs mostly in userspace (rather then kernel space). you do need to compile support for subfs into your kernel though. i really like subfs.

-Jon
Back to top
View user's profile Send private message
Khan
Tux's lil' helper
Tux's lil' helper


Joined: 19 Feb 2003
Posts: 96

PostPosted: Tue Jul 27, 2004 9:46 pm    Post subject: Reply with quote

jonnevers wrote:


submount/subfs [ http://submount.sourceforge.net/ ]does exactly what you want, you create an /etc/fstab record for the removable device with type "subfs". then you mount that device once.

-Jon


Jon,
How does submount deal with the whole devfsd creation/deletion of devices? Does it come with any good examples for ubspens, drives, etc?
Back to top
View user's profile Send private message
jonnevers
Veteran
Veteran


Joined: 02 Jan 2003
Posts: 1594
Location: Gentoo64 land

PostPosted: Wed Jul 28, 2004 12:16 pm    Post subject: Reply with quote

Khan wrote:
jonnevers wrote:


submount/subfs [ http://submount.sourceforge.net/ ]does exactly what you want, you create an /etc/fstab record for the removable device with type "subfs". then you mount that device once.

-Jon


Jon,
How does submount deal with the whole devfsd creation/deletion of devices? Does it come with any good examples for ubspens, drives, etc?


this may get you started:
http://gentoo-wiki.com/HOWTO_Submount

that explains how to install it and get it going for cdrw/dvd-rom/floppy
(keep in mind you don't need to compile manually, emerge submount is all you need to do to install it)

for a usb removeable pendrive an fstab record like:
Code:
/dev/sda1 /mnt/flash subfs auto,fs=vfat,noatime 0 0


should be what you are looking for, this assumes the /dev node for the device is /dev/sda1. submount should be able to gracefully handle a missing device node (i.e. you removed the pendrive from the usb bus). the first time you mount the device though, have it plugged in and the /dev available.

-Jon
Back to top
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Wed Jul 28, 2004 12:31 pm    Post subject: Reply with quote

You may also want to look at udev and hal, they can be set up to achieve this.
_________________
My Public Key

Wanted: Instructor in the art of Bowyery
Back to top
View user's profile Send private message
Arker
Apprentice
Apprentice


Joined: 10 Sep 2002
Posts: 205

PostPosted: Wed Jul 28, 2004 2:09 pm    Post subject: Reply with quote

nevynxxx wrote:
You may also want to look at udev and hal, they can be set up to achieve this.

Yes, udev and hal work well for my cellphone that is seen as a USB Mass Storage device (as I suspect your pendrive is).

It seems there are many solutions, none of which are quite fool proof or "drop in". I love Linux :)

~djc
_________________
*LIK*

My other computer is your Windows box.
Back to top
View user's profile Send private message
adoarns
n00b
n00b


Joined: 13 Jun 2004
Posts: 12

PostPosted: Wed Jul 28, 2004 2:50 pm    Post subject: Or just go udev + autofs Reply with quote

Autofs is the ebuild for automounter. You have to compile your kernel without devfsd support and with automounter support. Then, emerge autofs and udev. The auto.master file in /etc/autofs tells the automounter which directories it controls. I simply let it manage /mnt, and mount my usb pen, cdroms, etc. only when I need them--i.e., I cd to them. Since I'm using udev and hotplug, the /dev/sda1 entry also only appears when it's plugged in. And once you unplug it, the /dev entry goes away, and so does the mountpoint.

Not too terrible.
_________________
"Happiness in intelligent people is the rarest thing I know"
--Hemingway, Garden of Eden
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum