How can I prevent the automatic mounting of an USB storage?

Asked by Gergely Máté

I have a wireless broadband modem I attach to my computer via USB. The broadband modem works also like an USB storage, it contains various software that is required by some other operating systems I don't use, but not required by Ubuntu which I use all the time. Whenever I plug my broadband modem into my computer, Ubuntu mounts the storage part of it to the filesystem, and an icon representing the storage appears on the desktop. Although this would be desired functionality in cases involving other USB storage devices, it is not desired in the case of the broadband modem, as I can't use the storage on it in any useful way. I use my desktop intensively, and I don't like that unusable icon there, so every time it appears, I unmount it manually from the context menu of GNOME. This is a repetitive task I do more than once a day.

How can I prevent that icon from appearing on my desktop? How can I prevent my wireless broadband modem from being automatically mounted as a recognized storage?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
delance
Solved:
Last query:
Last reply:
Revision history for this message
Vitaliy Kulikov (slonua) said :
#1

u can easy do it by command-line

$ gconftool -s /apps/nautilus/preferences/media_automount -t bool false

also, u can run gconf-editor and navigate by tree to discover more settings and descriptions.

note; don't use 'sudo', in fact settings will be set for sudo only.

Revision history for this message
Gergely Máté (sportember) said :
#2

Thank you for your answer. As I understand, this setting in gconf would disable automatic mounting in general. However, I like automatic mounting when I insert an USB storage, for example my OGG music player. The only device I would like to disable automatic mounting for is my USB wireless broadband modem. How can I disable automatic mounting of one specific device but not others?

Revision history for this message
Best delance (olivier-delance) said :
#3

One tortuous solution could be to make mount fail.
In /etc/fstab, declare the USB key with a mount point who doesn't exist.
The automount will not try to mount this key.
And the failure of mounting will prevent display (and mounting) of USB disk.
If you need help, I can try with one of my keys.

Revision history for this message
Gergely Máté (sportember) said :
#4

Thank you, delance, you pointed me to the right direction! Problem seems to be solved.

For historical reasons:
I did a "man fstab", and read what found there. I also did a "less mtab" to see how my device is seen by the system. After that, I added the following line to /etc/fstab :
LABEL=VMCLite\040V3.2.2.201 none none noauto

This seems to be a correct solution. The device is identified by it's label, and it is not mounted because one of the two 'none'-s. 'none' is the mount point, and 'none' is the file system type to use...

Annoying icon seems to have gone... Thank you again for your help!

Revision history for this message
Gergely Máté (sportember) said :
#5

Thanks delance, that solved my question.

Revision history for this message
Gergely Máté (sportember) said :
#6

One more update for historical reasons: after some days, a "regression" occurred, as I found that my system boots with swap disabled - and hence becomes unresponsive when I use many memory at once. Such thing never happened before, so I checked my /etc/fstab again, and found that via some mysterious ways the line I added causes the problem. I replaced it with
LABEL=VMCLite\040V3.2.2.201 /dev/null none noauto 0 0
thus setting the mount point to be /dev/null instead of none, and now all seems to be fixed.

(Probably mount thinks that a device IS swap when it's mount point is set to "none". Or some other mystery was here.)