[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: 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"


Reply to: