manage usb sticks via autofs
Stef Bon
stef at bononline.nl
Fri May 29 06:31:22 PDT 2009
Hello,
I'm working with an construction which mounts USB sticks in a
subdirectory of the users homedirectory:
$HOME/Connections/Devices
It works with udev (for hotplugging: add this device to a autofs map and
add it to the auto.master file and reload the automounter,) and
ConsoleKit (for coldplugging: lookup all USB devices when a session for
an user starts and add these to the same map, and also a reload)
See:
http://linux.bononline.nl/linux/autofsmanaged/index.php
It looks like:
http://www.gentoo-wiki.info/Autofs#UDEV_with_autofs
I highly prefer mountpoints in my homedirectory over /media. The
"foreign" directory /media is not userfriendly in my opinion. Most
programs (OpenOffice, Amarok for example) start in the homedirectory
when opening a file.
When going to /media, from for example the "places" toolbar, the way to
get there is easy and userfriendly, but when you want to go back, you'll
end up in a systemdirectory /media, and going from there to the
homedirectory is a long and difficult way, which normal users dont want.
You can say, well the user can click on an icon representing the
homedirectory, and he/she is back, but it's not that intuitive.
Using mountpoints other than in /media confuses the desktopenvironment.
An icon for the USB device is added to my "places" toolbar when I
connect an USB (with label USB stick), and when I click on it, Dolphin
leads me to /media. When I click on the device map
$HOME/Connections/Devices/USB stick
it's mounted here and the icon in my toolbar is notified about the new
mountpoint.
Now the whole problem is that HAL is not that flexible in handling
mountpoints other than /media, and cooperation with autofs. Autofs does
not write a line for this device to mtab, causing hal not to know
anything about the device is handled by the automounter.
The only way to prevent HAL from it's normal behaviour was, is to tell
to ignore the USB devices.
But this makes that the devices are completely ignored (well that is to
be expected) by my desktop, where an icon
in the places toolbar should be very nice.
Is there some other way to tell the new devkit for disks not to ignore
the disk, but not to mount it, for example an extra parameter indicating
how the mounting is managed:
- default (like the old hal did)
- autofs
- other
This introduces other problems by the way, when working in an multi user
environment like multihead.
But what do you think?
Stef Bon
More information about the devkit-devel
mailing list