20

I need automount for internal and external storages. On boot and on connect. For now I have to click in file manager to make it accessible which is weird for 2016! I know that only udev can be involved in it. But cant find a way for modern ubuntu, all tutorials bit out of date(used HAL and so on). I don't want use fstab also. P.S. This should work without any 'heads' like KDE, Unity, Gnome. Just from runlevel 3 and so on. Minimum requirements. (no automount daemon).

Maximus
  • 671

1 Answers1

24

You can do this in the Disks application, it is preinstalled, search in the dash and open it.

Now click the partition on the left and under the diagram in the center click the little cog icon enter image description here

Now choose edit mount options and make the settings, Automatic mount > off, Mount at startup > on, Show in interface > on and Require additional authorization to mount > off.

enter image description here

This will mount the partition as your user at boot and show it in the launcher, you can also change the name and stuff here too.

As requested by OP here is a way to do this via terminal

First we need the UUID of the disk to be mounted, find it with

blkid /dev/sdX

Replace the X with the correct ID of course, the UUID looks like this

40e554eb-6421-4813-88ea-3882a3a7a153

Now open this file

sudo nano /etc/fstab

Now add this line to the end

UUID=40e554eb-6421-4813-88ea-3882a3a7a153 /mnt/Disk auto nosuid,nodev,nofail,x-gvfs-show 0 0

Change the UUID for yours and /mnt/Disk should be changed to where you want to mount the disk and save the file.

Mark Kirby
  • 18,529
  • 19
  • 78
  • 114
  • 1
    No in headless run it don't. So this is no solution at all. – Maximus Jun 05 '16 at 10:56
  • 5
    Where does it say that in you question? It does not, update your question with exactly what you need. Also how do you "click file manger" in a headless? Your question heavily imply you have a GUI. – Mark Kirby Jun 05 '16 at 10:58
  • 1
    Well I have a GUI but it should work in any condition. So as lowlevel a possible – Maximus Jun 17 '16 at 19:59
  • Even headless, you can graphically log in by installing, for example, the x11vnc server on the headless computer, and using a VNC viewer on another computer to graphically log in with GUI support. Ex: for Windows, UltraVNC is great. Here's an example of doing the whole process: http://www.megaleecher.net/Raspberry_Pi_VNC_Setup – Gabriel Staples Aug 29 '16 at 18:57
  • This doesn't work for me. Might be because the partitions are encrypted? – user10853 Nov 02 '16 at 13:56
  • Could be @user10853 does your encryption require you to enter the password to mount the drive? That would make auto mounting impossible. – Mark Kirby Nov 02 '16 at 13:59
  • @MarkKirby When I usually mount the partitions I do not get asked for the password. I was asked for the password when I changed the the mount options in Disks. Why is it impossible? Aren't the passwords managed in the keyring? – user10853 Nov 02 '16 at 14:03
  • When you change the mount point, you need your root password. This is because the drive is mounted to a root owned directory. – Mark Kirby Nov 02 '16 at 14:13
  • @Maximus I seem to of over looked updating this based on your request, I know it is late but see the edit, if you still care. – Mark Kirby Nov 02 '16 at 14:14
  • @MarkKirby I'm still looking for good universal solution. For now I have the udev script which actually do the job, BUT has an issue it interfere with GUI mount system and broke it. So basically problem is how to distinct 'internal' SATA devices from others like 'USB' storages. – Maximus Nov 28 '16 at 08:36
  • @MarkKirby There is a space which shouldnt' be there in UUID= 40e554eb-6421-48... – mook765 Apr 25 '17 at 12:48
  • Doesn't really work for me, doesn't mount the same way it used to, mount point is different and if I change it to the same one - it doesn't mount at all – Aurimas Oct 31 '17 at 21:14