[SOLVED] Media Storage for Plex LXC (Incompetent Noob Needs Help)

Oct 14, 2024
5
0
1
Preface: This is embarrassingly simple (take note of my username). My relevant experience is limited to configuring and installing klipper on my Voron and installing and Home Assistant OS on an old Dell Latitude E5440, the same machine I'm dealing with now. It has an i5-4200U and 4GB of DDR3L, just to give you an idea of how pathetic this setup is.

On that laptop, I have successfully installed Proxmox 8.2.2 with a VM of Home Assistant OS and a Plex LXC (unprivileged) courtesy of the tteck script. The HAOS is running great, but this is the first time I've dealt with either Proxmox or Plex and I'm having trouble figuring out how to get my downloaded media available to the Plex LXC. I actually also have a VM running OMV from my attempts to get something working, but I feel like that shouldn't be necessary?

I have an HDD in an external enclosure with my movies attached via a USB 3.0 port on the laptop. I thought I was on the right track by doing a device passthrough to my Plex LXC. I passed through /dev/sdb, /dev/sdb1 (the partition), and /dev/bus/usb/003/002 (all three because I was desperate for something to work). Of those, all were visible but only the latter was available to add as a library on the Plex interface, but Plex said it was empty.

Thus far I've avoided NFS, SMB, SSH, other black magic stuff, etc. because that's a whole other world that I'm ignorant to, but maybe you'll all tell me that it's going to be a necessary evil. Also note that I have no desire or need (or hardware overhead) for RAID, ZFS, or any other data integrity considerations, because I could lose it all and be fine grabbing another hdd and loading it with the movies.

I feel like this should be as simple as a dozen button clicks on the GUI given how simple this is, but IDK at this point.

I seem to have bitten off more than I can chew, but I'd appreciate some assistance if anyone can spare the time. Thanks in advance.
 
Welcome! If I understand correctly, you have a setup like so:
PVE host (Dell Latitude)
HAOS as a VM on PVE
Plex as a container on PVE
OMV as a VM on PVE
USB HD attached to the Dell.

You would like the USB HD to be passed through to the Plex container to be used for media storage. It already has a filesystem with media on it.

Sound good so far?

I think you need to do two things to get the media visible to Plex.
1) Pass through /dev/sdb (or appropriate drive) to the LXC. I recommend figuring out which device in /dev/disk/by-uuid/ on the PVE machine is the USB HD and passing that through. The sdX names can change if you add/remove drives (like more USB drives).
2) In the Plex container, mount the filesystem on /dev/sdb (or /dev/sdb1 if that exists) to a location you create, like /plex_media. I think this was the step that was missing when you tried passing /dev/sdb in. The device is passed through, but you still have to mount it.

If that works, you can make the mount permanent by adding it to /etc/fstab in the Plex container. You can use the "man fstab" command to learn more about the /etc/fstab file and how to add entries to it.

Otherwise, you can try mounting the drive in PVE (and adding it to /etc/fstab on the PVE machine) and passing the *directory* that you mounted to through to the Plex LXC.

Hopefully this helps!
Kellen
 
@kellen Thank you for helping me!

Yes, that is my setup. After reading your recommendations, I spent some time fiddling with it but still have some confusion.

1)Linux and CLI are still quite new to me, but I used the node console and the ls and cd commands to find dev/disk/by-label/Media, which I then passed through in the "resources" tab of the Plex LXC. I also passed through /dev/sdb1 which I got from the "disks" tab of the node.

I went to the Plex web interface and attempted to add a library, but when browsing for the media folder and navigating through either of the two passthrough paths the final "click", either Media or sdb1, are grayed out and not clickable.

I'm guessing the part that I'm still missing is what you said in "2)", which I unfortunately do not really understand. Even through my (admittedly poor) googlefoo, I don't understand the steps/process of mounting. I could really use and ELI5 of your "2)"

Thank you again
 
Happy to help! Confusion is totally understandable! :)

The ELI5 is that Linux (and other OSes) have a distinction between the *device* such as /dev/sdb1, which is the representation of the physical media and the *filesystem* on top of the device that organizes the raw storage into files.

Devices like /dev/sdb1 and /dev/disk/by-label/Media are called "block devices" since you read/write blocks to them. They are not super useful on their own. Computers put a filesystem on the block device to provide organization and an easier to use interface on the block device. This is the layer that provides "files" and "directories" or "folders". It provides a system (thus filesystem) for mapping blocks of data to files and vice versa.

The result is that in Linux, you need to have a block device (/dev/sdb1 for example) and then you need to "mount" the filesystem that lives on that block device. Your current issue is that you have passed through block devices, and Plex really only understands filesystems. Other OSes (and desktop Linuxes) auto-mount usually, which generally makes this step transparent to you as the user of the system.

If you have /dev/sdb1 available in the Plex container, try this:
mkdir /plex_media
mount /dev/sdb1 /plex_media

This creates a directory "plex_media" in the root "/" of the container filesystem. Then the mount command asks the system to read /dev/sdb1, and if there is a recognized filesystem present, load it up and make it accessible at the mount point/directory of /plex_media. If those two commands work without error, you should be able to "cd /plex_media" and "ls" to see your media.

If that works, you should be able to add the path/directory of /plex_media to Plex and it should see everything.

You can explore the mounted filesystems with the "df" command, I prefer "df -h" for human-readable numbers.

Let me know if that works. I tried to ELI5, but I may have drifted a bit.

Best of luck!
 
