Upgrade Ubuntu 18.04 to 20.04.1 - keep Plex database

Server Version#: 1.19.5.3112
Player Version#: 4.39.1

I’ve read a few other posts on a similar topic, but the answers involved Linux terminology that ended up over my head. I only switched to Ubuntu a few months ago after Windows 7 ended support, and don’t really do much with the OS itself. I was just hoping somebody can give me a dumbed down explanation.

I’m on Ubuntu 18.04. From what I understand, 20.04.1 will be out very soon, and I would like to upgrade because I hear it’s much lighter and faster. My questions are:

  1. Will upgrading through the Software Updater erase my Plex database? All my actual files are on an external drive, so I know they’re safe. I know I may have to re-install a few programs, just wasn’t sure what folders are left alone when doing an upgrade.

  2. If the database is in danger, what do I need to do to make a copy and then restore it? I read this article:
    https://support.plex.tv/articles/202485658-restore-a-database-backed-up-via-scheduled-tasks/
    about restoring back ups. I currently have some back ups, and what I think is the actual database, in a folder here “/var/snap/plexmediaserver/common/Library/Application Support/Plex Media Server/Plug-in Support/Databases” which I think is the default location. I don’t remember changing it anyway. I just wasn’t sure if this is only where back ups were, or the actual current database. In the article I mentioned, I also wasn’t sure what the “correct directory” mentioned in step #3 was. Step #4 also mentions possibly updating read/write permissions, but I don’t know how to do that. If I want to restore the “current” database, not one of few day old back ups, can I just make a copy of every file in this location, and then put it back in this same location once I’m done upgrading and re-installing?

  3. Even when I was on Windows before, I never had to back up, restore, or move my database for any reason. What all is included? I’m assuming (and hoping) it will save all the collections, sharing, watched status, fixed matches, and any other metadata I’ve edited manually… but wasn’t sure if there was anything like that that was not included in there.

Thanks for any help anybody has to offer!

I don’t think an update should cause any problems with a current install. but back up the entire /var/snap/plexmediaserver/common/Library/Application Support/Plex Media Server/ directory , not just the database file if you want your server to be exactly like before

The database file while it contains lots of stuff much the the metadata for files is stored elsewhere in those folders. many of the prefs and things are stored in the preferences.xml file which is also in that folder

The reason the article if only about restoring the database is that db files can pretty easily get corrupt if something bad happens while the server is writing to the database.

If I may augment here.

As long as you are doing a live upgrade (not one where you use a USB thumb drive) to do the upgrade, you’ll be ok.

Live upgrades do not reformat the system or remove anything.
They are intended to change the system software only.

I do recommend shutting down Plex before starting the upgrade

Thanks for that. That should be easy enough. Still new to Ubuntu, so not really sure what all the var, srv, usr, and all those other folders are. I know my home folder, and my external drive, and that’s about it. I only found the folder I did because I could see in Plex that that’s where it was backing up to.

I do have an installation CD I downloaded for 20.04 that I made just to boot into and test it out, but never used it to install, for just that reason. I just wasn’t sure. I’m glad I waited. I’ve just been waiting for 20.04.1 because that’s when it’ll just come through the normal system updates… from what I understand anyway.

Well I guess now I have a stupid question… in Windows, I only knew how to actually stop the server by using the icon in the taskbar. I don’t seem to have anything like that in Ubuntu, and clicking the Plex icon only opens Plex in a browser tab. I did a quick Google search and found this - sudo service plexmediaserver stop

So, it sounds like I’ll want to…

  1. Copy “/var/snap/plexmediaserver/common/Library/Application Support/Plex Media Server/” to my external drive somewhere.

  2. Run sudo service plexmediaserver stop from the Terminal

  3. Install the upgrade

  4. Replace the “/var/snap/plexmediaserver/common/Library/Application Support/Plex Media Server/”

  5. Then I can reboot, and Plex should start up the server and everything should be how it was.

Is that right? It all seems a bit easier than I was thinking it would be,

  1. You do have the service plexmediaserver start|stop part right but that doesn’t work for snap. snap is its own unique mechanism. IMHO, it’s more trouble than it’s worth with Plex because Plex needs data from your NAS (most cases) which isn’t easily doable in SNAPS. Maybe I’m thinking of it wrong but I’ve always had more success using the native package.

  2. There is currently a problem with hardware transcoding and SNAPS. It does work correctly for the Native package. We are testing an update for Snap packaging but i have no word on when that’ll be ready.

  3. Rather than using cp , I would do it the “Linux way”

