Creating an Odroid Server Part 3 - Solving external drive issues in Ubuntu

Wow! So this has certainly been an experience thus far. It would seem that the easiest part of this whole exercise was installing Ubuntu Mate on the SD card. So up to this point I solved both the issue of the unattended upgrade service hogging the installer and I installed Samba. The next step was installing a media server for some of my movies and music collection. I chose Plex media server because it has a free service that allows users to access their collection outside the home network, and even share with friends and family. The biggest downside is that the mobile and tablet versions require a fee to unlock full access, although you could just use the internet browser on the device and case solved. So I won’t bore you with the ball by ball commentary. I'm sure you're saying, "Come on, Kevin. Give us the pain". Well as the title says, I ran into some issues when it came time for Plex to read my external drives. Plex did not have permission to read the drive contents.

Linux represents mounted drives as folders. These folders usually appear in the MNT or MEDIA folders. In my case they would appear inside the folder with the default username, Odroid, located in the media folder. What this meant was the user Odroid owned those folders and their content. Now there are a few ways I could solve this issue but the easiest by far was simply to remount the drives into folders that Plex had both user and group access.  

Time to fire up the good ol' terminal. First, I made a new folder inside my MEDIA folder.

sudo mkdir /media/plex

I created a folder name plex and inside that folder I made a few more folders that represented the different drives that would be mounted. Then 

sudo chown -R plex:plex /media/plex

The CHOWN command is used to change the owner and group owner of a file or directory.  Here I am saying that I want user PLEX and the group :PLEX to own the folder named plex. The R option means that I want this done recursively. Basically everything inside that folder  would have its ownership changed. Once done it was time to link our drives to the folders inside the main plex folder. 

sudo blkid

This command produces a list of connected storage devices. What I need was the UUID for each partition I wanted to add.

 

Above is the result of the blkid command. Each partition has a visible UUID. Taking note of the UUIDs the FSTAB file, found in /etc, needed to edited. Using Gedit.........or VIM (if you truly hate yourself) with superuser mode privileges, you can manually set the mounting point for each drive using their UUID.  On a new line in the FSTAB enter

UUID=ECEEC550EEC5142C  /media/plex/good_storage    ntfs    defaults,errors=remount-ro 0 

This line tells Linux a few things. It uses the UUID of the selected partition, it states where its being mounted to and file system of the partition. The last bit are options which assist with permissions and errors. Defaults is an option that represents a group of options i.e. rw, suid, dev, exec, auto, nouser, async. These give users ability to read, write and execute with elevated privileges. After I set that if an error with the partition occurred, it would attempt to remount in read only mode. The final zero tells any backup service to ignore this drive. I made a few more entries for all my devices before saving and closing the text editor. Then it was important to ensure that all devices entered were unmounted before entering the next command

sudo mount -a

which mount all the drives to their new position. Returning to the options in my Plex server and now I can view the files on my external drives. 


Note that the changes I made when mounting of my storage devices meant that I had to go back and update my Samba shares in the smb.conf. So now my Plex server is up and running, and I'm able to watch movies and listen to music.

So is this the end of our adventures in Linux? Certainly not. My next plan is to do some application development, and for this reason I will need a database. Not only that, but since a lot of our hard work was done via command-line, I think it's high time we allow for SSH access.

Post a Comment

Previous Post Next Post