Simply use Linux USB drives with Plex


Plex is straightforward to put in and use, and it performs marvelously. One factor that drives new customers loopy although, is attempting to entry media on exterior USB drives. Here’s the simple approach.

Understanding how libraries work is your key to success

The well-known Plex media server organizes your media in libraries. These are collections of various media varieties, corresponding to motion pictures, TV exhibits, images, and so forth. You add directories containing your media to your libraries. The directories will be on native arduous drives, exterior mounted USB drives, or another network-accessible location. These directories are known as sources.

On Linux, USB drives have to be mounted earlier than they are often accessed. That’s wonderful, we will use customary Linux methods to do that. But plex has an additional requirement.

Plex creates a Linux person known as plex. This person should have entry to the media. Time and once more I’ve heard how this stumbling block drives individuals to surrender. After floundering in stormy seas of permissions and file and listing possession, they abandon ship.

The actuality is, it’s simpler to perform than you may assume.

Installing Plex

Keep it easy

The set up of Plex performs a significant half in whether or not you succeed. I like to recommend you utilize the official Plex set up recordsdata. Snaps, Flatpaks, and the variations in distribution repositories didn’t work for me. Your mileage might fluctuate however, fairly often, the plex person wasn’t created. Without the plex person, you’re sure to fail.

The solely exception was the Manjaro and Arch model within the Arch User Repository, or AUR. That labored completely. You’ll want an AUR helper tool like yay to make use of the AUR.

Once you have got yay, you should use this command:

yay -S plex-media-server

For Ubuntu and Fedora, you’ll get the perfect outcomes utilizing the official RPM and DEB recordsdata. On Fedora, this command retrieves the most recent RPM on the time of writing.

wget https://downloads.plex.tv/plex-media-server-new/1.41.0.8994-f2c27da23/redhat/plexmediaserver-1.41.0.8994-f2c27da23.x86_64.rpm
sudo dnf set up plexmediaserver-1.41.0.8994-f2c27da23.x86_64.rpm -y

On Ubuntu, you’ll want to concern a sequence of instructions. It may look so much, but it surely’s only a case of reduce and paste. If you’ve simply put in Ubuntu, be sure to replace and improve first, with:

sudo apt replace
sudo apt improve

You may have already got cURL put in, however I’ve included the command in case you don’t. Don’t skip the replace command earlier than you carry out the ultimate apt set up command.

sudo apt set up apt-transport-https
sudo apt set up curl
curl https://downloads.plex.tv/plex-keys/PlexSign.key | gpg --dearmor | sudo tee /usr/share/keyrings/plex-archive-keyring.gpg >/dev/null
echo deb [signed-by=/usr/share/keyrings/plex-archive-keyring.gpg] https://downloads.plex.tv/repo/deb public essential | sudo tee /and so on/apt/sources.listing.d/plexmediaserver.listing
sudo apt replace
sudo apt set up plexmediaserver
The output from the Plex installation routine on Ubuntu, with the plex user highlighted.

OK, that’s Plex put in. On all distributions, we’ve to allow and begin the plexmediaserver daemon:

sudo systemctl allow plexmediaserver
sudo systemctl begin plexmediaserver
Starting and enabling the plexmediaserver daemon, with systemctl.

Creating the mount level

Make your USB drive seen to Plex

We have to create a mount level that’s owned by the Plex person. I named my mount level ‘plex-usb’, and it’s within the root listing. Don’t create it in your house listing.

sudo mkdir /plex-usb
sudo chown plex:plex /plex-usb
ls -ld /plex-usb/
Creating a mount point called plex-usb that is owned by the plex user.

The chown command adjustments the person and group possession of the listing to ‘plex.’ We use ls to verify these adjustments.

Mounting the USB

And overcoming confusion

My USB drive was named Silver when it was formatted. It exhibits up with that identify once I plug it in. It holds two directories known as Movies and Shows.

The contents of the USB drive.

We want to search out its Universally Unique Identifier, or UUID. We’ll pipe the blkid command into grep and search for /dev/sd units. These are recognized as sda for the primary drive, sdb for the second, and so forth.

sudo blkid | grep /dev/sd
The outpout from the blkid command with the details of the USB drive highlighted.

