Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

1 Answer 1

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 ..! – proton1h1 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.