Resource icon

Scripted Plex installation

jweldon

Dabbler
Joined
Apr 17, 2022
Messages
19
It is the same IP as the Freenas. Should i tried setting to one above the freenas ip but it didn't ping.
 

jweldon

Dabbler
Joined
Apr 17, 2022
Messages
19
I am sorry i was mistaken it is .244. So it does have its own IP, however it does not respond to pings.
 

jweldon

Dabbler
Joined
Apr 17, 2022
Messages
19
All good! I checked out the Vswitch settings on the vmware and made the change and now it works!
 

-fun-

Contributor
Joined
Oct 27, 2015
Messages
171
Hi Dan! I installed the jail using your script (on a TrueNAS-13.0-U5.1) just fine. It seems that plex is running fine, however there is a problem with the mount of my media dataset into the jail. This is probably not even plex related.

I configured /mnt/flospool/media as a media path and it mounted just fine into /media inside the jail. Inside /media I can see directories (movies, tvshows, music, etc) as expected. However while there are many directories below /mnt/flospool/media/movies inside the jail /media/movies appears just empty. Permissions and ACLs allow at least read access to everyone. What puzzles me is that /mnt/flospool/media/movies has the same permissions and ACLs as the directories within this path.

fstab -l shows:
Code:
+-------+-------------------------------------------------------------------------------------------------------------------------------------------+
| 15    | /mnt/flospool/media     /mnt/flospool/iocage/jails/pms/root/media       nullfs  rw      0       0                                         |
+-------+-------------------------------------------------------------------------------------------------------------------------------------------+


Any advice what to check?
 

-fun-

Contributor
Joined
Oct 27, 2015
Messages
171
Ok, to whoever has the same issue: The directories below my media dataset are also datasets, not mere directories. I needed to mount these explicitly. Works now.
 

xames

Patron
Joined
Jun 1, 2020
Messages
235
I have the latest truenas core update 13.0, but plex on gui say me about new versions, i never upgrade frrom shell, the jail is 12.1 I think, how i can upgrade to the latest plex jail?
 

Yorick

Wizard
Joined
Nov 4, 2018
Messages
1,912
Plugins will remain supported until early 2025. If you want to stay on CORE, you'll need to move to manually-managed jails.

See https://www.truenas.com/blog/the-future-of-truenas-plugins-is-apps/ and also https://www.truenas.com/community/threads/truenas-13-1-wishlist.116359/post-808384 for some color.

In the next two years, we expect CORE users to either:
  1. Migrate their plugins to personally managed jails and remain on CORE
  2. Migrate from CORE to SCALE and rebuild their applications using the simpler Apps or VMs

CORE is squarely focused on storage now, and conservative on features. SCALE is storage + apps + virtualization + clustering + feature velocity.
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
danb35 submitted a new resource:

Scripted Plex installation - Script to install Plex Media Server



Read more about this resource...
Hey DanB. Me again. I was looking through your scripts and noticed that you've made a big difference in your Plex installation vs what I have now. I didn't put the metadata outside of the jail. I will certainly research and explore this on my own, but I wanted a good sanity check before beginning: How difficult is it to move the metadata outside of the jail once the jail has been setup? Thanks for your insight. Appreciate you!
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
How difficult is it to move the metadata outside of the jail once the jail has been setup?
Not very. Stop the plex process, tar up the config/metadata, untar it in the new directory. Or you could even copy it directly; all the files inside a jail are accessible from the host. It takes a while, as it adds up to quite a bit of data, but it isn't particularly difficult.
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
Thanks for your help @danb35. After some searching, I found what appears to be the metadata in this folder:

root@PLEX:/usr/local/plexdata/Plex Media Server/Metadata

It doesn't match up with any resources elsewhere, even Plex's website (https://support.plex.tv/articles/202915258-where-is-the-plex-media-server-data-directory-located/).

But it does appear that my Plex config is noted correctly based on the folder setup (i.e. I only have Movies and TV Shows).

What's your opinion on a daily script to tar the entire 'metadata' directory and move it to a folder outside of the jail? I've tested tar while the server was running, while the server was stopped, and the tar file attributes look the same (esp. size). I ask this because I can't find in the plex settings GUI where to change the /metadata directory.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
It doesn't match up with any resources elsewhere, even Plex's website
It matches what they say for FreeBSD pretty well (i.e., exactly). I'm thinking the FreeNAS 11 entries are left over from when plugins were done very differently.
What's your opinion on a daily script to tar the entire 'metadata' directory and move it to a folder outside of the jail?
I don't know that I have one especially. I prefer keeping it outside of the jail (which is why my script works that way), and I'd probably favor keeping snapshots over a regular tar process. Again, the metadata can be pretty big--tens of GB and thousands of files isn't that uncommon--and running a regular tar backup could take quite a while. But other than that, I don't see a particular reason not to do it.

The reason I recommended stopping the Plex process is to ensure that the metadata remains in a consistent state while you're moving it around. It may not be necessary, but it seems like a good precaution.
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
It matches what they say for FreeBSD pretty well (i.e., exactly). I'm thinking the FreeNAS 11 entries are left over from when plugins were done very differently.

I don't know that I have one especially. I prefer keeping it outside of the jail (which is why my script works that way), and I'd probably favor keeping snapshots over a regular tar process. Again, the metadata can be pretty big--tens of GB and thousands of files isn't that uncommon--and running a regular tar backup could take quite a while. But other than that, I don't see a particular reason not to do it.

The reason I recommended stopping the Plex process is to ensure that the metadata remains in a consistent state while you're moving it around. It may not be necessary, but it seems like a good precaution.
Ok, I've already copied them over. I just need to find in Plex where the metadata needs to be stored when the jail starts. Searching all over the interweb, I haven't found it. The best I've found are some instructions to create a 'symlink' to the new folder. I've already tasked you today, so humbly ask: Is there a config file for plex somewhere where I can simply change the metadata directly location?

Thank you Danb.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
there a config file for plex somewhere where I can simply change the metadata directly location?
Not a config file as such, but a command you can run inside the jail: sysrc plexmediaserver_support_path="/path/to/metadata"
 

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
That is awesome. Ok, just so I don't hose the jail. I've decompressed the .tar file to the folder at /mnt/Pool1/plexmetadata/Metadata. I've verified everything looks good.

Now I need to go into the jail console and run the command:
Code:
sysrc plexmediaserver_support_path="/mnt/Pool1/plexmetadata/Metadata"


Does that look right danb?
 
Joined
Oct 22, 2019
Messages
3,641
Don't make references outside the jail.

Consider your jail as a "mini server" with its own isolated filesystem. In order to access data/paths outside (i.e, on the host), you need to create a mountpoint and then reference said path.

Such as a mountpoint to /mnt/Pool1/plexmetadata/Metadata that the jail sees as /media/plexmetadata

Then you would likewise use this path inside the jail, such as with your sysrc command.
Code:
sysrc plexmediaserver_support_path="/media/plexmetadata"

* Change the paths accordingly, depending on where the Plex metadata actually resides.
 
Last edited:

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
Thanks @winnielinnie ! Got it. So I should always create mount points when the jail needs to reference anything outside of it. I remember reading that when I set up the plex server. I'll try hard to remember it next time. :smile:

Ok, I've setup the mount point in the Plex jail:

Source: /mnt/Pool1/plexmetadata/Metadata
Destination: /mnt/Pool1/iocage/jails/plex/root/media/metadata

Now in the jail console (after stopping the plex server), I can type: sysrc plexmediaserver_support_path="/mnt/Pool1/iocage/jails/plex/root/media/metadata"

Start the plex server, and plex should now be using the /mnt/Pool1/plexmetadata/Metadata folder as the metadata folder? As a precaution, is there a way to list the current path Plex is using so I can document it and revert back if I break it?

Apologies for the ignorant questions. I don't have my head wrapped around the backup/restore process for jails yet, so I'm trying to be careful.

Thank you again!
 
Joined
Oct 22, 2019
Messages
3,641
So I should always create mount points when the jail needs to reference anything outside of it.
Yes.


Now in the jail console (after stopping the plex server), I can type: sysrc plexmediaserver_support_path="/mnt/Pool1/iocage/jails/plex/root/media/metadata"
This is incorrect. You're inadvertently referencing a path outside the jail. The jail has no concept of "/mnt/Pool1/....." Only the proper TrueNAS host has such access. You need to reference the path in the jail itself that points to this location. (This location, which you gave access to the jail via a mountpoint.)

See my previous post for an example.


EDIT: To help you see it from a different perspective, consider this:

Anything after /mnt/pool/iocage/jails/jailname/root is where the jail's root filesystem begins, and hence, how it "sees the world".

Take this path on your TrueNAS system, for example...
/mnt/pool/iocage/jails/myapp/root/media/downloads

If this is the real path from the host's perspective...
/mnt/pool/iocage/jails/myapp/root/media/downloads

Then this is the path, as seen (and understood) from within the "myapp jail"...
/media/downloads

(Where mountpoints come into play is directing certain paths, within the jail, to have access outside of the jail.)
 
Last edited:

cdog89

Explorer
Joined
Jan 19, 2024
Messages
75
Yes.



This is incorrect. You're inadvertently referencing a path outside the jail. The jail has no concept of "/mnt/Pool1/....." Only the proper TrueNAS host has such access. You need to reference the path in the jail itself that points to this location. (This location, which you gave access to the jail via a mountpoint.)

See my previous post for an example.


EDIT: To help you see it from a different perspective, consider this:

Anything after /mnt/pool/iocage/jails/jailname/root is where the jail's root filesystem begins, and hence, how it "sees the world".

Take this path on your TrueNAS system, for example...
/mnt/pool/iocage/jails/myapp/root/media/downloads

If this is the real path from the host's perspective...
/mnt/pool/iocage/jails/myapp/root/media/downloads

Then this is the path, as seen (and understood) from within the "myapp jail"...
/media/downloads

(Where mountpoints come into play is directing certain paths, within the jail, to have access outside of the jail.)
Aaaaah. I finally get it now. Not only can I not reference anything outside of the jail from inside it with any commands or configs, it doesn't know the outside even exists. So referencing it would never work.

Thanks for taking the care to explain this, and with the color coding! It made it completely clear what you were saying.

It looks good (output):
[
root@plex:~ # sysrc plexmediaserver_support_path="/media/plexmetadata"
plexmediaserver_support_path: -> /media/plexmetadata
root@PLEX:~ #
]

Much appreciation to you!
 
Last edited:
Top