Auto mounting usb device on linux server
Bruce Dawson
jbd at codemeta.com
Tue May 9 22:07:01 EDT 2006
I believe you want to look at hald/udev. There are scripts in there that
the kernel calls when it detects a new USB device.
Also, all USB devices have a UUID, that I *think* appears in lsusb
output as 'iSerial'. Not sure here, maybe someone with more knowledge
can comment here.
--Bruce
Cole Tuininga wrote:
> Hey all - I'm hoping somebody might be able to point out a suggestion or
> solution for the following.
>
> What I have is a Debian (sarge) server, and a couple of usb storage
> devices. What I want to do is to find a way that when I plug in one of
> the storage devices, that the server will automagically mount the
> device. Extra points if I can also kick off a script once the drive is
> mounted.
>
> I tried the usbmount package, but it doesn't seem to work at all. All
> of the /media/usb* directories have been created, but nothing gets
> mounted when I plug in the device.
>
> I should also mention that I don't know for sure which usb slot the
> storage device will be plugged into, nor can I guarantee that it will be
> the only usb device plugged in.
>
> Currently, when I plug in my 256MB pen drive, I see the following in the
> logs:
>
> ==> daemon.log <==
> May 9 21:50:42 localhost udev[3507]: creating device node '/dev/sdb'
>
> ==> messages <==
> May 9 21:50:42 localhost kernel: usb 1-1: new full speed USB device
> using address 4
> May 9 21:50:42 localhost kernel: scsi2 : SCSI emulation for USB Mass
> Storage devices
> May 9 21:50:42 localhost kernel: Vendor: Model: USB DISK
> 12X Rev: PMAP
> May 9 21:50:42 localhost kernel: Type: Direct-Access
> ANSI SCSI revision: 02
> May 9 21:50:42 localhost kernel: SCSI device sdb: 487424 512-byte hdwr
> sectors (250 MB)
> May 9 21:50:42 localhost kernel: sdb: assuming Write Enabled
> May 9 21:50:42 localhost kernel: /dev/scsi/host2/bus0/target0/lun0: p1
> May 9 21:50:42 localhost kernel: Attached scsi removable disk sdb at
> scsi2, channel 0, id 0, lun 0
>
> ==> syslog <==
> May 9 21:50:42 localhost kernel: usb 1-1: new full speed USB device
> using address 4
> May 9 21:50:42 localhost kernel: scsi2 : SCSI emulation for USB Mass
> Storage devices
> May 9 21:50:42 localhost kernel: Vendor: Model: USB DISK
> 12X Rev: PMAP
> May 9 21:50:42 localhost kernel: Type: Direct-Access
> ANSI SCSI revision: 02
> May 9 21:50:42 localhost kernel: SCSI device sdb: 487424 512-byte hdwr
> sectors (250 MB)
> May 9 21:50:42 localhost kernel: sdb: assuming Write Enabled
> May 9 21:50:42 localhost kernel: sdb: assuming drive cache: write
> through
> May 9 21:50:42 localhost kernel: /dev/scsi/host2/bus0/target0/lun0: p1
> May 9 21:50:42 localhost kernel: Attached scsi removable disk sdb at
> scsi2, channel 0, id 0, lun 0
> May 9 21:50:42 localhost kernel: USB Mass Storage device found at 4
> May 9 21:50:42 localhost udev[3507]: creating device node '/dev/sdb'
>
> ==> messages <==
> May 9 21:50:43 localhost scsi.agent[3491]: sd_mod: loaded
> sucessfully (for disk)
> May 9 21:50:43 localhost usb.agent[3466]: usb-storage: already
> loaded
>
> ==> syslog <==
> May 9 21:50:43 localhost scsi.agent[3491]: sd_mod: loaded
> sucessfully (for disk)
> May 9 21:50:43 localhost usb.agent[3466]: usb-storage: already
> loaded
>
> ==> daemon.log <==
> May 9 21:50:44 localhost udev[3554]: creating device node '/dev/sdb1'
>
> ==> syslog <==
> May 9 21:50:44 localhost udev[3554]: creating device node '/dev/sdb1'
>
>
> Anybody have any suggestions?
>
More information about the gnhlug-discuss
mailing list