If you have not already, we suggest setting your Plex username to something else rather than email which is displayed on your posts in forum. You can change the username at https://app.plex.tv/desktop#!/account
Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Using EXT or NTFS drives (internal or external) on Linux

ChuckPAChuckPA Posts: 20,315Members, Plex Pass, Plex Ninja, Plex Team Member Plex Team Member
edited July 2017 in Linux Tips

This document is of primary interest to anyone who has connected USB drives or has media on other internal drives but user plex can't access it due to Linux's default security mechanisms.

We will walk through the steps needed to add these external USB hard drives and internal hard drives, either formatted as NTFS or ext4, to your Linux configuration so Plex Media Server can access it.

Three disks will be added.

  1. An external ext4-formatted disk.
  2. An external NTFS-formatted disk.
  3. An internal hard drive which, in this example, happens to be NTFS formatted. It may also be HPFS formatted as Linux supports this natively.

Any disk formats which Linux supports, regardless of whether internal or external, can be added as shown below.

For reference purposes, this document was created using Fedora 24 Linux with the Gnome desktop and the Nautilus graphical file manager. Linux shell (command line) commands are bold face text.

A. Identify the disk(s) you want to add in the graphical disk manager

We get the device names, which we only need temporarily, using the command df

[chuck@lizum ~]$ df
Filesystem  1K-blocks      Used  Available Use% Mounted on</font></font>
/dev/sda5   128884388  19057076  103257328  16% /
/dev/sda2      487652    146960     310996  33% /boot
/dev/sda7   970737276 159145788  762923072  18% /home
/dev/sda1   831543292 149144996  682398296  18% /run/media/chuck/8E7025AD70259D49
/dev/sdb1  1922728752  11372564 1911339804   1% /run/media/chuck/Media-3
/dev/sdc1  1953480700  91720372 1461760328  26% /run/media/chuck/Chuck 2T

We have identified internal disk partition /dev/sda1 and external USB disks “Chuck 2T” and “Media-3” as the disks we want made available to Plex .
Now we use this information to obtain the rest of the information we need.

B. Get the ‘Block Id’ or device name (/dev/sdxx) of the disk partition(s) we are interested in

The following steps must be performed as the Super-User (root).

Get the label UUIDs for the USB drives (format does not matter) because their device names can change. This ensures they always mount at the same location. This step also provides us with the partition's format.
We will need this.

[chuck@lizum ~]$ su
Password:

[root@lizum chuck]# blkid /dev/sda1
/dev/sda1: UUID="8E7025AD70259D49" TYPE="ntfs" PARTUUID="000ac519-01"

[root@lizum chuck]# blkid /dev/sdb1
/dev/sdb1: LABEL="Media-3" UUID="50f1a141-bc8a-48ba-9b29-8a7bee8043e9" TYPE="ext4" PARTUUID="d456a9a6-9727-4143-be3e-f946400ec3ba"

[root@lizum chuck]# blkid /dev/sdc1
/dev/sdc1: LABEL="Chuck 2T" UUID="56EA5848EA582691" TYPE="ntfs" PARTUUID="542c75ae-01"

We now have both the UUID and partition formatting. Both pieces are needed below.

C. Create the locations where we will graft everything into Linux

