Wednesday, February 1, 2023

Move plex server from Linux/Synology to Windows PC and vice versa



 workarounds

Move a Server without losing Data


  I had my music library on a Synology NAS and was quite happy with it - till I discovered plexamp and its sonic analysis feature which cannot be used on an ARM cpu like mine. I decided to move the server to a powerful windows system, did the sonic analysis there and moved the whole library again to a linux mini pc - including the sonic analysis files. The files themselves are still kept on the NAS.

You have to copy the database and change the path structure like this (steps for moving from a Synology Nas (Server 1) to windows PC (Server2) , if you want to move from windows to linux, the path structure is of course the other way around. 


  1. Set up server 2, create new library pointing at the files on the NAS, start search and cancel immediately after.
  2. Turn off „Empty recycle bin automatically“
  3. Note root path by looking at a file, you need that later on.
  4. Stop both! servers.
  5. Create a Back up to a new folder with file station. The Database is found /var/packages/PlexMediaServer/shares/PlexMediaServer/AppData/Plex Media Server/Plug-in Support/Databases. Don‘t touch original database just in case something goes wrong. Also backup folders metadata and media.
  6. Adjust paths. Use "DB Browser for SQLite" (sqlitebrowser.org), SQLiteSpy is recommended in forums, but it did not work.a) Open the database com.plexamp.plugins.library.db, which can be found in Windows in the folder appdata/local/Plex Media Server/Plug-in Support/Databases. Click on the tab „Browse Data“.b) Then go to the section_locations table and change the root path as required for the new server.c) Change all single entries, because the slashes have to become backslashes. Also the root location is different. For a Music library, you have to go to the section „media_parts“ and there to the column „ file“ Replace slashes with backslashes using the commands update media_parts set file = replace(file, '/', '\');and e.g. update media_parts set file = replace(file, '/drive1', 'D:');.
  7. Save (very important! The UI looks like it automatically saves changes, but it doesn‘t)
  8. Replace .db on server 2. You may also replace Media and metadata which were backed up in step 2. If you have already sonic analysis files, move that folder too. 
  9. Restart server 2 and compare.