Moving Libraries to an NAS from current Plex Server

Server Version#: 4.116.1
Player Version#: N/A

I have a Plex server running on an older Debian system. For reasons I don’t want to get into, the server was not updated for a good while. Today I ran into issues with the iOS version of Plex - it would no longer work with Airplay, so I updated the iOS app and found it won’t work with my Plex server.

I’m temporarily setting up a new server on a Pi 4 (from what I read, a Pi 3 has problems with multiple streams at times and with transcoding some codecs, but I could not find anything clearly indicating a Pi 4 had problems with Plex).

A while back my media library outgrew the system Plex was on, so I moved it to an NAS and used Samba, on the Plex server, to mount all the directories on the NAS on the local system so Plex thought the library was still local. My plan, for well over a year, has been to replace the current server with a new one. It’s just been an issue of finding the time to do it. Right now the Pi 4 is a temporary system, since I need my iOS app to work. (I can’t sleep in silence. I’ve been using Plex on my iPhone to provide the background noise I need.)

I think the easiest way will be to set up my new Debian system, setup Samba so it’s like the old server, then copy the settings from the old server to the new one. (I see there are a few articles about how to do that and it doesn’t look like it’s any kind of issue.) But once that’s done, I’d like to eliminate the need for Samba. I don’t want to lose anything like my library configurations, or information about what videos have and have not been played. Is there any way to tell Plex, “This library that used to be here is now here. It’s all the same, just now it’s on an NAS, on this share?”

PMS is stored, by default, under /var/lib/plexmediaserver

In a Linux → Linux transfer, the process is quite simple.
(I know a Pi is a bit different so adjust paths accordingly)

Existing Host

  1. Stop PMS
  2. sudo bash
  3. cd /var/lib/plexmediaserver
  4. tar cf /path/to/somewhere/safe/PMS.tar ./Library
    – ^ This step makes a tar ball clone of the existing server

New Host

  1. Install PMS
  2. sudo bash
  3. systemctl stop plexmediaserver
  4. cd /var/lib/plexmediaserver
  5. mv Library Library-empty
  6. tar xf /path/to/somewhere/safe/PMS.tar
  7. chown -R plex:plex ./Library
  8. rm -rf Library-empty

If you’ve kept all the mount points,
AND ensured user plex:plex can read the data from the NAS,
start it up

systemctl start plexmediaserver


Be advised-

  1. This new machine is a perfect clone of the old one
    – It’ll have the same ID numbers
    – All metadata & history in the databases will be retained.
    – The only default difference is the Friendly name (default is the hostname)

  2. Check your Server settings to account for new things you can do & are different on this new hardware

Lastly – Delete all the PMS data from the old host. If you start it up, the two will collide in Plex.tv and make for confusing behavior with the players

Don’t hesitate to ask questions. This writeup assumes you’ve got fair mastery of Linux command line.

Thank you - looks easy to move from one place to the other.

But you mention if I’ve kept the mount points. Since my media library is now on an NAS, I’d really like to be able to point to it there, instead of having to use Samba mounts on my PMS system to have the same mount points. So is there some way I can change the pointers to my libraries within the Plex data structure or in its database?

I’m not understanding what you mean by “Samba mounts” here ?

Do you mean UNC path names ?

Can you show me?

Do you mean you have a local mount folder that you’ve told Plex is the library for movies? Something like:

/mnt/fs01/movies -- CIFS mount to \\fs01\movies -- Plex Library: Movies

Are you wanting to move that media BACK to the “new” server? Ideally, you’d leave the media on the NAS and setup CIFS or NFS mounts to the NAS folders that contain the actual media. Then your Plex library definition is /mnt/fs01/movies for the Movie library.

If you stay on the NAS method for media, you can follow the steps @ChuckPa gave, setup the same CIFS/NFS mounts to the NAS as you currently have, and Plex should just work. Assuming you maintain the same structure of folders for the mount entries to bind to.

It sounds like the preferred way to handle this, then, is to use Samba to mount the libraries on the PMS computer. Do I get that correctly?

While Samba is pretty reliable, I have had a few times where I lost power and, on reboot, the CIFS mounts didn’t mount. I was thinking it’s just one more piece of a system and that, if I could eliminate it, it might simplify things a little, so I was hoping that there might be an easy way to tell Plex that all my libraries that were at

/data/Library02

(under my original system, and still there when I moved them and used Samba mounts) are now at

//mynas/Library

(which would point Plex to my NAS directly, with no need of adding in Samba)

But, as far as that goes, even being able to change /data/Library02 to /data/Library would be useful, since I have several libraries and this is now the main one, so having it in a folder “Library02” makes me have to stop and think things through sometimes.

From what I’m reading, it seems that the preferred method would be to continue to use a CIFS mount point and to not tell Plex to use a different path for the same libraries. Am I understanding that correctly?

A few things here:

  1. You can do something kludgy like I do to ensure that mount points are picked up in the event of a NAS/file server reboot. (Note: this isn’t considered… good practice, but it works)