The directory `/disks' has been chosen because Gnome "Nautilus" and Ubuntu (in general) claim exclusive access to anything found in /media. This prevents conflicts with those desktop components.

In this example, the username ‘chuck’ should be replaced with your actual Linux username . This allows you to maintain full ownership and control of the media without needing to use the superuser (root) account each time.

# The location 
[root@lizum chuck]# mkdir /disks /disks/c /disks/media3 /disks/chuck2t
[root@lizum chuck]# chown -R chuck:chuck /disks

[root@lizum chuck]# ls -la /disks
drwxr-xr-x   3 chuck chuck 4096 Jul 27 11:14 .
dr-xr-xr-x. 30  root  root 4096 Jul 27 11:14 ..
drwxrwxrwx   4 chuck chuck 4096 Jul 27 11:04 c
drwxrwxrwx   4 chuck chuck 4096 Jul 27 11:04 chuck2t
drwxrwxrwx   4 chuck chuck 4096 Jul 27 11:04 media3
[root@lizum chuck]#

D. create the entry in the file system table where to mount the disk each time the system boots

Edit the file system table Linux uses to mount all drives using your favorite text editor. Text editors commonly found are: vi, gedit, and xed.

Gedit is a graphical-based editor (WYSIWYG) and may be easier as it’s more like Microsoft editors.

For the USB drives:

Create lines for your system like the lines below, pasting UUID= value and TYPE (ntfs or ext4) from above, plus the directory locations just created where the external drives will always be found.

Best practice for USB drives is to use the UUID= method. USB drives will change physical device name from use to use. UUID= guarantees they always are mounted in the same location.

Use caution editing /etc/fstab. Mistakes can force you to take manual recovery/editing steps in command line mode ONLY** comment out the erred line(s) during recovery**

[root@lizum chuck]# vi /etc/fstab  (or use whatever text editor is available / favorite  and add the following lines, using your information)

# Addtions for external and internal drives
# Mount Media-3 (ext4)  at /disks/media3 for Plex
UUID=50f1a141-bc8a-48ba-9b29-8a7bee8043e9 /disks/media3  ext4  defaults,auto,rw,nofail 0 1

# Mount Chuck-2T (NTFS) at /disks/chuck2t for Plex
UUID=56EA5848EA582691                     /disks/chuck2t ntfs  defaults,auto,rw,nofail 0 1

# Mount /dev/sda1 directly  READ-ONLY,  and use the device name because it will never change
/dev/sda1                                 /disks/c       ntfs  defaults,auto,ro,nofail 0 1

Save and test.

[root@lizum chuck]# mount /disks/media3
[root@lizum chuck]# mount /disks/chuck2t
[root@lizum chuck]# mount /disks/c
[root@lizum chuck]# ls  /disks/*         # this will produce a lot of output if correct.  Be prepared

E. Restart the computer and verify all is as expected

[chuck@lizum ~]$ ls /disks/*    # The output here should be the same as the previous test above


[chuck@lizum ~]$ df 
Filesystem  1K-blocks      Used  Available Use% Mounted on</font></font>
/dev/sda5   128884388  19057076  103257328  16% /
/dev/sda2      487652    146960     310996  33% /boot
/dev/sda7   970737276 159145788  762923072  18% /home
/dev/sda1   831543292 149144996  682398296  18% /disks/c
/dev/sdb1  1922728752  11372564 1911339804   1% /disks/media3
/dev/sdc1  1953480700 491720372 1461760328  26% /disks/chuck2t

[chuck@lizum ~]$

F. Correct (set) Linux file permissions (ext4 drives only)

Drives are now mounted. Verify PMS can read them.
NTFS drives do not require permissions to be set for Linux because they use a different mechanism.
We will only address the ext4 formatted drive.

su
Password:

# change the default permissions to owner='rwx', everyone else to 'r-x' 
#  'x' means to traverse the directory to subdirectories & files
[root@lizum chuck]# find /disks/media3 -type d -exec chmod 755 {} \;

# change the default permissions to owner= 'rw-',  everyone else 'r-only'
[root@lizum chuck]# find /disks/media3 -type f -exec chmod 644 {} \;

G. Open Plex and add the external disk to your library

With the drives now mounted and permissions set, open PMS and add the media directories (folders) to the appropriate sections.

H. Update your Library
Manually invoke a Library update if you configuration isn’t configured to do so.

Please DISABLE Verbose logging until requested

Please search before posting

Primary support forums: Linux, Synology, and QNAP

Please remember to report back. This benefits others.

Useful links

 Installation and Basic Setup |  Media Preparation (How to name your media files)  |  Linux Permissions 

 Handling TV Specials | Handling Movie extras  |  Nas Compatibility List

 Reporting Plex Server issues | Plex Media Server FAQ | Linux Tips

 

Other useful guides: Local Subtitles | The Plex "dance" | Synology FAQ | PMS Release Announcements

Hosts: Fedora, QNAP, Synology, most Linux distros in VM

No technical support via PM unless offered

Please remember to mark the appropriate answer(s) which solved your issue.

 
This discussion has been closed.