Linux Tips

Migration from another OS to Linux

Cross OS migration is a multi-level process.

  1. Copy the PMS databases and metadata
  2. Update all the media locations to point to their new locations.

Prerequisites - On the originating host

  1. Settings - Server - Library

  2. Turn off:

  • Scan my library automatically
  • Run a partial scan when changes are detected
  • Include music libraries in automatic scans
  • Scan library periodically
  • Empty trash automatically after every scan
  1. Stop Plex
  2. ZIP up the “Plex Media Server” directory.

On the new Linux host

  1. Install Plex Media Server
  2. Do not interact with it.
  3. Stop Plex
  4. Open a terminal window session to perform the following steps
  • elevate to ‘root’ privileges
$ sudo bash
  • Remove the pre-created “Plex Media Server” directory
# rm -rf "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server"
  • Copy the ZIP file from the Originating machine
# cp "/path/to/Plex Media Server.zip"  "/var/lib/plexmediaserver/Library/Application Support"
  • Unzip the PMS data files
# cd "/var/lib/plexmediaserver/Library/Application Support"
# unzip "Plex Media Server.zip"
  • Verify proper final directory structure
    a. Directories of importance for Linux are shown below.
    b. If you have extra directories, do not be concerned. They can be removed later.
    c. The full final path is: /var/lib/plexmediaserver/Application Support/Plex Media Server.
    d. All the files you copied over from the other host are in ‘Plex Media Server’
# ls -la "Plex Media Server"
total 64
drwxr-xr-x 11 chuck chuck  4096 Nov  6 10:31  .
drwxr-xr-x  4 chuck chuck  4096 Oct  4 11:35  ..
drwxr-xr-x  5 chuck chuck 12288 Nov  6 12:53  Cache
drwxr-xr-x  6 chuck chuck  4096 Oct 19 11:09  Codecs
drwxr-xr-x 11 chuck chuck  4096 Oct  4 11:49 'Crash Reports'
drwxr-xr-x  2 chuck chuck  4096 Apr 14  2021  Diagnostics
drwxr-xr-x  3 chuck chuck  4096 Nov  6 12:52  Logs
drwxr-xr-x  3 chuck chuck  4096 Apr 10  2021  Media
drwxr-xr-x  6 chuck chuck  4096 Apr 10  2021  Metadata
drwxr-xr-x  2 chuck chuck  4096 Apr 10  2021  Plug-ins
drwxr-xr-x  7 chuck chuck  4096 Apr 10  2021 'Plug-in Support'
-rw-r--r--  1 chuck chuck  2081 Nov  6 10:31  Preferences.xml
#
  • Preferences.xml file
    a. Windows does not yet have a Preferences.xml file.
    b. If no Preferences.xml file exists, PMS will create a new one on first start.
    c. You will have to “Claim” the new server however all your libraries will already exist.

  • Change the ownership of the files to the Plex user on the Linux host.

# chown -R plex:plex "/var/lib/plexmediaserver"
  • Make certain Linux file permissions are set correctly
# find /var/lib/plexmediaserver -type d -exec chmod 755 {} \;
# find /var/lib/plexmediaserver -type f -exec chmod 644 {} \;
# chmod +x /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Codecs/EasyAudioEncoder-8f4ca5ead7783c54a4930420-linux-x86_64/EasyAudioEncoder/EasyAudioEncoder
  1. Start Plex

  2. If you have a Plex/web browser window open – Sign out (upper right corner) – then close the tab

  3. Open an incognito window

  4. In that window, open http://127.0.0.1:32400/web

  5. Be greeted by the “Got It” and “Sign in” then the setup wizard.

  6. As the setup starts, examine whether it wants to CONFIRM your existing library sections (it should) or create new (which you will SKIP). In all cases, you do not want to create new library sections. Your existing sections will be waiting for you at the end of the setup wizard.

  7. Proceeding through the setup wizard, confirm the Friendly name you wish to use and any other settings.

  8. When you’re DONE, you’ll arrive at the Dashboard. This is completes the first phase. Next, we’ll tell Plex where your media is (as it’s seen from this host).

  9. For each Library section you have,

  • Edit the section (Hover over it - expose the ellipsis - Manage - Edit)
  • Advanced Tab - ADD the new top directory path (Do not remove the old yet) - SAVE the changes.
  • PMS will see the new location and begin scanning.
  • As each item is matched, a 2 will appear (duplicate) on each item already in your library . This is expected and desired proof everything is going as expected.
  • When completed, Edit the library section again. REMOVE the old media location. SAVE
  • Scan one final time. Observe the 2 being removed.
  • Empty the Trash
  • Clean the bundles
  • Optimize the database
  1. Repeat the above sequence for each library section until all are done.
  2. Return to Settings - Server - Library, turn Automatic and Empty Trash back on.

Back to top

6 Likes