Wow that was an excellent write-up and I thank you for helping me learn rather than just feeding me commands.

I succeeded in creating the directory and mounting sdb1 to it, just as you instructed. I can "cd /plex_media/Movies" and then "ls", which spits out the list of movies on the hdd.

I was just sure that meant I would hop into the Plex interface and add /plex_media or /plex_media/Movies as the path for a library, but nothing appears to have changed from Plex's point of view as /plex_media doesn't show up.

My googling has once again proved fruitless, but it did make me wonder if I'm now up against a permissions issue or because of the "unpriviliged" container.

I've attached some screenshots on the odd chance they are useful.

I'm embarrassed to even be asking for more help at this point, but I'm clearly not qualified to be doing this.

I appreciate your help and patience with me thus far! I hope to not take up much more of your time!
 

Attachments

  • Screenshot 2024-10-18 150500.png
    Screenshot 2024-10-18 150500.png
    49.7 KB · Views: 14
  • Screenshot 2024-10-18 150550.png
    Screenshot 2024-10-18 150550.png
    47.9 KB · Views: 10
  • Screenshot 2024-10-18 150721.png
    Screenshot 2024-10-18 150721.png
    28.5 KB · Views: 10
  • Screenshot 2024-10-18 150839.png
    Screenshot 2024-10-18 150839.png
    39.2 KB · Views: 11
  • Screenshot 2024-10-18 150912.png
    Screenshot 2024-10-18 150912.png
    26.6 KB · Views: 9
Glad to be of assistance! We all start somewhere, and I consider myself fortunate to be able to help!

Thanks for the pictures, they shed some light on the situation.

It looks like you probably mounted the USB HD on the Proxmox server itself, not the Plex container. The Plex container then cannot see the mount. I think this because the "df -h" screenshot shows what looks suspiciously like a PVE root filesystem and EFI mount point, which I wouldn't expect to see in the container.

My Ubuntu 24.04 container looks like this with no extra disk:
Code:
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/fast-vm--100--disk--0  7.8G  665M  6.8G   9% /
none                               492K  4.0K  488K   1% /dev
efivarfs                           128K   55K   69K  45% /sys/firmware/efi/efivars
tmpfs                              7.8G     0  7.8G   0% /dev/shm
tmpfs                              3.2G  100K  3.2G   1% /run
tmpfs                              5.0M     0  5.0M   0% /run/lock

To fix this, first unmount the filesystem on the Proxmox host with "umount /plex_media" (yes, umount without the "n" :D ), then try getting a console on the Plex container by clicking on the container then finding "Console" :
1729302243099.png

Then, since you already passed the device in, as shown in your first screenshot, try the mkdir and mount commands again, but within the Plex container. At that point, the Plex Web UI should at least show you the directory /plex_media.

You might run into permissions issues at that point with either not being able to see the files in Plex or not being able to play the media even if you can see them. For that, a "ls -lah /plex_media" done from the Plex container will be useful.

Kellen
 
You sir, are the bee's knees! I feel a bit silly because yes, I did all that from the node shell rather than the Plex console.

I did as you said, with moderate success. As the screenshots show, creating the directory in the container went fine, but mounting /dev/sdb1 to it did not. After the fail I ran:
apt update
apt upgrade
apt install ntfs-3g (which was already at newest version)
apt install fuse (whatever that is)

and then I tried "mount /dev/sdb1 /plex_media" again, but this time got "mount: /plex_media: permission denied."

Like you said, I was at least able to add /plex_media as a path for a Plex library, but it shows as empty.


While this didn't get it going in the end, you did provide me the foundation I needed to improve my Googling and better understand what I found. What ultimately worked for me was seeing this thread.

I went back to the node shell and made sure I still had the /plex_media directory and then mounted sdb1 with "mount /dev/sdb1 /plex_media".

Then I did "nano /etc/pve/lxc/200.conf" because I'm somewhat familiar with vi and nano but not the "cat" thing from that other thread. Then I added "mp0: /plex_media,mp=/plex_media" as a line in the 200.conf file, exited and rebooted the Plec LXC.

Then in the Plex LXC console I used "cd /plex_media/Movies" (Movies is the folder on the drive) and "ls" to confirm that I could see my movies from the Plex LXC. From the Plex web interface I added a library using /plex_media/Movies, and to my relief everything was finally working!!!!

I typed that all out in detail to rehash my thoughts and help any other newbies that happen across this.

Thank you again for everything @kellen, as even with that other thread I couldn't have actually made it work without the help I had from you!
 
For future newbies, I just realized I hadn't yet accounted for the drive becoming unmounted after disconnecting and reconnecting it (either manually or via host reboot). As kellen mentioned in his first reply the sdb/sdb1 can change, in my case to sdc/sdc1 this time, and the drive does not automatically mount regardless.

I did what kellen suggested and looked up the drive's label by going to the node shell and entering "cd /dev/disk/by-label" and then "ls", which in my case showed the drive's label as "Media".

With that, I then mounted the disk (still in the node shell) using "mount /dev/disk/by-label/Media /plex_media" and rebooted the Plex LXC.

The thing that I'll still have to figure out is getting Proxmox to run that command or mount the disk automatically following boot and after detecting the drive being plugged in. I looked into what kellen said about editing /etc/fstab, but that quickly began to look daunting. So we'll see about that. For now I'll have to run "mount /dev/disk/by-label/Media /plex_media" and reboot the LXC every time I reboot the Proxmox host or disconnect the external drive to add media to it.