I’ll demonstrate here how I generally build a Plex VM and mount storage with FreeNAS.
I’ll fill in this section later.
In order for everything to behave, you’re going to want to create a user on FreeNAS. This user can be used if you need to mount a dataset through SMB or NFS to other computers. If you have already created a user then you can skip to the next heading.
NOTE: This is only creating a single user called ‘plex’. You can get more complex with the setup if you need multiple users to access the share by using groups but that is beyond the scope of this tutorial.
- Select ‘Accounts’ menu then ‘Users’
- Click ‘Add’ button in the top right
- For ‘Full Name’ enter something like: Plex User
For ‘Username’ enter something like: plex
Type in a password you will remember for ‘Password’ and ‘Confirm Password’
- You should be able to leave everything else at the defaults
- Click Submit
You should see something like the screenshot below:
So your VM is built and FreeNAS is ready. If you haven’t already, create a dataset on FreeNAS that will store your Plex media. We’re going to mount our share as an NFS mount to our VM.
- Click ‘Storage’ then ‘Pools’
- Next to your pool, click the three dot menu and select ‘Add dataset’
- Give your dataset a name, like ‘media’. You shouldn’t need to adjust any other settings
- Click Submit
You should see your new dataset similar to the screenshot below.
Now we need to set permissions on the dataset.
- Click the three dots to the right of the dataset you just created
- Click ‘Edit permissions’
- Set the ‘User’ to the user you created, which is ‘plex’ for us. Check ‘Apply User’
- Set the ‘Group’ to the same as the user you created, which is ‘plex’ for us. Check ‘Apply Group’
- Check ‘Apply permissions recursively’
- Click Save
Now we create the NFS share.
- Click on ‘Sharing’ then ‘Unix Shares (NFS)’
- Click ‘Add’ in the top right
- For ‘Path’, select your pool and then select the dataset you created, which is ‘media’ in our example
- Set the ‘Description’ to something like: Plex media
- Click the ‘Advanced Options’ button
- Set ‘Mapall User’ to the user you created, which is ‘plex’ for us. This is necessary because NFS operates permissions based on user IDs. The user ID for ‘plex’ on FreeNAS likely will not match up with any user ID on your VM. It does not care what the user is called, it strictly looks at IDs. By using this Mapall setting, we tell it to ignore everything and force file actions as the FreeNAS plex user.
- Set ‘Mapall Group’ to the same as the user you created, which is ‘plex’ for us. You can also leave this blank.
- Click Submit
You should see an entry that looks like below:
Mount on Plex
For this step, I’m going to make some assumptions:
- You need to know how to SSH to your Plex VM and use sudo, or run the commands as the root user
- You need to know how to edit a file on your Plex VM through SSH
- You know what your FreeNAS server IP is and that it is static set or has a DHCP reservation (also called a ‘sticky IP’) so that the IP does not change. If your FreeNAS server gets a new IP through DHCP then all of this will break since it’s no longer on the same IP.
SSH to your VM. Then we are going to create a mount point and then try mounting the NFS share to make sure everything is happy:
sudo mkdir /mnt/plex sudo mount -t nfs 192.168.20.1:/mnt/pool0/media /mnt/plex
If everything went well, you should now be able to run:
ls /mnt/plex which is probably empty if you don’t have any content yet. You can test to make sure writes are working by typing:
If everything is happy and no error messages came up, you are ready to set this to mount on boot. Edit /etc/fstab and add a line that looks like the one below. Obviously change the 192.168.20.1 IP to your FreeNAS server’s IP (the one you use to browse it’s web interface):
192.168.20.1:/mnt/pool0/media /mnt/plex nfs soft,intr
Save the file and close your editor.
Now go into the Plex UI and add a library. Point it to the new /mnt/plex folder and tell it what type of files you’re storing there (Movies, TV, etc). If you want those to be in separate folders, you will need to create new folders before telling Plex to use them. You can do that via SSH to the Plex VM or you can create an SMB share in FreeNAS and point it to the same dataset that NFS is using.