FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 10-07-2010, 08:06 PM
Volkan YAZICI
 
Default udev auto mount usb disk

Hi,

Below are the configurations related with my USB disk.

# grep tosun /etc/fstab
UUID=0C98AFAF98AF95AC /media/tosun ntfs-3g noauto,fmask=133,dmask=022 0 0

# cat /etc/udev/rules.d/89-tosun.rules
ACTION=="add", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="mount /media/tosun"
ACTION=="remove", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="umount -l /media/tosun"

# udevadm info --name=/dev/sdb1 --query=all
P: /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/host6/target6:0:0/6:0:0:0/block/sdb/sdb1
N: sdb1
S: block/8:17
S: disk/by-id/usb-TOSHIBA_MK5055GSX_95EF50EFFFFF-0:0-part1
S: disk/by-path/pci-0000:00:1d.0-usb-0:1.5:1.0-scsi-0:0:0:0-part1
S: disk/by-uuid/0C98AFAF98AF95AC
S: disk/by-label/XS
E: UDEV_LOG=3
E: DEVPATH=/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.5/2-1.5:1.0/host6/target6:0:0/6:0:0:0/block/sdb/sdb1
E: SUBSYSTEM=block
E: DEVNAME=sdb1
E: ID_VENDOR=TOSHIBA
E: ID_VENDOR_ENC=TOSHIBAx20
E: ID_VENDOR_ID=152d
E: ID_MODEL=MK5055GSX
E: ID_MODEL_ENC=MK5055GSXx20x20x20x20x20x20x20
E: ID_MODEL_ID=2329
E: ID_REVISION=0100
E: ID_SERIAL=TOSHIBA_MK5055GSX_95EF50EFFFFF-0:0
E: ID_SERIAL_SHORT=95EF50EFFFFF
E: ID_TYPE=disk
E: ID_INSTANCE=0:0
E: ID_BUS=usb
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usb-storage
E: ID_PATH=pci-0000:00:1d.0-usb-0:1.5:1.0-scsi-0:0:0:0
E: ID_PART_TABLE_TYPE=dos
E: ID_FS_LABEL=XS
E: ID_FS_LABEL_ENC=XS
E: ID_FS_UUID=0C98AFAF98AF95AC
E: ID_FS_UUID_ENC=0C98AFAF98AF95AC
E: ID_FS_TYPE=ntfs
E: ID_FS_USAGE=filesystem
E: MAJOR=8
E: MINOR=17
E: DEVTYPE=partition
E: DEVLINKS=/dev/block/8:17 /dev/disk/by-id/usb-TOSHIBA_MK5055GSX_95EF50EFFFFF-0:0-part1 /dev/disk/by-path/pci-0000:00:1d.0-usb-0:1.5:1.0-scsi-0:0:0:0-part1 /dev/disk/by-uuid/0C98AFAF98AF95AC /dev/disk/by-label/XS

Despite I tried restarting the system and udev many times, plugging -in
and -out the USB disk doesn't make udev to trigger any events. dmesg
just informs me about the disk as usual:

[ 1981.290165] udev: starting version 160
[ 2031.599488] usb 2-1.5: USB disconnect, address 5
[ 2042.422847] udev: starting version 160
[ 2057.352064] usb 2-1.5: new high speed USB device using ehci_hcd and address 6
[ 2057.445887] usb 2-1.5: New USB device found, idVendor=152d, idProduct=2329
[ 2057.445891] usb 2-1.5: New USB device strings: Mfr=1, Product=2, SerialNumber=5
[ 2057.445894] usb 2-1.5: Product: USB to ATA/ATAPI bridge
[ 2057.445897] usb 2-1.5: Manufacturer: JMicron
[ 2057.445899] usb 2-1.5: SerialNumber: 95EF50EFFFFF
[ 2057.446829] usb-storage 2-1.5:1.0: Quirks match for vid 152d pid 2329: 8020
[ 2057.446865] scsi6 : usb-storage 2-1.5:1.0
[ 2058.443128] scsi 6:0:0:0: Direct-Access TOSHIBA MK5055GSX PQ: 0 ANSI: 2 CCS
[ 2058.443995] sd 6:0:0:0: Attached scsi generic sg2 type 0
[ 2058.444549] sd 6:0:0:0: [sdb] 976773168 512-byte logical blocks: (500 GB/465 GiB)
[ 2058.445306] sd 6:0:0:0: [sdb] Write Protect is off
[ 2058.445314] sd 6:0:0:0: [sdb] Mode Sense: 34 00 00 00
[ 2058.445319] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 2058.446805] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 2058.446812] sdb: sdb1
[ 2058.476735] sd 6:0:0:0: [sdb] Assuming drive cache: write through
[ 2058.476738] sd 6:0:0:0: [sdb] Attached SCSI disk

