Migrating Plex Server from Windows to TrueNAS Scale

joker27th

Cadet
Joined
Aug 19, 2023
Messages
1
Hello TrueNAS community,

I've been trying to migrate my Plex Media Server from a Windows setup to TrueNAS SCALE's Plex plugin. My main goal is to maintain all the metadata from the original Plex setup as I have many movies that were manually matched or have custom metadata.

Original Setup:

  • Plex Media Server running on Windows.
  • Media paths:
    • Movies: M:\Plex Server\Plex Content\Movies
    • TV Shows: M:\Plex Server\Plex Content\TV Shows
Target Setup on TrueNAS SCALE:

  • Plex installed as a plugin.
  • Media paths:
    • Movies: /mnt/TrueNAS/Media/Plex Content/Movies
    • TV Shows: /mnt/TrueNAS/Media/Plex Content/TV Shows
Steps Taken So Far:

  1. Backup & Restore: Initially, I tried a simple backup and restore approach:
    • Backed up the entire "Plex Media Server" folder from the Windows machine.
    • Restored this backup to the corresponding location on TrueNAS at /mnt/TrueNAS/plex/config/. This directory was also set as the Plex configuration directory during the Plex app setup in TrueNAS SCALE.
    • Updated the library paths in Plex.
  2. SQLite Database Modification: To address path discrepancies between the two setups, I accessed the Plex SQLite database and modified the paths:
    • Used SQLite on my Windows machine to change the paths in the com.plexapp.plugins.library.db file from the Windows format to the TrueNAS format.
    • Queries executed:
    • UPDATE media_parts SET file = replace(file, 'M:\Plex Server', '/Media');
      UPDATE section_locations SET root_path = replace(root_path, 'M:\Plex Server', '/Media');
  3. Permissions: To ensure that Plex had the right permissions to access the restored metadata, we set broad permissions using chmod -R 777 for the Plex directories.


Despite these steps, when I launch plex I am still asked to add the library's manually and then Plex scans my libraries on TrueNAS, it doesn't retain the metadata from the original server, and I have to manually match a lot of content.

I'd appreciate any advice or steps I might have missed during this migration or if there is just a completely different way to go about it, or if I should be using a differnt OS instead of TrueNAS Scale.

Thank you in advance for your insights!
 

Black_Duck

Explorer
Joined
Oct 8, 2022
Messages
61
Hi.
Ive done what you're trying to do, but not from Windows.
To clarify, your content is in "TrueNAS/Media/Plex Content/Movies" (where TrueNAS is the name of your pool)?
Im assuming you created an SMB share to the location and you copied the data across or something.

Now you need to get your metadata across. The metadata is the same in windows and linux, but the file structures are slightly different.

These are the steps I took:
  1. You need to create a dataset that will contain the config and metatdata files in your pool. I suggest creating something like "applications/plex". this gives you a high-level folder ('applications') that you can put other configs into if you need them.
  2. I would also create a share to this folder so you can easily see its structure from your Windows machine.
  3. Also, make sure that you have turned off "Enable Host path safety check" in the Kubernetes Settings (in Apps>Settings>Advanced Settings). You will get a warning - just ignore it.
  4. In the app setup:
    • Tick "Enable Host Path for Plex Config Volume" and set it to "/mnt/TrueNAS/applications/plex"
    • You can add you content files under "Plex Extra Host Path Volumes". You can probably get away with just mounting "/mnt/TrueNAS/Media/Plex Content".
  5. Start the app and let it create a new plex environment. Don't set up your library yet - you just want it to create the config structure.
  6. Shut down the app.
  7. If you now browse the actual tree structure created, it should look like this: applications/plex/Library/Application Support/Plex Media Server/
  8. Within "Plex Media Server" should be all the folders such as "Cache, Codecs, Media, Metadata, etc.."
  9. I then copied the individual parts of my original plex files into the new structure. Note the copying over the actual metadata through the SMB share is slow as it consist of multiple small files. Best to use USB stick.
  10. If you now start the app again you should now see all your metadata, but no link to the content.
  11. Go into plex setup and now link your content.
  12. If all goes well, plex should pick up that its the same content to the metadata and just change the path.
  13. Don't forget to add you Plex token if you want remote access.
I never had to do anything with the database, but as I said, I was migrating from Mac, not windows.

Some other advice:
  • Have a neat structure to your pool so sharing and security can be easily managed.
  • Stay with lowercase names where possible - its the linux way
  • Set up shares to simplify reading and editing files.
  • Watch out for security - the POSIX setup can be quite a pain.
PS I did this from memory, so I might have missed something. Let me know if there's a problem.
 
Top