Using other hard drives (Windows or Linux) with PMS
This How-To is written to help with Internal and External drives. It also is written to demonstrate how to cope with NTFS and EXT4 formatted drives. By logical extension, any format supported by Linux can be handled using the technique shown here. In all cases, the goal is to give user plex
permission to read your media files which Linux doesn’t allow by default due to its strict security model.
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.
- An external ext4-formatted disk.
- An external NTFS-formatted disk.
- 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
/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.
The following steps must be performed as the Super-User (root).
[chuck@lizum ~]$ sudo sh
Passwd:
[root@lizum chuck]#
B. Get the ‘Block Id’ or device name (/dev/sdxx) of the disk partition(s) we are interested in
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.
[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]#
Having created the directories as root, verify empty (unmounted) directory permissions are 0755
before mounting
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, nano, 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. (Both Redhat & Debian shown here)
# See where the disks are currently mounted and unmount
# (This is from Redhat)
df
umount /run/media/chuck/Media-3
umount /run/media/chuck/Chuck2T
# (This is from Ubuntu/Debian)
df
umount /media/chuck/Media-3
umount /media/chuck/Chuck2T
# mount each one individually to verify no errors
[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
/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.
[chuck@lizum ~]$ 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.