In my case, the USB drive is /dev/sdb. We have to be aware of the UUID and the Type. The UUID of my drive is ‘b7ea748e-2df0-450e-922b-bf9d81e534c3’ and its Type is ‘ext4.’

If you have got problem recognizing your drive, take away it, then run the blkid command, as above. Open one other terminal window, insert your USB drive, and run the blkid command once more. You can then search for variations between the 2 units of output.

We have to edit the /etc/fstab file to mount our USB drive on the /plex-usb mount level at any time when the Plex pc boots.

Use your favourite editor, and open the /and so on/fstab file.

sudo gedit /and so on/fstab
Launching an editor to edit the /etc/fstab file.

Add this line on the backside of your fstab file. Use the UUID and Type from your personal drive, after all, and the identify and path of your personal mount level.

/dev/disk/by-uuid/b7ea748e-2df0-450e-922b-bf9d81e534c3 /plex-usb ext4 defaults 0 0

You can separate the fields with areas or tabs.

The /etc/fstab file in an editor, with the new line added and highlighted.

Save your adjustments and reboot your pc. When you log in, it is best to have the ability to navigate to your mount level and see your media.

The USB drive mounted on the plex-usb mount point.

Counterintuitively, ls now stories the mount level belongs to person dave-mckay.

ls -ld /plex-usb/
ls -l /plex-usb/
The apparent owner of the USB drive is the regular Linux user.

This is as a result of the basis of the USB drive has been overlaid on the mount level. But, beneath the floor, the underlying mount level is definitely owned by the plex person, which we verified earlier. This “twin possession” is how the plex person can entry the USB drive.

Use the USB libraries in Plex

You’re nearly carried out

In your internet browser, navigate to localhost:32400/internet and undergo the same old Plex start-up screens. When you get to the Server Setup, Organize Your Media web page, click on the “Add Library” button.

The Server Setup page with the Add Library button highlighted.

We’re going so as to add a supply of flicks, so click on the Movies button.

The Select Your Library Type page with the Movies button highlighted.

You can edit the identify, and select a language.

The Name and Language fields and their default settings.

I’m proud of the defaults, so I clicked the Next button. On the subsequent web page, click on the “Browse For Media Folder” button.

The Add Folders To Your Library page with the Browse For Media Folder button highlighted.

On the Add Folder web page, click on / for the basis listing.

The Add Folder page with the root directory highlighted..

Scroll via the listing of directories on the suitable, till you see your mount level.

The Add Folder page with the mount point highlighted.

Click it while you see it.

The Add Folder page with the directories inside the mounted USB drive listed.

Scroll again up, and also you’ll see the directories in your mounted USB drive. Click the Movies listing.

The Add Folder page displaying the contents of the Movies directory.

You’ll see the contents of the listing. Click the Add button.

The Add Folders to Yor Librray page with the Add Library button highlighted.

You’ll get an opportunity to assessment your decisions. I’m including a listing known as /plex-usb/Movies to this library, which is appropriate. Click the Add Library button.

The Server Setup, Organize Your Media page with the new Library highlighted.

The new library is listed as a configured supply.

To add the TV Shows, we comply with the identical process. Click Add Library > TV Shows > Next > Browse For Media Folder > root listing “https://www.howtogeek.com/” > plex-usb, Shows > Add, Add Library.

Now we’ve obtained two libraries listed. Click Next.

The Server Setup page with the Next button highlighted.

Click Done.

The Server Setup page with the Done button highlighted.

Your media can be scanned, recognized, and added to the Plex database, and located underneath the identify of your Plex server.

The contents of the Movies directory on the mounted USB drive displayed as playable media in Plex.

A phrase about Jellyfin

The super-free Plex rival

Jellyfin capabilities equally to Plex. To add exterior USB drives to Jellyfin, use the identical general course of.

Install Jellyfin, and create the mount level, say /jellyfin-usb.

sudo mkdir /jellyfin-usb

Make the jellyfin person the proprietor of the mount level.

sudo chown jellyfin:jellyfin /jellyfin-usb

Add an entry to /and so on/fstab to mount the USB drive to the mount level.

Showtime!

You’re all set to look at media saved in your exterior drive.

Remember to unmount your USB drive earlier than eradicating it. The best solution to apply it to one other pc after which reattach it to your Plex server, is to shutdown your Plex server, use your drive elsewhere, plug it again in, then boot up your Plex server.



Source link