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 > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 10-07-2010, 03:32 PM
Thomas Bächler
 
Default umount usb stick via udev

Am 07.10.2010 17:18, schrieb Benjamin Sambale:
> I managed to mount my usb stick automatically via udev rules (hal isn't
> running). However, if I unplug the stick while thunar is open, the
> umount command hangs. After that I can't even reboot. But if I close
> thunar before unplugging the stick umount works fine.

Automatic umounting is neither intended nor safe. The reason is obvious:
To guarantee data consistency and proper functionality of the operating
system, the file system has to be removed _before_ the underlying device
is. This obviously cannot happen automatically.
 
Old 10-07-2010, 05:08 PM
Benjamin Sambale
 
Default umount usb stick via udev

Am 07.10.2010 17:32, schrieb Thomas Bächler:

Am 07.10.2010 17:18, schrieb Benjamin Sambale:

I managed to mount my usb stick automatically via udev rules (hal isn't
running). However, if I unplug the stick while thunar is open, the
umount command hangs. After that I can't even reboot. But if I close
thunar before unplugging the stick umount works fine.

Automatic umounting is neither intended nor safe. The reason is obvious:
To guarantee data consistency and proper functionality of the operating
system, the file system has to be removed _before_ the underlying device
is. This obviously cannot happen automatically.



Thanks for the reply. I know that unplugging the stick before umounting
is kind of "unsafe". However, I never had problems with this and of
course I do not unplug while files are get written. By the way the udev
page on archwiki also suggests umounting in a udev rule. Finally, as I
wrote before everything works if I close thunar before. And using hal it
works in all cases anyway.

So, I'm still grateful for further hints.
 
Old 10-07-2010, 06:00 PM
Sergey Manucharian
 
Default umount usb stick via udev

Hi Benjamin,

Excerpts from Benjamin Sambale's message of Thu, 07 Oct 2010 19:08
+0200:

> Am 07.10.2010 17:32, schrieb Thomas Bächler:
> > Am 07.10.2010 17:18, schrieb Benjamin Sambale:
> >> I managed to mount my usb stick automatically via udev rules (hal
> >> isn't running). However, if I unplug the stick while thunar is
> >> open, the umount command hangs. After that I can't even reboot.
> >> But if I close thunar before unplugging the stick umount works
> >> fine.
> > Automatic umounting is neither intended nor safe. The reason is
> > obvious: To guarantee data consistency and proper functionality of
> > the operating system, the file system has to be removed _before_
> > the underlying device is. This obviously cannot happen
> > automatically.
> >
>
> Thanks for the reply. I know that unplugging the stick before
> umounting is kind of "unsafe". However, I never had problems with
> this and of course I do not unplug while files are get written. By
> the way the udev page on archwiki also suggests umounting in a udev
> rule. Finally, as I wrote before everything works if I close thunar
> before. And using hal it works in all cases anyway.
> So, I'm still grateful for further hints.

Thunar depends on HAL, so probably it is not correct to use it without
HAL, and the following is from http://thunar.xfce.org "Use the correct HAL property to determine
whether a given volume or device requires eject"

Cheers,
Sergey
 
Old 10-07-2010, 06:52 PM
Jan de Groot
 
Default umount usb stick via udev

On Thu, 2010-10-07 at 12:00 -0600, Sergey Manucharian wrote:
> Thunar depends on HAL, so probably it is not correct to use it without
> HAL, and the following is from http://thunar.xfce.org "Use the correct
> HAL property to determine
> whether a given volume or device requires eject"

It can be used without hal, but not in the way that you can unplug a
device without unmounting it. There's some technological difference
between unplugging with and without hal.

With hal:
- device mounted
- thunar open
- device ejected without unmount
- hal receives uevents and knows the device is dead
- hal tells thunar that device is dead
- thunar (and other hal or udisks-enabled programs) tries to close all
references to the mountpoint
- hal unmounts the dead device

Now if you do that without hal, the point where hal detects that the
device is dead and thunar getting to know that has to be done by
yourself. If you forget that, you're screwed.
 
Old 10-07-2010, 07:35 PM
Fess
 
Default umount usb stick via udev

On 17:18 Thu 07 Oct , Benjamin Sambale wrote:
> Dear arch users,
>
> I managed to mount my usb stick automatically via udev rules (hal isn't
> running). However, if I unplug the stick while thunar is open, the
> umount command hangs. After that I can't even reboot. But if I close
> thunar before unplugging the stick umount works fine.
> Here is my udev rule:
>
> SUBSYSTEMS=="usb", ATTRS{serial}=="07A10809D5B952B9", KERNEL=="sd*",
> SYMLINK+="unistick%n"
> SUBSYSTEMS=="usb", ATTRS{serial}=="07A10809D5B952B9", KERNEL=="sd*",
> ACTION=="add", RUN+="/usr/bin/sudo -u benjamin /bin/mount
> /media/unistick"
> SUBSYSTEMS=="usb", ATTRS{serial}=="07A10809D5B952B9", KERNEL=="sd*",
> ACTION=="remove", RUN+="umount /media/unistick"
>
> And here is the corresponding line of fstab:
>
> /dev/unistick1 /media/unistick vfat rw,noauto,user,utf8,noatime
> 0 0
>
> Thanks for any help,
> Benjamin


use -l(lazy) option to umount
--
 
Old 10-07-2010, 07:48 PM
C Anthony Risinger
 
Default umount usb stick via udev

On Thu, Oct 7, 2010 at 10:18 AM, Benjamin Sambale <bsambale@gmx.de> wrote:
>
> *Dear arch users,
>
> I managed to mount my usb stick automatically via udev rules (hal isn't running). However, if > I unplug the stick while thunar is open, the umount command hangs. After that I can't
> even reboot. But if I close thunar before unplugging the stick umount works fine.
> Here is my udev rule:
>
> SUBSYSTEMS=="usb", ATTRS{serial}=="07A10809D5B952B9", KERNEL=="sd*", SYMLINK+="unistick%n"
> SUBSYSTEMS=="usb", ATTRS{serial}=="07A10809D5B952B9", KERNEL=="sd*", ACTION=="add", RUN+="/usr/bin/sudo -u benjamin /bin/mount /media/unistick"
> SUBSYSTEMS=="usb", ATTRS{serial}=="07A10809D5B952B9", KERNEL=="sd*", ACTION=="remove", RUN+="umount /media/unistick"
>
> And here is the corresponding line of fstab:
>
> /dev/unistick1 * * * * */media/unistick vfat rw,noauto,user,utf8,noatime * 0 * * *0
>
> Thanks for any help,
> Benjamin

you could maybe look into autofs, since it can automatically unmount
the device after a period of inactivity, and automatically remount
when activity starts again.

C Anthony
 

Thread Tools




All times are GMT. The time now is 12:55 PM.

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