# Library Restore After Clean Install

**URL:** <https://forums.plex.tv/t/library-restore-after-clean-install/568032>\
**Category:** Plex Media Server\
**Tags:** server-linux\
**Created:** [April 5, 2020, 12:26am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032 "2020-04-05T00:26:36Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorydmelton\_yahoo.com](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@gregorydmelton\_yahoo.com](https://forums.plex.tv/u/gregorydmelton_yahoo.com)\
**Post date:** [April 5, 2020, 12:26am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/1 "2020-04-05T00:26:36Z")

</div>

Server Version#:  
Player Version#:  
  
I recently installed a fresh install of Plex Media Server on Ubuntu after removing the old install including all of the data and database files. I had a backup of the library database, but when I add the file to the database folder it breaks the server. I checked and Plex is the owner of the file. Any thoughts?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 5, 2020, 12:56am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/2 "2020-04-05T00:56:31Z")

</div>

How much of it did you “remove”? Did you remove user plex completely? Did you remove “/var/lib/plexmediaserver” ?

---

<div class="post-metadata">

**Author:** ![gregorydmelton\_yahoo.com](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@gregorydmelton\_yahoo.com](https://forums.plex.tv/u/gregorydmelton_yahoo.com)\
**Post date:** [April 5, 2020, 12:58am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/3 "2020-04-05T00:58:52Z")

</div>

Yes, I deleted everything.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 5, 2020, 1:01am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/4 "2020-04-05T01:01:09Z")

</div>

1. Make certain user `plex` has also been deleted (userdel)
2. Fresh install PMS and let it create the base environment again for you.
3. Once installed,
4. Stop it
5. `cd /var/lib/plexmediaaserver`
6. `sudo mv Library Library.unused`
7. untar / unzip your backup there
8. `sudo chown -R plex:plex .` to set ownership again.
9. Now start it normally.

---

<div class="post-metadata">

**Author:** ![gregorydmelton\_yahoo.com](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@gregorydmelton\_yahoo.com](https://forums.plex.tv/u/gregorydmelton_yahoo.com)\
**Post date:** [April 5, 2020, 1:07am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/5 "2020-04-05T01:07:06Z")

</div>

I only have the library.db file as a backup and it’s not a zip. Do I just paste it into that folder?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 5, 2020, 1:07am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/6 "2020-04-05T01:07:33Z")

</div>

Nope. start over.  
It’s more effort to use just that DB than it is to start from scratch

proper backup makes a ZIP or `tar.gz` of `./Library`

> [@Back up/ Restore /clone your PMS metadata](https://forums.plex.tv/t/back-up-restore-clone-your-pms-metadata/212202):
>
> Backing up your PMS data involves the same steps you’ll need if you were to clone your PMS and take to a new computer, reinstall the operating system, or just want a backup for safe keeping. Stop PMS Invoke the root shell Create the backup image [chuck@lizum ~.74]$ sudo sh sh-4.4# cd /var/lib/plexmediaserver sh-4.4# tar cfz /nas/tmp/PlexBackup.tar.gz ./Library sh-4.4# ls -la /nas/tmp/PlexBackup.tar.gz -rw-r--r--. 1 root root 864050144 Oct 29 15:29 /nas/tmp/PlexBackup.tar.gz sh-4.4# Copy …

---

<div class="post-metadata">

**Author:** ![gregorydmelton\_yahoo.com](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@gregorydmelton\_yahoo.com](https://forums.plex.tv/u/gregorydmelton_yahoo.com)\
**Post date:** [April 5, 2020, 1:11am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/7 "2020-04-05T01:11:25Z")

</div>

So there isn’t a good way to restore my watched/unwatched and newly added data?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 5, 2020, 1:12am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/8 "2020-04-05T01:12:46Z")

</div>

AFTER you build up a new system, we can transfer the watched status.

As you stand right now, you have no existing metadata at all.  
You only have a database with pointers to non-existing media linkages.

Sorry for the analogy? You have the easter egg but don’t have the basket to put it in.

---

<div class="post-metadata">

**Author:** ![gregorydmelton\_yahoo.com](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@gregorydmelton\_yahoo.com](https://forums.plex.tv/u/gregorydmelton_yahoo.com)\
**Post date:** [April 5, 2020, 1:23am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/9 "2020-04-05T01:23:36Z")

</div>

Ha, I appreciate the analogy. So I do have a fresh install and all metadata has been downloaded. The install works, but if I try to replace the library.db file then it breaks the new install. If I revert back to the newly created library.db then it works again. I was hoping there is a way to use the old library.db with the new install.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 5, 2020, 1:40am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/10 "2020-04-05T01:40:56Z")

</div>

You can’t replace the existing database and expect it to work.

You must export the watch history from it and import into the new database.

> **[Move Viewstate/Ratings from One Install to Another | Plex Support](https://support.plex.tv/articles/201154527-move-viewstate-ratings-from-one-install-to-another/)**
>
> The watched/unwatched, view progress, and ratings are stored in an install-independent fashion that makes them easy to move between installations...

The old DB is the source.  
The current DB is the destination.

---

<div class="post-metadata">

**Author:** ![gregorydmelton\_yahoo.com](https://avatars.discourse-cdn.com/v4/letter/g/9e8a1a/32.png) [@gregorydmelton\_yahoo.com](https://forums.plex.tv/u/gregorydmelton_yahoo.com)\
**Post date:** [April 5, 2020, 1:46am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/11 "2020-04-05T01:46:45Z")

</div>

Gotcha. And I assume the newly added status of a file is a victim to the new install since all files are newly installed?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [April 5, 2020, 3:30am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/12 "2020-04-05T03:30:53Z")

</div>

Correct. All the status values will be incorrect because, as far as the DB is concerned, you’ve never watched any of it until you insert the history (which added the watch history).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [July 4, 2020, 3:30am UTC](https://forums.plex.tv/t/library-restore-after-clean-install/568032/13 "2020-07-04T03:30:54Z")

</div>

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