# Force a mount of all mount points to pick up the NFS share on fs01, then repeat this command every 15 mins in case of a FS reboot
@reboot (sleep 15; mount -a)&
*/15 * * * * mount -a >/dev/null 2>&1
  1. The issue with Library vs Library02 is only really important in what folders you told Plex via the UI were to be used for your library. Either way you do it, the media exists in a location that Plex has to know about. How are the libraries defined within Plex currently? And where is the actual media located – on the Plex machine under /data/Library02 or on the NAS?

  2. Keeping the CIFS mount point and making identical folders on the new server to use as the mounts is ideal. That way your media stays residing on the NAS, the folders are just CIFS pointers to that NAS, and the folder structure on the NAS can change if you need it to without having to do anything on the mount points.

May I ask why using CIFS in a Linux environment ?

You have NFS available to you which is far less restrictive

I might do that, but the issue has been more on reboots. We live in a rural area and have a standby generator, which takes about 45 seconds to kick in. I have my devices on a UPS and that keeps everything up while the generator kicks in. But no system is perfect and I’m not at a point where I can spend enough to try to reach even five 9s in reliability! So sometimes something has to reboot. But I like your suggestion and may start using it.

The issue is mainly for me. I have a few different libraries, including my media library. And when I made some changes, and reinstalled Plex and some other programs a while back, I got stuck having to change directories around, so my media library got moved from /data/Library to /data/Library02. Plex doesn’t care - but I do. I really wish I could re-order my library directories (I have 4), since this confuses me.

I have a number of libraries, for instance, I have a directory TVShows. In it I have multiple directories and, due to how Plex handles libraries, each directory is a separate library, so I have Drama, Comedy, ScienceFiction, and so on. All are in /data/Library02/Video/TVShows. I defined them through the web UI, so I don’t know how they’re stored by Plex. But if I changed it so all those were in /data/Library/Video/TVShows, I’d want to do it but also keep all the metadata, such as which ones have been watched and so on.

I much prefer NFS, but when I set this up, a lot of it had to be available to other family members who use Windows. But that decision was something like 7 or 8 years ago, so I don’t remember all the reasons I went with CIFS. I’m not thrilled with it, but don’t hate it, and there are other systems that use the media library on the NAS and I don’t want to have to go through and reconfigure multiple systems.

Thanks for explaining.

First, have you seen this?

The “trick” with PMS about moving your media files is to know how the DB and scanner work.

Here’s the How-To I wrote to help with the move process.
You can do everything at once or one library section at a time – your choice.

When I need to test CIFS on Linux with PMS, since the mount is done with my Linux username, the important thing to remember is the ,allow_others mount option in /etc/fstab

This way you can mount the shared folder, using CIFS, wherever you want (don’t forget chmod 755 before mounting) and user plex will be able to read it

If you have questions, don’t hesitate to ask

Thank you - it looks like that’s what I want. I’m tied up, so it may be a day or so before I can read it and try it, but it looks like that’s just what I want. (Sadly, it didn’t show up when I was searching on Google.)

Okay, finding a problem with the simple migration that you (@ChuckPa ) did such a good job of writing up for me.

I couldn’t use my iOS app with the old server I had because, well, the old server was old! So now I’m on my iPhone and trying to find a way to tell it to go to the new server and I can’t find anything in settings that makes sense.

How do I point my iPhone to the new server? (The old server has been stopped with systemctl and I’ve migrated all the data and started the new server with systemctl and see it running when I use ps aux.)

Also, on my iOS app, it says the server will need to be updated to version 1.412 or newer. When I go to the new server with a browser to check the version, it’s version 4.145.1. This seems like a wide gap. True, it’s been a few years since I updated my old server, so that might explain why my iOS app didn’t work with the old server, but is there some other reason my app won’t find this server (which works fine through Chrome) on my LAN? (We can rule out things like address space, wifi issues - it shouldn’t have issues seeing the server unless there’s something up with Plex.)

I have it working. I haven’t had the time (and it’ll be awhile before I do) to change the locations so Plex will go straight to my media server NAS instead of requiring mounted shares. Getting the new server up and running, by following the instructions here, was not hard at all. Worth noting that I did have to go in and turn on Remote Access. (I understand now that PMS looks for things to change and when they do, it disables that.) Once I did (by using the web interface on the new server), then went to my account on plex.tv and everything connected.

It’s important to do that before trying to use Plex on mobile devices if the server changes!

Once I had it all working, I “decommissioned” my older server, gave it a new name on the LAN, and changed the IP address. Then I changed the name on my new server to match the old one and move it to the old one’s IP address. That way, for most of my devices that have Plex on them, it became a “drop in” replacement.

The new iOS app has some problems. For instance, once I played any video, it switched to landscape mode, and there are times I don’t want that. (I’ve had to turn off the Alarm Mode, or whatever it’s called, on my iPhone, since that has, in the past, fought with Plex when I put my iPhone on a magsafe charger in landscape positioning.) Also, Plex does not do AirPlay now. It has the icon for it, but touching it does nothing. Instead I had to use Screen Mirroring in the iOS control panel you get by swiping down from the upper right corner of the screen.

Also, my previous settings didn’t transfer to the new app. I need background noise to sleep and woke up after a couple hours because my phone had stopped playing. It turns out “Nanny Mode” (Plex calls it “Passout Protection”) was re-activated when I upgraded to the latest version. That was an easy fix, though.

And playlists - I don’t get why there was any need to change that around. Now, instead of being able to get to all playlists, the playlists are found in the libraries they’re related to. (And, really, it makes no sense why playlists could not be left in the menu that comes up when you touch the button to pick the library to use.)

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.