# PMS keeps tmp files in the Databases directory

**URL:** <https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278>\
**Category:** Plex Media Server\
**Tags:** server-linux, library-management\
**Created:** [May 10, 2022, 12:35pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278 "2022-05-10T12:35:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmdrl](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dmdrl/32/12827_2.png) [@dmdrl](https://forums.plex.tv/u/dmdrl)\
**Post date:** [May 10, 2022, 12:35pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278/1 "2022-05-10T12:35:46Z")

</div>

Server Version#: 1.26.0.5715

Hi All,  
PMS keeps some db-tmp files in the Databases folder and doesn’t delete then upon backup.  
I have network folder mounted to /mnt/backup, where PMS stores its backups and it actually does, but for some reason it doesn’t remove those identical files from database folder:

Here is what i have now in database folder:

```auto
:/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases$ ls -l total 1645600
-rw-r--r-- 1 plex plex 25600 May 7 2021 com.plexapp.dlna.db
-rw-r--r-- 1 plex plex 32768 May 7 2021 com.plexapp.dlna.db-shm
-rw-r--r-- 1 plex plex 110072 May 7 2021 com.plexapp.dlna.db-wal
-rw-r--r-- 1 plex plex 201673728 May 6 01:02 com.plexapp.plugins.library.blobs.db
-rw-r--r-- 1 plex plex 198144000 Apr 29 01:02 com.plexapp.plugins.library.blobs.db-2022-04-29-tmp
-rw-r--r-- 1 plex plex 201675776 May 2 01:02 com.plexapp.plugins.library.blobs.db-2022-05-02-tmp
-rw-r--r-- 1 plex plex 201675776 May 5 01:00 com.plexapp.plugins.library.blobs.db-2022-05-05-tmp
-rw-r--r-- 1 plex plex 201673728 May 8 01:02 com.plexapp.plugins.library.blobs.db-2022-05-08-tmp
-rw-r--r-- 1 plex plex 32768 May 9 15:19 com.plexapp.plugins.library.blobs.db-shm
-rw-r--r-- 1 plex plex 0 May 9 15:19 com.plexapp.plugins.library.blobs.db-wal
-rw-r--r-- 1 plex plex 137314304 May 10 15:23 com.plexapp.plugins.library.db
-rw-r--r-- 1 plex plex 134221824 Apr 29 01:01 com.plexapp.plugins.library.db-2022-04-29-tmp
-rw-r--r-- 1 plex plex 132595712 May 2 01:01 com.plexapp.plugins.library.db-2022-05-02-tmp
-rw-r--r-- 1 plex plex 136159232 May 5 01:00 com.plexapp.plugins.library.db-2022-05-05-tmp
-rw-r--r-- 1 plex plex 135159808 May 8 01:02 com.plexapp.plugins.library.db-2022-05-08-tmp
-rw-r--r-- 1 plex plex 32768 May 10 15:27 com.plexapp.plugins.library.db-shm
-rw-r--r-- 1 plex plex 4536152 May 10 15:27 com.plexapp.plugins.library.db-wal

```

And this is mounted backup folder (as you see backup size is identical, the only exception is file name which ends with -tmp in Databases folder):

```auto
/mnt/backup$ ls -l
total 1007787
-rwxrwxrwx 1 root root 198144000 Apr 29 01:02 com.plexapp.plugins.library.blobs.db-2022-04-29
-rwxrwxrwx 1 root root 201675776 May 2 01:02 com.plexapp.plugins.library.blobs.db-2022-05-02
-rwxrwxrwx 1 root root 201675776 May 5 01:00 com.plexapp.plugins.library.blobs.db-2022-05-05
-rwxrwxrwx 1 root root 201673728 May 8 01:02 com.plexapp.plugins.library.blobs.db-2022-05-08
-rwxrwxrwx 1 root root 134221824 Apr 29 01:01 com.plexapp.plugins.library.db-2022-04-29
-rwxrwxrwx 1 root root 132595712 May 2 01:01 com.plexapp.plugins.library.db-2022-05-02
-rwxrwxrwx 1 root root 136159232 May 5 01:00 com.plexapp.plugins.library.db-2022-05-05
-rwxrwxrwx 1 root root 135159808 May 8 01:02 com.plexapp.plugins.library.db-2022-05-08

```

Does anybody knows why is it happening?

Thanks.

---

<div class="post-metadata">

**Author:** ![pl\_5309](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pl\_5309](https://forums.plex.tv/u/pl_5309)\
**Post date:** [May 10, 2022, 2:32pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278/2 "2022-05-10T14:32:32Z")

</div>

Those files are created when Plex tries to create a backup file every 3 days. If you are not receiving messages from Plex that “Database Backup Successful” then I would do database repair on the library and blogs db’s.

---

<div class="post-metadata">

**Author:** ![pl\_5309](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pl\_5309](https://forums.plex.tv/u/pl_5309)\
**Post date:** [May 10, 2022, 2:37pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278/3 "2022-05-10T14:37:47Z")

</div>

Also the permissions on the backup folder should be plex:plex . Who owns /mnt/backup?

---

<div class="post-metadata">

**Author:** ![dmdrl](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dmdrl/32/12827_2.png) [@dmdrl](https://forums.plex.tv/u/dmdrl)\
**Post date:** [May 10, 2022, 4:47pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278/4 "2022-05-10T16:47:28Z")

</div>

Hi,  
Is it really mandatory plex to be owner of the backup folder?  
Currently root is the owner, but ACL is as follows rwxrwxrwx - should be enough. And as we can see PMS is able to write backups there, the problem is that it don’t clean up tmp files once backup is done.

Checked the logs and found following:  
`Couldn't rename file "/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-in Support/Databases/com.plexapp.plugins.library.db-2022-05-08-tmp" to "/mnt/backup/com.plexapp.plugins.library.db-2022-05-08": Operation not permitted`

So you might be right.  
Changed fstab option to make plex:plex owner of the mounted folder.  
Let’s check on how backup will go tonight.

Thanks.

---

<div class="post-metadata">

**Author:** ![pl\_5309](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@pl\_5309](https://forums.plex.tv/u/pl_5309)\
**Post date:** [May 10, 2022, 4:52pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278/5 "2022-05-10T16:52:00Z")

</div>

You should verify the correct permission inheritance by unmounting the backup drive, chmod plex:plex /mnt/backup then remount.

---

<div class="post-metadata">

**Author:** ![dmdrl](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/dmdrl/32/12827_2.png) [@dmdrl](https://forums.plex.tv/u/dmdrl)\
**Post date:** [May 15, 2022, 6:45pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278/6 "2022-05-15T18:45:28Z")

</div>

yes. the issue is solved now.  
Thanks for your help.

---

<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:** [August 13, 2022, 6:46pm UTC](https://forums.plex.tv/t/pms-keeps-tmp-files-in-the-databases-directory/792278/7 "2022-08-13T18:46:00Z")

</div>

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