How To Migrate Plex Media Server - Ubuntu 20.04.x

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

sboesch

Active Member
Aug 3, 2012
467
95
28
Columbus, OH
This HOW TO assumes that you are using Ubuntu 20.04.x, the principles will remain the same regardless of your Operating System

On your new Plex server, perform the following steps

  • Install the Plex Signed Key: curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add –
  • Install the Plex Repository: echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list
  • Check for updates and install them: sudo apt update && sudo apt upgrade
  • Install plexmediaserver: sudo apt install plexmediaserver -y
  • Prepare your metadata directory, you will need to delete the contents of the Library: sudo rm -rf /var/lib/plexmediaserver/Library
Stop the plexmediaserver service on your old plexmediaserver and your new plexmediaserver

  • sudo systemctl stop plexmediaserver
  • sudo rsync -azvh root@<old server ip address>:/var/lib/plexmediaserver/ /var/lib/plexmediaserver/
Upon completion, change the owner of the plexmediaserver directory to the plex user on your new plexmediaserver, Plex on Ubuntu requires this user to be the owner of the directory

  • sudo chown -R plex:plex /var/lib/plexmediaserver/
(Ignore the smiley! dang shortcode!)
Reboot your new plexmediaserver and test. Open your web browser and point it to http://<new server ip address>:32400/web

You will see your Plex home screen and all your media, play a video and verify that your libraries are intact.
 

Brian Puccio

Member
Jul 26, 2014
70
33
18
41
Use code tags so your text doesn’t get mangled with eomojis, curly quotes, etc.

Code:
foo bar baz plex:plex
 

TonyArrr

Active Member
Sep 22, 2021
131
68
28
Straylia
Good to see things haven’t changed since last I did this.
Out of interest, were your library folders at the same path on the new and old? If not, did your library freak out and rean everything?
When I did this (admittedly macOS to Debian), the path changed from /Volumes/Data/Media/… to /media/Data/Media/… and Plex lost it‘s mind and scanned everything for intros and video thumbnails all over again, despite having all that metadata in it’s App Support folder with new ownership and permissions, but didn’t get rid of the originals until I emptied all the library’s trashes…

Always wondered if it was because of the pathname change, the OS change or just me
fwiw, the media files never moved, the whole migration was from the host OS to a VM OS with the same drive array passed through to the VM
 

sboesch

Active Member
Aug 3, 2012
467
95
28
Columbus, OH
Good to see things haven’t changed since last I did this.
Out of interest, were your library folders at the same path on the new and old? If not, did your library freak out and rean everything?
When I did this (admittedly macOS to Debian), the path changed from /Volumes/Data/Media/… to /media/Data/Media/… and Plex lost it‘s mind and scanned everything for intros and video thumbnails all over again, despite having all that metadata in it’s App Support folder with new ownership and permissions, but didn’t get rid of the originals until I emptied all the library’s trashes…

Always wondered if it was because of the pathname change, the OS change or just me
fwiw, the media files never moved, the whole migration was from the host OS to a VM OS with the same drive array passed through to the VM
My media paths are NFS shares, I made sure they were mounted the same way as the old server prior to copying the metadata.
 

Senses3

Member
May 11, 2013
48
57
18
After the first time I had to migrate a plex server, I decided I'd just keep the plexmediaserver folder on an nfs mount along with my other media and just create a symbolic link to it in /var/lib/plexmediaserver