sudo bash
cd /var/snap/plexmediaserver/common
tar cfz /home/my_username_here/PlexBackup.tar.gz .

Now I have a single file which contains everything with the right dates and permissions. When I restore it, reverse the process, it will be back as if never gone. (backup/restore thinking here)

Just curious - If I did switch to a non-Snap, I assume my installation would then be somewhere other than var/snap, correct? And I could move my existing database to that new location?

I will most likely stick with what I have though. I’ve actually had very few problems. I don’t have a NAS (I’m assuming you mean network attached storage, but could always be another Linux thing I don’t know). As for hardware transcoding… I can’t say I honestly know what that is really for, but I think that’s helpful when streaming large videos, right? 99.99% of my library is SD, and probably at a bitrate that most people would find unwatchable, based on what I read on other posts. But it works for me.

As for stopping the snap service, I found this

which looks, simple enough:

sudo snap services
sudo snap stop xxxxxxx

And then I assume a reboot would restart it. Or maybe “sudo snap start”

Now to the database itself. Whether I copy or make the tar.gz file… my “/var/snap/plexmediaserver/common/Library/Application Support/Plex Media Server/” folder is 160+ GB. I’ve got the space for this one time back up, but that’d be a large file to keep around if I wanted to keep it around (and maybe periodically re-create) as a back up. While I definitely want to save all the manual editing and preferences, I can only assume that a very large amount of that is video thumbnails. I want to have those, but wouldn’t mind if Plex had to re-create them later. Assuming that’s what causes a database to be that size, is there a folder I could exclude to leave them out? Or would it be easier to just turn them off and delete them from within Plex settings, and then turn them back on after the re-install?

And, just for my Windows brain… sudo… bash… I’ve heard the terms, but again, while I can copy/paste commands into the terminal if that’s how it needs to be done, I never really know what the things mean when I’m doing it.

I found I can right click on the folder, select compress, and then pick either a zip, 7z, or tar.xz archive format. Would that be just as effective? Or is there something about the tar.gz format and the sudo command that helps preserve the dates and permissions, like you mentioned?

i’m going to ask a strange question.

Why Linux for Plex?

Linux may be more efficient than Windows and yield better results but it has a steep learning curve.

Plex on Linux expects you have that basic administrative mastery of it.

My desktop computer which runs Plex was originally running Windows 7. When support for that ended, I had to do so something, and the computer was supposedly not compatible with Windows 10. I didn’t want to pay for Windows 10 anyway. So I had a couple options… use my Windows 10 laptop as my main computer and server (which would have worked okay since the media is all on an external drive anyway, but then I’d have no server available if the laptop was away from the desk), or put Linux on the desktop and fumble my way through. It’s been easy enough so far.

Most of what I do on the computer doesn’t require any expertise of terminal commands or anything like that. I did know my way around Windows, so using the GUI for everything has worked fine so far. I’m sure I am not what you would consider a typical Linux user in that I don’t know all (or maybe any) of the different terms and commands. That’s partly because I haven’t had time to really dig in and get around and learn. But it’s also mostly because I haven’t had any reason to learn that kind of thing. So far, I can use all the same programs I was in Windows, and everything just works.

1 Like

linux doesn’t have to be complicated, and it isn’t, unless you want to dig in and do complicated things.

like many things, linux is simply a tool. You don’t have to be in construction to use a hammer (or insert tool of choice), but having construction experience may help you use the hammer more effectively.

all that said, linux can be very powerful, and as the saying goes, with great power comes great responsibility.

linux tends to have less safe guards than win/mac, but as long as your careful, and be sure to exercise google before diving into anything unknown, you should be fine continuing on the way you are.

eventually you will likely grow comfortable with that you already know/work with, and then your own curiosity will expand your knowledge/experience as you go.

enjoy.

2 Likes

Upgrade went smooth without even having to back up anything. I just knew when upgrading from a CD, it gave options of erasing everything, dual booting, etc. Wasn’t sure how upgrading directly through regular system updates would work. Perfectly, as it turns out. Thanks!

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