2

I used to work for a long time with ubuntu 10.10 and I changed to a recent machine so I had to move to Ubuntu 13.04. One feature I'm now missing is the auto umount of usb drives. I've not been able to find easy info on internet.

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407
pubpub
  • 29

1 Answers1

0

pubpub solution (after I edited his question):

Creating /etc/udev/rules.d/80-usb-autounmount.rules:

# Auto-unmount USB storage (on remove):
ACTION=="remove", SUBSYSTEM=="block", ENV{DEVNAME}=="/dev/sd??", RUN+="/usr/bin/logger  auto umounting  %k"
ACTION=="remove", SUBSYSTEM=="block", ENV{DEVNAME}=="/dev/sd??", RUN+="/bin/umount /dev/%k"
ACTION=="remove", SUBSYSTEM=="block", ENV{DEVNAME}=="/dev/sd??", RUN+="/bin/umount -lf /dev/%k"
ACTION=="remove", SUBSYSTEM=="block", ENV{DEVNAME}=="/dev/sd???", RUN+="/usr/bin/logger  auto umounting  %k"
ACTION=="remove", SUBSYSTEM=="block", ENV{DEVNAME}=="/dev/sd???", RUN+="/bin/umount /dev/%k"
ACTION=="remove", SUBSYSTEM=="block", ENV{DEVNAME}=="/dev/sd???", RUN+="/bin/umount -lf /dev/%k"*

Of course you still have to be carefull about opened files mainly in writing.

Hope it will help others.

Radu Rădeanu
  • 174,089
  • 51
  • 332
  • 407