Jump to content

Migrating Plex from a FreeNAS Jail to Unraid Docker Container


Recommended Posts

In case its of any help to anyone..

 

Migrating PLEX MEDIA SERVER from a FreeNAS Jail to Unraid Docker

 

1.     In the Plex webUI, open the settings and uncheck ‘empty trash after each rescan’. Then save.

 

image.png.d38321df5c1bd015eb5a266ec810de42.png

 

2.      On the FreeNAS shell, locate your Plex Media Server Jail and its plex related data. In my case, my jail is called ‘plex-plexpass’ and my iocages live on a pool called ‘MEDIA’. Using a terminal shell on the FreeNAS host:

root@freenas#  cd /mnt/MEDIA/iocage/jails/plex-plexpass/root

root@freenas#  ls -lrt

 

3.     The ‘Plex Media Server’ directory contains all the Plex config data and database files. This needs to be tarred up before being transferred to the Unraid server.

 

root@freenas# tar -cvf PlexMediaServer_backup.tar “Plex Media Server”

 

4.     Once the Plex directory has been tarred up using the above command, we use rsync to transfer it to the Unraid server. My Unraid server is called ‘unraid’ and the location I will store it in is called ‘backuptars’. Note that I have a local DNS that resolves ‘unraid’ to its IP address. If you don’t have one, use the IP address of your server. Note also that I use the root account on both FreeNAS and Unraid. If you use other accounts, make sure you substitute these for ‘root’ used in this how-to…

 

root@freenas#  rsync -auP PlexMediaServer_backup.tar root@unraid:/mnt/disk1/data_migrate/backuptars

 

5.     We also need to decide where the media itself is going to be stored. Assuming this is also going to be moving to Unraid, we need to make sure this too has been shipped from FreeNAS to Unraid. We can use the same rsync command to move the Media directory. The below command assumes our media is stored in a directory called ‘plexmedia’ and that this will be moved to a share called ‘plexmedia’ on Unraid.

 

root@freenas# rsync -auP plexmedia root@unraid:/mnt/disk2/plexmedia/

 

6.     Next we need to setup a Docker container on Unraid that will be our new Plex media server. I used the ‘Community Applications’ plugin by Andrew Zawadzki to make this easy.

 

image.png.1ade9a2bca7aa008e6b76e7ffc61a9c1.png

 

7.     From the Plugins section in Unraid, just add the Community Applications plug-in

like this:

 

image.png.23ab87b63805bba4eff71b38981e1af9.png

 

8.     The URL to use is:

https://raw.githubusercontent.com/Squidly271/community.applications/master/plugins/community.applications.plg

 

For more information, please see the Unraid forum post:

https://forums.unraid.net/topic/38582-plug-in-community-applications

 

9.     Once installed and started, you should see the below in the Docker section of Unraid.

 

image.png.a89986bdb98144985d3b45d8ad272589.png

 

10.  In order to map the right container paths to where things are stored on the Unraid directory, we need to change the host path as shown, and then save and apply.

 

image.png.479ec6b3131c61d84d78c99410f086c0.png

 

11.  Notice that /config is mapped to /mnt/user/appdata/binhex-plexpass, as shown below:

 

image.png.713261922bde8ee07c835b85219fad7a.png

 

12.  This is where the new Plex metadata resides. We will need to overwrite this with the data we transferred over from FreeNAS. First stop the container that is running using the UnraidUI – click the STOP ALL button:

 

image.png.8e0f191a69c5c2be7ebddd087ff2e129.png

 

13.  Using the terminal shell on the Unraid host, go to the location where the plex configuration data resides:

 

root@unraid# cd /mnt/user/appdata/binhex-plexpass

 

image.png.26eeee363c2df7ab0c96b3dfa8361efa.png

 

14.  We need to rename the existing Plex Media Server Directory that is already here.

 

root@unraid# mv "Plex Media Server" pms.old

 

15.  Now we need to move our FreeNas Plex configuration (that we transferred from FreeNAS previously to the ‘backuptars’ directory) to take the place of the Plex Media Server directory we just renamed. NB. The reason why we move it here instead of maybe just changing the volume mapping of the docker container, is that future updates of plex may expect certain things to be in certain places… it may well work, but I didn’t want to risk it...

 

root@unraid# mv /mnt/disk1/data_migrate/backuptars/PlexMediaServer_backup.tar .

 

16.  And then we need to untar the file so that we have the Plex Media Directory recreated.

 

root@unraid# tar -xvf  PlexMediaServer_backup.tar

 

17.  And then adjust file and directory ownerships:

 

root@unraid# chown -R nobody:users "Plex Media Server"

 

18.  Now start the Unraid Plex Docker container by clicking the START ALL button:

 

image.png.e7ea4bd436ac4802d089eae90dda385d.png

 

19.  Wait a couple of minutes foe Plex to come up and settle, and then using a web browser, browse to the new Plex instance – for me the URL is

http://unraid:32400/web

 

20.  Once logged in, the plex library should be visible. However, when trying to play a video, the following error may be seen:

 

image.png.85271d41c671ca86967295e8824c6d8e.png

 

21.  This is because the path to the media (as known to Plex from your old instance on FreeNAS) has changed and Plex can no longer find the actual media file to serve. I thought this could be fixed with putting in some symlinks, but this didn’t work for me. So, I just manually mapped my media directories in the PlexUI like this:

 

image.png.79efd17eed3bc9e569a177ed11629ca2.png

 

22.  Press the BROWSE button and browse to the location of your media – for example, for my TV media, it was /mnt/media/TV

 

23.  Plex will rescan the library (which may take a while to complete) and the media should now play. Remember to do the same for all your other media folders, Movies, Documentaries, etc.

 

24.  Finally, re-enable the ‘Empty trash automatically’ feature in SETTINGS>LIBRARY in the Plex webUI and click SAVE CHANGES.

 

image.png.42ba77e561c3fb6192e18a067759171c.png

 

PLEX Media Server has now been successfully migrated from FreeNAS iocage Jail to a Unraid Docker Container.

 

25.  Now that everything is up and running, we can delete the ‘pms.old’ directory which we renamed the original Unraid Docker Plex configuration directory to, and also the PlexMediaServer_backup.tar file that we transferred from the FreeNAS server. We use the terminal shell like this:

 

root@unraid# cd /mnt/user/appdata/binhex-plexpass

root@unraid# rm -Rf pms.old

root@unraid# rm -Rf pms.old

root@unraid# rm PlexMediaServer_backup.tar

 

 

//** There’s probably a better way of doing it that avoids having to rescan your media, but this is what worked for me.. //**

 

 

image.png

Edited by jagz707
error
  • Like 1
Link to comment

Not familiar with FreeNAS jails, but ultimately, your plex docker on FreeNAS would have had host path(s) for the media mapped to container path(s).

 

And on Unraid, your plex docker would have host path(s) for the media mapped to container path(s).

 

The plex library you are transferring is expecting to find the media at the specified container path(s). So, you just need to have the media container path(s) on Unraid the same as the media container path(s) you were using on FreeNAS.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...