Hi and welcome to my guide to managing your Plex metadata. This guide is aimed at users who are completely new to FreeNAS and / or have little or no experience with FreeNAS, using the command line or even some of the basic commands for Unix like operating systems.
If other guides out there are a little over your head at the moment, you don't no your vi from your vim, or you've only just got those pesky permissions working... then this guide is written with you in mind.
So... why would you want to house your Plex metadata / config on it's own Dataset?
The simple answer is that it makes managing your Plex Jail or Plugin much less of a hassle. For example, lets say that your Plex Jail, be it one that you have manually created or one that was created when you installed the Plex Plugin, stops working for some reason. You try to trouble shoot it but you just can't find the problem let alone fix it. So you decide to create a new Jail. The new PLex install runs fine but you have a blank slate. At this point, you either have to
I've written this guide so that it can be followed using the FreeNAS WebGUI alone and without the use of external software, specifically an SSH client. However, I do recommend the use of an SSH client and if you haven't got one setup already, I highly recommend that you set one up. My preferred client is PuTTY but there are many great alternatives out there.
For this guide, I'll be using a few variables that you'll have to modify yourself. Don't just copy and paste the commands in the guide!
$TANK = the name your
$JAIL = the name your Plex
$PLUGIN = the name your
1. Create the Dataset(s) where you'll house metadata and config files for your Jail.
I use the following
1.1 So for Plex, go ahead create a dataset called
The structure should look like this-
Note that I also have a dataset for housing my Deluge state data, which really has come in handy.
2. Setting permissions for the dataset.
The next thing you need to do is to change the permissions of the
dataset so that the
In order to avoid potential issues, I recommend creating the Group first. So go ahead and-
2.1. Click the "Accounts" menu on the left hand side of the FreeNAS WebGUI.
2.2. Click "Groups".
2.3. Click the "ADD" button toward the top right of the FreeNAS WebGUI.
2.4. Create a group called
2.5. Click "Save".
Now create the
2.6. Click the "Accounts" menu on the left hand side of the FreeNAS WebGUI.
2.7. Click "Users".
2.8. Click the "ADD" button toward the top right of the FreeNAS WebGUI.
2.9. Use anything you want for the "Full Name" field.
2.10. For "Username", use
2.11. Set a password.
2.12.For the "User ID", put 972.
2.13. Uncheck the "New Primary Group" box.
2.14 in the "Primary Group" drop down menu, select the
2.15. Click "Save".
Now we need to set
2.16. Click the "Storage" entry and then "Pools" on the sidebar.
2.17. Navigate to the
2.18. Click the three dots icon to the right of the
2.19. Change "User" and "Group" to
3. Stopping your Plex Jail.
3.1. depending on whether you install Plex using the Plugin or manually in a Jail, click on either "Plugins" or "Jails" on the sidebar.
3.2. Stop the Jail by clicking the three dots menu and selecting "Stop".
4. Transferring the contents of the
We don't want to risk losing any data, so before touching the original data, we're going to duplicate it to the newly created
4.1. Click on the "Shell" entry on the sidebar.
4.2. Change the variables in one of the commands below and input it into the shell and hit enter. The command will vary depending how you installed Plex and who you named your pool, your various datasets and your Jail / Plugin. So don't just copy and paste!
Plugin -
Jail -
NOTE: the commands above have two arguments,
5. Move / Rename the
In order to mount the
5.1. Issue one of the two following commands... again, modify it according to your pool, dataset and Jail naming.
Plugin -
Jail -
6. Mount the dataset within the Plex jail.
6.1. Navigate to the Jails or Plugins page, and click on the three dots menu.
6.2. Click "Moun points"
6.3. In the top right of the WebGUI, click the "Actions" drop down menu and click "Add Mount Point".
6.4. Set the Source and Destination as follows.
Plugin:
Source -
Destintation -
Jail:
Source -
Destintation -
6.5. Click "Save"
Formy your piece of mind, at this point you might want to just double check that the data is where it should be and that it's permissions are correct....
6.6. Issue one of the following commands-
Plugins -
Jail -
If all went well, the output should look like this-
7. The moment of truth...
At this point, all that's left is to restart the Plugin or Jail.
If other guides out there are a little over your head at the moment, you don't no your vi from your vim, or you've only just got those pesky permissions working... then this guide is written with you in mind.
So... why would you want to house your Plex metadata / config on it's own Dataset?
The simple answer is that it makes managing your Plex Jail or Plugin much less of a hassle. For example, lets say that your Plex Jail, be it one that you have manually created or one that was created when you installed the Plex Plugin, stops working for some reason. You try to trouble shoot it but you just can't find the problem let alone fix it. So you decide to create a new Jail. The new PLex install runs fine but you have a blank slate. At this point, you either have to
I've written this guide so that it can be followed using the FreeNAS WebGUI alone and without the use of external software, specifically an SSH client. However, I do recommend the use of an SSH client and if you haven't got one setup already, I highly recommend that you set one up. My preferred client is PuTTY but there are many great alternatives out there.
For this guide, I'll be using a few variables that you'll have to modify yourself. Don't just copy and paste the commands in the guide!
$TANK = the name your
pool
$JAIL = the name your Plex
Jail
, if you installed Plex manually.$PLUGIN = the name your
Plugin
and it's associated Jail, if you installed Plex using the offical Plex Plugin.1. Create the Dataset(s) where you'll house metadata and config files for your Jail.
I use the following
dataset
structure-/mnt/tank/Apps/Plex
tank
being the name of my pool. I then have a dataset called Apps
and finally, a dataset named Plex
. You don't have to nest the Plex
dataset under an Apps
dataset but doing so means that when you create other datasets for housing config data, having them all under Apps
helps keep things nice, neat, and logical.1.1 So for Plex, go ahead create a dataset called
Apps
. And then create a "child" dataset within the "Apps" dataset
called "Plex".The structure should look like this-
Note that I also have a dataset for housing my Deluge state data, which really has come in handy.
2. Setting permissions for the dataset.
The next thing you need to do is to change the permissions of the
Plex
dataset so that the
plex
user, that already exists within you Jail or Plguin, is able to read and write to the new dataset. For most users this will mean creating a new User and Group on their FreeNAS system.In order to avoid potential issues, I recommend creating the Group first. So go ahead and-
2.1. Click the "Accounts" menu on the left hand side of the FreeNAS WebGUI.
2.2. Click "Groups".
2.3. Click the "ADD" button toward the top right of the FreeNAS WebGUI.
2.4. Create a group called
plex
with a "GID" of 972.2.5. Click "Save".
Now create the
plex
user.2.6. Click the "Accounts" menu on the left hand side of the FreeNAS WebGUI.
2.7. Click "Users".
2.8. Click the "ADD" button toward the top right of the FreeNAS WebGUI.
2.9. Use anything you want for the "Full Name" field.
2.10. For "Username", use
plex
.2.11. Set a password.
2.12.For the "User ID", put 972.
2.13. Uncheck the "New Primary Group" box.
2.14 in the "Primary Group" drop down menu, select the
plex
group2.15. Click "Save".
Now we need to set
plex
as the owner of the dataset
we created in section 1.2.16. Click the "Storage" entry and then "Pools" on the sidebar.
2.17. Navigate to the
plex
dataset
.2.18. Click the three dots icon to the right of the
dataset
and click "Edit Permissions".2.19. Change "User" and "Group" to
plex
.3. Stopping your Plex Jail.
3.1. depending on whether you install Plex using the Plugin or manually in a Jail, click on either "Plugins" or "Jails" on the sidebar.
3.2. Stop the Jail by clicking the three dots menu and selecting "Stop".
4. Transferring the contents of the
Plex Media Server
folder to the new dataset / keeping your exisitng data safe.We don't want to risk losing any data, so before touching the original data, we're going to duplicate it to the newly created
Plex
dataset.4.1. Click on the "Shell" entry on the sidebar.
4.2. Change the variables in one of the commands below and input it into the shell and hit enter. The command will vary depending how you installed Plex and who you named your pool, your various datasets and your Jail / Plugin. So don't just copy and paste!
Plugin -
cp -rp "/mnt/$TANK/iocage/jails/$PLUGIN/root/Plex Media Server/" "/mnt/tank/Apps/Plex/"
Jail -
cp -rp "/mnt/$TANK/iocage/jails/$JAIL/root/usr/local/plexdata/Plex Media Server/" "/mnt/tank/Apps/Plex/"
NOTE: the commands above have two arguments,
-r
which makes the copy recursive, and-p
which preserves the permissions of the various files in the "Plex Media Server" folder.5. Move / Rename the
Plex Media Server
folder in the Plugin / Jail.In order to mount the
plex
dataset without causing any issues, we must rename or move the existing Plex Media Server
folder. The common convention is to append ".old" to the end of the file or folder's name.5.1. Issue one of the two following commands... again, modify it according to your pool, dataset and Jail naming.
Plugin -
mv "/mnt/$TANK/iocage/jails/$PLUGIN/root/Plex Media Server" "/mnt/$TANK/iocage/jails/Plex/root/Plex Media Server.old"
Jail -
mv "/mnt/$TANK/iocage/jails/$JAIL/root/usr/local/plexdata/Plex Media Server" "/mnt/$TANK/iocage/jails/$JAIL/root/usr/local/plexdata/Plex Media Server.old"
6. Mount the dataset within the Plex jail.
6.1. Navigate to the Jails or Plugins page, and click on the three dots menu.
6.2. Click "Moun points"
6.3. In the top right of the WebGUI, click the "Actions" drop down menu and click "Add Mount Point".
6.4. Set the Source and Destination as follows.
Plugin:
Source -
/mnt/$TANK/Apps/Plex/Plex Media Server
Destintation -
/mnt/$TANK/iocage/jails/$PLUGIN/root/Plex Media Server
Jail:
Source -
/mnt/$TANK/Apps/Plex/Plex Media Server
Destintation -
/mnt/$TANK/iocage/jails/$JAIL/root/user/local/plexdata/Plex Media Server
6.5. Click "Save"
For
6.6. Issue one of the following commands-
Plugins -
ls -al "/mnt/$TANK/iocage/jails/$PLUGIN[/B]/root/Plex Media Server"
Jail -
/mnt/$TANK/iocage/jails/$JAIL/root/user/local/plexdata/Plex Media Server
If all went well, the output should look like this-
Code:
drwxr-xr-x 10 plex plex 12 May 26 13:22 . drwxr-xr-x 5 root wheel 5 May 25 11:43 .. drwxr-xr-x 4 plex plex 10 May 26 13:22 Cache drwxr-xr-x 3 plex plex 4 May 26 13:22 Codecs drwxr-xr-x 3 plex plex 15 May 26 13:22 Logs drwxr-xr-x 3 plex plex 3 May 25 11:25 Media drwxr-xr-x 3 plex plex 3 May 25 11:25 Metadata drwxr-xr-x 7 plex plex 7 May 25 11:25 Plug-in Support drwxr-xr-x 3 plex plex 3 May 25 11:25 Plug-ins -rw------- 1 plex plex 360 May 25 11:43 Preferences.xml
7. The moment of truth...
At this point, all that's left is to restart the Plugin or Jail.