1

I'm running a vanilla install of Ubuntu 16.04. There's a USB drive that I want to access through Plex but it's not available to Plex (the media server is unable to access files) until I have manually navigated to the drive in Nautilus. I think the act of navigating to it is what triggers the automount.

In addition to Plex problems I am unable to cd into or ls the directory from terminal until it has been opened in Nautilus. I am told "Permission Denied".

How can I have the drive automounted and available after startup with no manual intervention in Nautilus?

1

2 Answers 2

3

I run Plex server at home, and the only way that I was able to solve this with USB hard drives was to manually add them to the /etc/fstab file so they would come up on the same mount after every reboot.

First, get the UUID of the partition of the drive:

blkid

Mine that we are going to use is a Seagate external drive.

~$ blkid
/dev/sda1: LABEL="Seagate Backup Plus Drive" UUID="6AAA4323AA42EB61" TYPE="ntfs"

Or you can use lsblk:

:~$ lsblk -o NAME,LABEL,TYPE,UUID
NAME   LABEL                     TYPE UUID
sda                              disk 
└─sda1 Seagate Backup Plus Drive part 6AAA4323AA42EB61

We can see the UUID there of 6AAA4323AA42EB61. Now, we create a mount point where we are going to have that drive mount every time:

sudo mkdir -p /media/Seagate

We will now add the information to the /etc/fstab file so that every time we boot the computer it will mount that drive in the same location. We will add a nofail option so that if the drive is disconnected or not powered on the boot process will still complete.

First, backup your /etc/fstab file in case something goes wrong.

sudo cp /etc/fstab /etc/fstab.orig

Then use your favorite editor with sudo access and add the following line to /etc/fstab. Or I will put a line below it that will allow you to add it via an echo line:

UUID=6AAA4323AA42EB61 /media/Seagate ntfs defaults,nofail 0 0

That line can be added via echo like so:

sudo bash -c 'echo "UUID=6AAA4323AA42EB61 /media/Seagate ntfs defaults,nofail 0 0" >> /etc/fstab'

You can then run sudo mount -a to mount the drive in that location now, or you can reboot the host and it should come up in the same location every time now.

Hope this helps!

7
  • 1
    As you beat me to this answer I'll show my WIP where I found lsblk --output NAME,TYPE,UUID easier to read than blkid. Good answer +1 Jul 26, 2017 at 17:22
  • @WinEunuuchs2Unix That is a good one to use. I have got so used to using blkid I seem to default to it. =)
    – Terrance
    Jul 26, 2017 at 17:23
  • @Terrance I very much appreciate your input. Curiously my drive does not appear in the output from blkid. However it does appear in lsblk as sdc1 8:33 0 1.8T 0 part /media/<username>/toshiba_ext. blkid has no entry for sdc, so how can I get the drive's UUID?
    – tomfumb
    Jul 26, 2017 at 17:29
  • @tomfumb I updated my answer to include a command with lsblk.
    – Terrance
    Jul 26, 2017 at 17:33
  • 2
    This can be done in GUI too: Disks > Edit mount points.
    – user692175
    Jul 26, 2017 at 17:35
0

Basic CLI steps lsblk -> /etc/fstab

The basic steps are to list your block devices:

$ lsblk -o NAME,TYPE,LABEL,UUID
NAME   TYPE LABEL                    UUID
sda    disk                          
├─sda1 part System Reserved          FAC07A55C07A1859
├─sda2 part KSX_Win7                 2EBA8445BA840B91
├─sda3 part KSX Win 8.1              8C3ADAA93ADA8F96
└─sda4 part                          
sdb    disk                          
├─sdb1 part ST9_Win7                 C2F48A08F489FF43
├─sdb2 part ST9_Linux                bf80a37d-dfad-4df1-b8b1-a67ef2a9ab66
└─sdb3 part                          f7ca38bd-ccf1-4d61-b54b-017b1493d1b4
sdc    disk                          
├─sdc2 part F9m_Win7                 5824BF4E76D68BE2
├─sdc3 part F9m_Linux                d02dc21d-dcb2-478e-9f7d-9a3331931de4
└─sdc4 part                          09606fe6-c131-43fc-9ebc-be05a96e1c1d
sdd    disk                          
├─sdd1 part WHITEBLACK               080F-96E9
└─sdd2 part                          
sr0    rom  Ubuntu 14.04.3 LTS amd64 2015-08-05-05-38-20-00

Then add the drive you want auto-mounted to /etc/fstab:

$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda3 during installation
UUID=d02dc21d-dcb2-478e-9f7d-9a3331931de4 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda4 during installation
UUID=09606fe6-c131-43fc-9ebc-be05a96e1c1d none            swap    sw              0       0

Basic GUI steps

The easiest way of auto-mounting drives is using Disks utility accessed from Dash (first option on launcher):

Disks GUI

Click on a drive, click on a partition and then click on the nearly invisible gears icon below it after the "play" and + icons. Then select Edit Mount Options... from the drop-down menu:

Disks Generic Flash Drive

Here you can hide the partition in Nautilus, prevent auto-mounting or allow auto-mounting (but it doesn't update /etc/fstab). In this example the "Generic Flash Disk" is selected and you can see by default it's not auto-mounted.

Many answers address auto-mounting

This answer will hopefully serve as a "sign post" to finding other answers with more detailed steps for your particular environment.

The list is a fraction of thousands of questions because only questions with answers are included. Duplicates are also included if they have good answers.

Questions about "unmounting" are not included to keep the list shorter. Questions requiring usbmount, a third-party program for mounting USBs that was required for a short period of time, are omitted. Questions about mounting network drives through configuration files other than/etc/fstab are omitted. Questions with specific problems on a specific platform are omitted.

There are thousands of questions about mounting particularly with ntfs (Windows) but hopefully this list will provide a short cut to some.

Please feel free edit this answer to add and subtract to this list as you think appropriate. My eyes are bloodshot from reading so many Q&A's and am unlikely to maintain it.

Creating this list of links took a couple of hours but it won't solve everyone's problems. Some will still have to sort through search lists of thousands of Q&A's. Indeed this list is almost exclusive to Ask Ubuntu and even more answers are on the broader internet and other Stack Exchange sites.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .