* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
@ 2003-11-29 12:33 ` reflex
2003-11-29 14:06 ` Oliver Neukum
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: reflex @ 2003-11-29 12:33 UTC (permalink / raw)
To: linux-hotplug
Martin schrieb:
> So I began to google for a usb-storage hotplug script which
> would do what I want.
I have had the same problem and tried do solve it by scanning all
devices automatically: http://vold.sourceforge.net
KDE has a device kio slave which scanns /etc/fstab. So I could
probably add a feature where connected devices don't get mounted
but added to /etc/fstab so they appear on the desktop
automatically.
Drawback is: Vold doesnt know if it has just mounted a usb-drive
or a cdrom. And you will get nasty read-error messages in syslog
if you load the usb-storage driver but have no device attached
etc. They are not severe, I just have to find a way to suppress
them. It still misses an eject program to unmount as user.
> By looking in the usb and scsi nodes under /proc I decided that
> the only unique information between the two trees was the
> serial number.
Are you really sure that the serial is unique? If I remember
correctly the not all devices have serials set.
> I do have one further problem before I even start, which is
> that I don't seem to get a remove event when I disconnect a
> flash drive. Is this a known problem with my version of the
> kernel or of hotplug?
Same here. I think its a bug. But since its not 2.5/2.6-test
related nobody seems to care here :-(
--
Clemens Wacha wacha@gmx.ch ICQ:12620492
proudly running Debian/GNU Linux. See http://www.debian.org
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
2003-11-29 12:33 ` reflex
@ 2003-11-29 14:06 ` Oliver Neukum
2003-11-29 18:05 ` Marco d'Itri
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Oliver Neukum @ 2003-11-29 14:06 UTC (permalink / raw)
To: linux-hotplug
> > By looking in the usb and scsi nodes under /proc I decided that
> > the only unique information between the two trees was the
> > serial number.
> Are you really sure that the serial is unique? If I remember
> correctly the not all devices have serials set.
They are not unique. And the assumption that one hotplug
event correlates with one new device is false. There are
multi-Lun devices and scsi-to-usb bridges.
You may also connect a tape or other non disk device.
> > I do have one further problem before I even start, which is
> > that I don't seem to get a remove event when I disconnect a
> > flash drive. Is this a known problem with my version of the
> > kernel or of hotplug?
> Same here. I think its a bug. But since its not 2.5/2.6-test
> related nobody seems to care here :-(
What kind of device do you disconnect?
Regards
Oliver
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
2003-11-29 12:33 ` reflex
2003-11-29 14:06 ` Oliver Neukum
@ 2003-11-29 18:05 ` Marco d'Itri
2003-11-30 11:19 ` reflex
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Marco d'Itri @ 2003-11-29 18:05 UTC (permalink / raw)
To: linux-hotplug
On Nov 29, Martin <drink@hyperlogos.org> wrote:
>unfortunately the entries here are not really unique in any way if you
>have more than one of the same thing. The Revision from the
>/proc/bus/usb/devices might be used to HELP identify something, but it
>still will not be unique. The question is, what happens when I plug in
>another one? Will it get a new host? Answer is yes. The device also
>shows up in a new usb-storage-? directory under /proc/scsi. Here is its
>entry in usb/devices:
You really want to use a 2.6 kernel. In sysfs you will find everything
needed to automatically mount your device.
--
ciao, |
Marco | [3363 malEDvGeptZQA]
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (2 preceding siblings ...)
2003-11-29 18:05 ` Marco d'Itri
@ 2003-11-30 11:19 ` reflex
2003-11-30 19:38 ` Greg KH
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: reflex @ 2003-11-30 11:19 UTC (permalink / raw)
To: linux-hotplug
Oliver Neukum schrieb:
> > > I do have one further problem before I even start, which is
> > > that I don't seem to get a remove event when I disconnect a
> > > flash drive. Is this a known problem with my version of the
> > > kernel or of hotplug?
> > Same here. I think its a bug. But since its not 2.5/2.6-test
> > related nobody seems to care here :-(
>
> What kind of device do you disconnect?
An Apacer USB-Flash Drive 256MB USB2.0
cat /etc/hotplug/usb/usb-storage
#!/bin/sh
logger -t "USB-Drive" "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
/var/log/syslog
-->plug in:
Nov 30 12:10:45 lapis kernel: hub.c: new USB device 10:19.0-1, assigned address 4
Nov 30 12:10:45 lapis kernel: usb-storage: act_altsettting is 0
Nov 30 12:10:45 lapis kernel: usb-storage: id_index calculated to be: 101
Nov 30 12:10:45 lapis kernel: usb-storage: Array length appears to be: 103
Nov 30 12:10:45 lapis kernel: usb-storage: USB Mass Storage device detected
Nov 30 12:10:45 lapis kernel: usb-storage: Endpoints: In: 0xc49ce6e0 Out: 0xc49ce6f4 Int: 0x00000000 (Period 0)
Nov 30 12:10:45 lapis kernel: usb-storage: Found existing GUID 1005b1130070b00010b10320
Nov 30 12:10:45 lapis kernel: WARNING: USB Mass Storage data integrity not assured
Nov 30 12:10:45 lapis kernel: USB Mass Storage device found at 4
Nov 30 12:10:48 lapis usb.agent[639]: kernel driver usb-storage already loaded
Nov 30 12:10:48 lapis USB-Drive: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
-->plug out:
Nov 30 12:17:26 lapis kernel: usb.c: USB disconnect on device 10:19.0-1 address 4
Nov 30 12:17:26 lapis kernel: usb-storage: storage_disconnect() called
Nov 30 12:17:26 lapis kernel: usb-storage: -- releasing main URB
Nov 30 12:17:26 lapis kernel: usb-storage: -- usb_unlink_urb() returned -19
/proc/bus/usb/devices
T: Bus\x02 Lev\x01 Prnt\x01 Port\0 Cnt\x01 Dev#= 5 Spd\x12 MxCh= 0
D: Ver= 2.00 Cls\0(>ifc ) Sub\0 Prot\0 MxPSd #Cfgs= 1
P: Vendor\x1005 ProdID±13 Rev= 1.00
S: Product=USB Flash Drive
S: SerialNumber\a0B00010B10320
C:* #Ifs= 1 Cfg#= 1 AtrÄ MxPwrP0mA
I: If#= 0 Alt= 0 #EPs= 2 Cls\b(stor.) Sub\x06 ProtP Driver=usb-storage
E: AdÅ(I) Atr\x02(Bulk) MxPS= 64 Ivl=0ms
E: Ad\x02(O) Atr\x02(Bulk) MxPS= 64 Ivl=0ms
regards
Clemens
(sorry for the long lines)
--
Clemens Wacha wacha@gmx.ch ICQ:12620492
proudly running Debian/GNU Linux. See http://www.debian.org
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (3 preceding siblings ...)
2003-11-30 11:19 ` reflex
@ 2003-11-30 19:38 ` Greg KH
2003-12-09 9:05 ` Wout Mertens
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2003-11-30 19:38 UTC (permalink / raw)
To: linux-hotplug
On Fri, Nov 28, 2003 at 05:19:30PM -0800, Martin wrote:
> I recently got my first USB flash drive - I have one on loan from work,
> but I finally OWN one, so I am motivated to do something with it now.
> One of the things I want to have working is hotplugging, with automatic
> mounting. The device it's mounted on doesn't matter so much but one of
> the absolutely mandatory requirements is that I not need a fstab entry.
> This became a requirement when I noticed that plugging the device in,
> then unplugging it, then plugging it BACK in resulted in it being
> attached first to sdc and then to sdd. (This is a SCSI system.)
Have you looked at devlabel? It should solve your problem for you.
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (4 preceding siblings ...)
2003-11-30 19:38 ` Greg KH
@ 2003-12-09 9:05 ` Wout Mertens
2003-12-09 16:09 ` Olaf Hering
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Wout Mertens @ 2003-12-09 9:05 UTC (permalink / raw)
To: linux-hotplug
Hi,
I was wondering what the current state of auto-mount-inserted-devices
is.
I posted my script which is run as a hotplug agent for storage some time
ago, someone else had one along the same lines, Mandrake uses devfsd to
call their configuration scripts and the fstab editor, Lindows has
something, Suse as well, there is the vold project which uses polling, ...
It sometimes seems that everyone and their brother has their own
solution :(
Is there some standardized way of solving this in the works? Perhaps
based on sysfs?
Issues I know of hotplug-automounting in the 2.4 world:
- When run by usb.agent, you need to have a different name than the
kernel module usb-storage, because otherwise you only get called when
that module isn't loaded.
- When run by usb.agent, you don't know what the device is that sd_mod
made out of it. You need to either check all attached devices or do
some creative grepping on the serial number and hope that the device
is unique at this point in time.
- When run by devfsd, you only get called when sd_mod is loaded. If it
doesn't get loaded for some reason, you don't get called.
- sd_mod is very bad about detecting when a device has gone or replaced
by another. You need to kick it with something like "dd if=<device>
of=/dev/null bsQ2 count=1" for it to see new partition layouts. This
can be done from devfsd though. Can it be done from udev?
- If you don't use supermount to mount the devices, unplugging them
without closing all filedescriptors (including standing in subdirs)
makes the kernel upset, and you have to umount -l or -f. Only,
supermount is a hack that changes Unix semantics :(.
Comments?
Wout.
Nov 30, an infinite number of monkeys worshipping Greg KH pounded out:
> On Fri, Nov 28, 2003 at 05:19:30PM -0800, Martin wrote:
> > I recently got my first USB flash drive - I have one on loan from work,
> > but I finally OWN one, so I am motivated to do something with it now.
> > One of the things I want to have working is hotplugging, with automatic
> > mounting. The device it's mounted on doesn't matter so much but one of
> > the absolutely mandatory requirements is that I not need a fstab entry.
> > This became a requirement when I noticed that plugging the device in,
> > then unplugging it, then plugging it BACK in resulted in it being
> > attached first to sdc and then to sdd. (This is a SCSI system.)
>
> Have you looked at devlabel? It should solve your problem for you.
>
> thanks,
>
> greg k-h
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SF.net Giveback Program.
> Does SourceForge.net help you be more productive? Does it
> help you create better code? SHARE THE LOVE, and help us help
> YOU! Click Here: http://sourceforge.net/donate/
> _______________________________________________
> Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
> Linux-hotplug-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
>
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (5 preceding siblings ...)
2003-12-09 9:05 ` Wout Mertens
@ 2003-12-09 16:09 ` Olaf Hering
2003-12-09 16:24 ` Greg KH
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Olaf Hering @ 2003-12-09 16:09 UTC (permalink / raw)
To: linux-hotplug
On Tue, Dec 09, Wout Mertens wrote:
> Comments?
forget 2.4, work on 2.6. 2.6 will give you a block event if there is
something of interrest.
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n√úRNBERG
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (6 preceding siblings ...)
2003-12-09 16:09 ` Olaf Hering
@ 2003-12-09 16:24 ` Greg KH
2003-12-10 19:29 ` Wout Mertens
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Greg KH @ 2003-12-09 16:24 UTC (permalink / raw)
To: linux-hotplug
On Tue, Dec 09, 2003 at 10:05:29AM +0100, Wout Mertens wrote:
> Hi,
>
> I was wondering what the current state of auto-mount-inserted-devices
> is.
>
> I posted my script which is run as a hotplug agent for storage some time
> ago, someone else had one along the same lines, Mandrake uses devfsd to
> call their configuration scripts and the fstab editor, Lindows has
> something, Suse as well, there is the vold project which uses polling, ...
>
> It sometimes seems that everyone and their brother has their own
> solution :(
What's wrong with devlabel? I thougth that's what most people are
using, as I think it solves the problems you are looking at.
And I don't know anything about devfs :)
thanks,
greg k-h
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (7 preceding siblings ...)
2003-12-09 16:24 ` Greg KH
@ 2003-12-10 19:29 ` Wout Mertens
2003-12-10 19:41 ` Wout Mertens
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Wout Mertens @ 2003-12-10 19:29 UTC (permalink / raw)
To: linux-hotplug
Yesterday at 17:09, Olaf Hering ponderously produced:
> On Tue, Dec 09, Wout Mertens wrote:
>
> > Comments?
>
> forget 2.4, work on 2.6. 2.6 will give you a block event if there is
> something of interrest.
Well, you're right. I just created a hotplug script that will automount
all block devices that get attached. I use this behaviour to use a USB
key as a token for connecting to a VNC session from a thin client.
It's way cleaner than the 2.4 version...
Here's the script, comments?
=====================#!/bin/sh
#
# Automount hotplugged block devices, by Wout Mertens.
#
# Linux v2.6 version
# This script is released under version 2 of the GPL.
# To install this, either make it /sbin/hotplug, or, if you have
# linux-hotplug installed, make it /etc/hotplug.d/block/automount.hotplug .
# It needs to be executable. I tested it with busybox's ash.
#
# The devices will be mounted for the console user if applicable.
#
# To work, this needs:
# - v2.6 kernel support:
# - hotplugging, /proc mounted, /sys mounted
# - filesystems that will be mounted, like vfat
# - sh, echo, tr, stat or ls, getent or grep passwd,
# mount, umount, mkdir, rmdir. logger is used if there.
#
# Possible improvements:
# - Create a desktop entry for the device.
# - Call a notifier script when mounting/unmounting. This could create the
# desktop entry by itself.
# - Mount as supermount if available. This will improve behaviour for
# synchronous writes and hanging mounts, although umount -lf already
# does a good job.
# - Detect filesystem on device, so filesystems that don't need a mounting
# user can skip user detection.
# Debugging
# set -xv
# exec > /tmp/hotplug.$$ 2>&1
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export PATH
# We only handle block device messages
[ "$1" != "block" ] && exit 0
# Proclaim stuff to the world
mesg () {
logger -t $0 "$*"
}
# Is path already mounted?
is_path_mounted () {
while read dev path rest
do
if [ "$path" = "$1" ]
then
return 0
fi
done < /proc/mounts
return 1
}
# Get mounted path for a device
get_mounted_path () {
while read dev path rest
do
if [ "$dev" = "$1" ]
then
echo "$path"
return 0
fi
done < /proc/mounts
return 1
}
# Wait for a file to appear
wait_for () {
local count=0
while [ $count -lt 10 ] && [ ! -e "$1" ]
do
sleep 1
done
[ $count -eq 10 ] && return 1
return 0
}
# Remove strange characters from a filename
clean_filename () {
echo $1 | tr " /?*\"<>" "_______"
}
# Figure out the device to mount
set `echo $DEVPATH | tr / " "`
[ $# -ne 3 ] && exit 0
DEVICE=/dev/$3
if [ "$ACTION" = "remove" ]
then
# Unmount it
dir=`get_mounted_path $DEVICE`
[ -d "$dir" ] || exit 1
umount -lf "$dir"
rmdir "$dir"
exit 1
fi
if [ "$ACTION" = "add" ]
then
# Mount it
# Make sure we have support for vfat
modprobe -q vfat
wait_for /sys/$1/$2/device/vendor || exit 1
# Find the name
PRODUCT=`cat /sys/$1/$2/device/model`
if [ -z "$PRODUCT" ]
then
PRODUCT=generic
fi
# Find out where we mount it
MOUNTPATH=/mnt/usb/`clean_filename "$PRODUCT"`
if is_path_mounted "$MOUNTPATH"
then
count=1
while is_path_mounted "${MOUNTPATH}_${count}"
do
count=$(( $count + 1 ))
done
MOUNTPATH="${MOUNTPATH}_${count}"
fi
# Make sure it's a directory
if [ -e "$MOUNTPATH" ]
then
if [ ! -d "$MOUNTPATH" ]
then
mesg "$MOUNTPATH exists but is not a directory"
exit 1
fi
else
mkdir -p "$MOUNTPATH"
if [ $? -ne 0 ]
then
mesg "Could not create mountpoint $MOUNTPATH"
exit 1
fi
fi
# Find out who we are going to mount it as
CONSOLEUSER=`stat -c%U /dev/console 2>/dev/null`
if [ -z "$CONSOLEUSER" ]
then
set `ls -l /dev/console`
CONSOLEUSER=$3
fi
[ -n "$CONSOLEUSER" ] || CONSOLEUSER=root
PASSWD=`getent passwd $CONSOLEUSER 2>/dev/null`
if [ -z "$PASSWD" ]
then
PASSWD=`grep "$CONSOLEUSER" /etc/passwd||grep root /etc/passwd`
fi
if [ -z "$PASSWD" ]
then
mesg "Could not get password entry for $CONSOLEUSER"
exit 1
fi
set `echo $PASSWD | tr : " "`
if [ $# -lt 4 ]
then
mesg "Bad password entry for $CONSOLEUSER"
exit 1
fi
# These options should prevent abuse and make it writeable for the
# console user.
MOUNTOPTS="-s -osync,nosuid,umask\a7,uid=$3,gid=$4"
mesg Mounting $DEVICE on $MOUNTPATH, options $MOUNTOPTS
mount $MOUNTOPTS $DEVICE $MOUNTPATH
fi
=====================
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (8 preceding siblings ...)
2003-12-10 19:29 ` Wout Mertens
@ 2003-12-10 19:41 ` Wout Mertens
2003-12-10 19:49 ` Olaf Hering
2003-12-11 15:37 ` Wout Mertens
11 siblings, 0 replies; 13+ messages in thread
From: Wout Mertens @ 2003-12-10 19:41 UTC (permalink / raw)
To: linux-hotplug
Yesterday at 08:24, Greg KH ponderously produced:
> On Tue, Dec 09, 2003 at 10:05:29AM +0100, Wout Mertens wrote:
> > Hi,
> >
> > I was wondering what the current state of auto-mount-inserted-devices
> > is.
> >
> > I posted my script which is run as a hotplug agent for storage some time
> > ago, someone else had one along the same lines, Mandrake uses devfsd to
> > call their configuration scripts and the fstab editor, Lindows has
> > something, Suse as well, there is the vold project which uses polling, ...
> >
> > It sometimes seems that everyone and their brother has their own
> > solution :(
>
> What's wrong with devlabel? I thougth that's what most people are
> using, as I think it solves the problems you are looking at.
>
> And I don't know anything about devfs :)
Devlabel needs to know about the device beforehand. I can't quickly copy
some pictures to my friends USB stick that way.
Devlabel tries to do something that's important for servers with loads
of drives. It is irrelevant, however, for the behaviour in the previous
paragraph. I insert the key, I copy stuff to the mountpoint, preferrably
through clicking on some icon on the desktop, done. I'll never need that
mountpoint again. It doesn't matter if it is on /dev/sda1 or
/dev/sdz6...
updfstab is another way of handling it, but then the user must remember
to mount first, and unmount afterwards. My script mounts it for the
owner of /dev/console, which means that if you plug in the key before
you're logged in, you don't get access to it.
In any case, I'm happy to see that Linux 2.6 has gotten more much robust
for hotplugging :)
Wout.
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (9 preceding siblings ...)
2003-12-10 19:41 ` Wout Mertens
@ 2003-12-10 19:49 ` Olaf Hering
2003-12-11 15:37 ` Wout Mertens
11 siblings, 0 replies; 13+ messages in thread
From: Olaf Hering @ 2003-12-10 19:49 UTC (permalink / raw)
To: linux-hotplug
On Wed, Dec 10, Wout Mertens wrote:
> Yesterday at 17:09, Olaf Hering ponderously produced:
>
> > On Tue, Dec 09, Wout Mertens wrote:
> >
> > > Comments?
> >
> > forget 2.4, work on 2.6. 2.6 will give you a block event if there is
> > something of interrest.
>
> Well, you're right. I just created a hotplug script that will automount
> all block devices that get attached. I use this behaviour to use a USB
> key as a token for connecting to a VNC session from a thin client.
>
> It's way cleaner than the 2.4 version...
>
> Here's the script, comments?
to make it more generic, use /proc/self/mounts and sed instead of tr.
--
USB is for mice, FireWire is for men!
sUse lINUX ag, n√úRNBERG
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: Working on a usb-storage hotplug script
2003-11-29 1:19 Working on a usb-storage hotplug script Martin
` (10 preceding siblings ...)
2003-12-10 19:49 ` Olaf Hering
@ 2003-12-11 15:37 ` Wout Mertens
11 siblings, 0 replies; 13+ messages in thread
From: Wout Mertens @ 2003-12-11 15:37 UTC (permalink / raw)
To: linux-hotplug
Yesterday at 20:49, Olaf Hering sat down and wrote:
> On Wed, Dec 10, Wout Mertens wrote:
>
> > Yesterday at 17:09, Olaf Hering ponderously produced:
> >
> > > On Tue, Dec 09, Wout Mertens wrote:
> > >
> > > > Comments?
> > >
> > > forget 2.4, work on 2.6. 2.6 will give you a block event if there is
> > > something of interrest.
> >
> > Well, you're right. I just created a hotplug script that will automount
> > all block devices that get attached. I use this behaviour to use a USB
> > key as a token for connecting to a VNC session from a thin client.
> >
> > It's way cleaner than the 2.4 version...
> >
> > Here's the script, comments?
>
> to make it more generic, use /proc/self/mounts and sed instead of tr.
Sure :) Here are the changed lines:
====================
done < /proc/self/mounts
done < /proc/self/mounts
echo $1 | sed 's/[ /?*\"<>]/_/g'
set `echo $DEVPATH | sed 's/\// /g'`
set `echo $PASSWD | sed 's/:/ /g'`
====================
Playing with it, I see that 2.6 is very robust, and the only problem is
that when you mount something as "sync", it doesn't sync the directory
entry until after you type "sync". It does write all the data first
though. Sigh. This is where supermount_ng comes in.
I realize that the cleaner way would be to rewrite fstab and let
KDE/Gnome help the user with mounting/unmounting. But that won't help
for USB login tokens...
Wout.
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id\x1278&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 13+ messages in thread