I am working on a project, and for this I need to disable the aumounting of hard-drives in Ubuntu both at startup and when I plug an hard-drive.

I tried one solution with "edit-conf" disabling automount at org.gnome.desktop.media-handling but when I plug a hardrive ubuntu still mounts it an open a window even when I restart the computer in between.

There is also the fstab solution but the thing is I don't know in advance the UUID of the drive I don't want to mount automatically.

From want I understand there is the solution of editing an udev rule, but i'm not a specialist of that.

Run these two commands:
gsettings set org.gnome.desktop.media-handling automount 'false'
gsettings set org.gnome.desktop.media-handling automount-open 'false'

Or you can try it with a udev rule:
sudo nano /etc/udev/rules.d/85-no-automount.rule
Paste this line SUBSYSTEM=="usb", ENV{UDISKS_AUTO}="0" and save the file.
Reboot the system.

  • It didn't work, I executed the two command then reboote, and when i plugged my hard-drive, ubuntu stills mount it. – Didier Chavaroche Jul 16 '14 at 9:33
  • You can try the udev rule I added above. – Pabi Jul 16 '14 at 9:37
  • I didn't try the rule, but I have a question before, I plug the hard drives directly onto the SATA ports of my computer, How should I translate the rule? SUBSYSTEM=="sata"? – Didier Chavaroche Jul 25 '14 at 9:35

You can try to add the module to the blacklist:

sudo gedit /etc/modprobe.d/blacklist.conf


blacklist usb-storage


echo "blacklist usb-storage" | sudo tee -a /etc/modprobe.d/blacklist.conf

Enabling it later should just be:

sudo modprobe usb-storage

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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