Page 1 of 1

Auto-mounting external USB devices on /mnt/mydir

Posted: Wed Jul 08, 2020 3:23 pm
by skcasb
Hi all,

It is possible to mount a generic USB stick in a folder other than /media/pi/ (for example to /mnt/mydir) and disabling the windows popup shown on display when the usb stick is inserted ?

Is it possible to use an udev rule without modifying fstab?

Do you have any examples that can help me?

Thank you.

Regards.

Re: Auto-mounting external USB devices on /mnt/mydir

Posted: Wed Jul 08, 2020 3:55 pm
by GlowInTheDark
The straightforward way to do this is to find the settings dialog in PCMANFM (aka, "The File Manager in Raspbian") and figure out how to disable automounting.

After you do this, then things will no longer automount (you may have to reboot for this to take effect - I am not sure). Now, you can do all your own mounting and unmounting. Fun, fun, fun!

Another way, that I've been playing with lately, is to use mount's --bind option, to create an "alias" of the original mount (the one in /media/pi). I do this:

$ cd
$ mkdir MyDrive
$ sudo mount --bind /media/pi/whatever-it-is MyDrive

Now, ~/MyDrive is mounted to the same underlying device as the thing under /media/pi. This works quite well for me.

Re: Auto-mounting external USB devices on /mnt/mydir

Posted: Wed Jul 08, 2020 4:35 pm
by GlowInTheDark
Oh, and a couple other comments, regarding annoying things that come with the automount facility.

1) As far as I can tell, there's no way to disable the popup.

2) According to "jojopi" (I hope I spelled that right), it is possible to disable the annoying "You have not properly ejected it" message - by commenting out a certain stanza in one of the config files. I have not been able to verify this yet (because of a series of things - that boil down to "It is a pain to reboot the machine in question, so I'd rather not reboot it just to test this thing").

Re: Auto-mounting external USB devices on /mnt/mydir

Posted: Wed Jul 08, 2020 7:14 pm
by bjtheone
Another possible approach would be to punt pcmanfm and switch to a different file/desktop manager, if you really hate the pop up dialog. I am not sure if it is coming from pcmanfm or is part of the Desktop Manager (ie LXDE).

I am running Raspbian Lite + Mate, and using Caja as a file manager. I still get automounting without the popup dialogs.