Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Ubuntu Server 12.04.03 LTS (without GUI) and wrote an udev rule:

KERNEL=="sd?1", SUBSYSTEMS=="usb", ATTRS{product}=="Mass Storage Device", RUN+="/bin/mount /dev/%k /mnt/usbdrive"

This is works well, but then I want to unmount the drive with this command:

sudo umount /mnt/usbdrive

But it isn't work, and there isn't any error message. What can I do?

share|improve this question
No error message after a command usually indicates success. What exactly causes you to believe that it doesn't work? – Robie Basak Sep 3 '13 at 11:41
up vote 0 down vote accepted

You can try this: Append these rules into your .rules file, you've created:

 ACTION=="remove" KERNEL=="sd?1" RUN+="/bin/umount /dev/%k /mnt/usbdrive
 ACTION=="remove" KERNEL=="sd?1" RUN+="/bin/rmdir /mnt/usbdrive
share|improve this answer
Thanks, I'll try that. But I think I need to add mkdir to my "add" action too. Right? – Roberto Sep 3 '13 at 12:17
yes, you've do that ...! :) try it, and tell the result ..! – sumit.murari Sep 3 '13 at 17:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.