OTOH, manually issuing "mount /media/tosun" works without a problem. Any
ideas about what might be missing?


Regards.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87tykxpy2z.fsf@alamut.ozu.edu.tr">http://lists.debian.org/87tykxpy2z.fsf@alamut.ozu.edu.tr
 
Old 10-08-2010, 12:12 PM
Camaleón
 
Default udev auto mount usb disk

On Thu, 07 Oct 2010 23:06:12 +0300, Volkan YAZICI wrote:

> Below are the configurations related with my USB disk.
>
> # grep tosun /etc/fstab UUID=0C98AFAF98AF95AC /media/tosun ntfs-3g noauto,fmask=133,dmask=022 0 0

That line should be enough to get the disk mounted.

> # cat /etc/udev/rules.d/89-tosun.rules
> ACTION=="add", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="mount /media/tosun"
> ACTION=="remove", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="umount -l /media/tosun"

(...)

I see no point for that rule. What are you trying to achieve? :-?

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.10.08.12.12.19@gmail.com">http://lists.debian.org/pan.2010.10.08.12.12.19@gmail.com
 
Old 10-08-2010, 12:31 PM
Volkan YAZICI
 
Default udev auto mount usb disk

On Fri, 8 Oct 2010, Camaleón <noelamac@gmail.com> writes:
> On Thu, 07 Oct 2010 23:06:12 +0300, Volkan YAZICI wrote:
>> # cat /etc/udev/rules.d/89-tosun.rules
>> ACTION=="add", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="mount /media/tosun"
>> ACTION=="remove", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="umount -l /media/tosun"
>
> (...)
>
> I see no point for that rule. What are you trying to achieve? :-?

Trying to mount my USB disk to /media/tosun everytime it is plugged in,
and umount whenever it is unplugged.


Regards.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87aamoeuhi.fsf@alamut.ozu.edu.tr">http://lists.debian.org/87aamoeuhi.fsf@alamut.ozu.edu.tr
 
Old 10-08-2010, 01:34 PM
Camaleón
 
Default udev auto mount usb disk

On Fri, 08 Oct 2010 15:31:37 +0300, Volkan YAZICI wrote:

> On Fri, 8 Oct 2010, Camaleón writes:
>> On Thu, 07 Oct 2010 23:06:12 +0300, Volkan YAZICI wrote:
>>> # cat /etc/udev/rules.d/89-tosun.rules ACTION=="add",
>>> ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="mount /media/tosun"
>>> ACTION=="remove", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="umount
>>> -l /media/tosun"
>>
>> (...)
>>
>> I see no point for that rule. What are you trying to achieve? :-?
>
> Trying to mount my USB disk to /media/tosun everytime it is plugged in,
> and umount whenever it is unplugged.

USB devices are handled by desktop environment, no need to write rules
for that. What DE are you using?

In GNOME/KDE as soon as you plug any USB storage device it is
automatically mounted under "/media/device_label". Likewise, the disk is
umounted/disconnected as soon as you select "safely disconnect or safely
remove" from icon desktop context menu or any desktop applet.

But do not mix static mount points (those defined in "/etc/fstab") with
udev rules neither "/media" mout points to avoid conflicts. Just choose
what method best suits your needs (the static one -using fstab file and
manually calling mount/umount as required- or dynamic one -letting udev
to handle the whole mount/umount process-).

Greetings,

