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
  • 169,590
pubpub
  • 29
  • 1
  • 2
  • 1
    Welcome to Ask Ubuntu pubpub! It's great that you are posting this, although you put in the question/answer form. So you should [edit] your post to only make it a "question", and then answer your own question =). – Alaa Ali Aug 10 '13 at 17:59
  • Since there is no question, shouldn't this be on a personal blog? – mikewhatever Aug 10 '13 at 17:59
  • Thanks for your help. I have no blog and I found askubuntu so usefull when you have a question that I prefered to post data on it ;) – pubpub Aug 13 '13 at 10:20

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
  • 169,590