--
Camaleón


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: pan.2010.10.08.13.34.45@gmail.com">http://lists.debian.org/pan.2010.10.08.13.34.45@gmail.com
 
Old 10-08-2010, 01:48 PM
Volkan YAZICI
 
Default udev auto mount usb disk

On Fri, 8 Oct 2010, Camaleón <noelamac@gmail.com> writes:
> On Fri, 08 Oct 2010 15:31:37 +0300, Volkan YAZICI wrote:
>> On Fri, 8 Oct 2010, Camaleón writes:
>>> On Thu, 07 Oct 2010 23:06:12 +0300, Volkan YAZICI wrote:
>>>> # cat /etc/udev/rules.d/89-tosun.rules ACTION=="add",
>>>> ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="mount /media/tosun"
>>>> ACTION=="remove", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="umount
>>>> -l /media/tosun"
>>>
>>> (...)
>>>
>>> I see no point for that rule. What are you trying to achieve? :-?
>>
>> Trying to mount my USB disk to /media/tosun everytime it is plugged in,
>> and umount whenever it is unplugged.
>
> USB devices are handled by desktop environment, no need to write rules
> for that. What DE are you using?
>
> In GNOME/KDE as soon as you plug any USB storage device it is
> automatically mounted under "/media/device_label". Likewise, the disk is
> umounted/disconnected as soon as you select "safely disconnect or safely
> remove" from icon desktop context menu or any desktop applet.

There is no DE, and I don't want auto-mount. This case is just for this
specific device.

> But do not mix static mount points (those defined in "/etc/fstab") with
> udev rules neither "/media" mout points to avoid conflicts. Just choose
> what method best suits your needs (the static one -using fstab file and
> manually calling mount/umount as required- or dynamic one -letting udev
> to handle the whole mount/umount process-).

Yep, I know, but thanks for the clarification. udev maintainer helped me
to spot the problem: I need to use "sh -c 'mount ...'" to execute
commands. BTW, enabling /dev/hotplug.log in
/lib/udev/rules.d/80-driver.rules is also quite helpful for debugging
purposes.


Regards.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 8739sgsslp.fsf@alamut.ozu.edu.tr">http://lists.debian.org/8739sgsslp.fsf@alamut.ozu.edu.tr
 
Old 10-10-2010, 01:55 AM
Dave Thayer
 
Default udev auto mount usb disk

On Thu, Oct 07, 2010 at 11:06:12PM +0300, Volkan YAZICI wrote:
> Hi,
>
> Below are the configurations related with my USB disk.
>
> # grep tosun /etc/fstab
> UUID=0C98AFAF98AF95AC /media/tosun ntfs-3g noauto,fmask=133,dmask=022 0 0
>
> # cat /etc/udev/rules.d/89-tosun.rules
> ACTION=="add", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="mount /media/tosun"
> ACTION=="remove", ENV{ID_FS_UUID}=="0C98AFAF98AF95AC", RUN+="umount -l /media/tosun"
[...]
> Despite I tried restarting the system and udev many times, plugging -in
> and -out the USB disk doesn't make udev to trigger any events. dmesg
> just informs me about the disk as usual:
[...]
> OTOH, manually issuing "mount /media/tosun" works without a problem. Any
> ideas about what might be missing?
>
I'm not sure why your udev rules aren't firing, but, shouldn't you be
umounting the filesystem *Before* removing the drive? Your udev "remove"
rule is not going to fire until after the drive is pulled. This seems
like you would be risking a corrupted filesystem by umounting an
already removed drive.

I prefer to use a combination of udev rules and automount to handle
removable media, since I generally avoid using desktop managers.

dt

--
Dave Thayer | Whenever you read a good book, it's like the
Denver, Colorado USA | author is right there, in the room talking to
dave@thayer-boyle.com | you, which is why I don't like to read
| good books. - Jack Handey "Deep Thoughts"


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20101010015535.GA11369@thayer-boyle.com">http://lists.debian.org/20101010015535.GA11369@thayer-boyle.com
 

Thread Tools




All times are GMT. The time now is 03:03 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org