Server Version#: 1.42.2.10156
Player Version#: N/A
I was looking into why i had so many db -tmp files in my plex Databases directory and found similar topics.
the common thing here was that the db might be corrupted. i followed the steps outlined there and didn’t see any corruption or anything in any of the troubleshooting steps.
what i found is that these tmp files sticking around here is dependent on the path that i provide for the backups location.
if i use a path in my plex media server directory, the backup is created properly in that path of course, and i don’t have the -tmp files leftover in the Databases directory.
if i use a path in /mnt of a SMB mount to my NAS, the backup is created properly in the given NAS path as expected, and i see these -tmp files start to accumulate in the Databases directory!
i’m curious what plex’s mechanism is for creating this backup. in both cases, the destination directory gets the backup file created just fine. So its almost like plex creates this tmp file as its normal processing and just… doesn’t deleted it in that case?
i’m wondering if it is somehow related to the fact that Plex and my backup destination are on two different mount points? that doesn’t sound like it should be a forbidden thing or anything lol
has anyone else observed something like this? could this be an issue with my NAS mount setup via SMB? what would be the advice here?
i’d prefer to not have to script up something to copy the backup files from a local path to my NAS if possible just for having additional complexity to maintain and monitor.
You will have to examine permissions carefully. Since you are using SMB you have a mixture of linux and windows permissions active which is giving the Plex user the ability to create a file but not modify(rename) or delete.
not sure it would be permissions. the destination file on the NAS (SMB) is created correctly, so the user creating the file is able to write the destination file.
the file thats not getting deleted is inside the plex database directory which is a local disk. the same plex user owns everything on that mount. when i put the backup destination in another place in here, everything works fine so it likes that directory path.
as a test:
# become plex user
cd to plex Databases location
echo "this is a test" > foo.txt
mv foo.txt {destination on NAS}
this removes the foo.txt file and produces it at the destination.
if i repeat that with the -tmp file thats still there from the last backup attempt, i get the same results - the file is created on the NAS and removed from the Plex Databases directory.
perhaps it is not using “mv” to move the file, but something else? i dont know how plex does it so i’m not sure what to try. maybe plex does the backup as a different user or something?
dont have a very good answer - i’ve just always used SMB to mount my NAS on this share for whatever reason. i have it setup in ansible to add the mount when i recreate the machine so i just… haven’t had the need to change, i guess. i’ll try NFS and see if i can see a difference.
do you know of a way to manually kick off the plex database backup job? just so i dont have to wait three days each time i want to try it out? obviously i can copy the file myself but i already know that works (and doesn’t produce a tmp file because i’m just copying a file…)
ok, took me a bit, but i got the nfs mount working. same directory shared on the NAS, just getting to it via nfs now. made sure that my plex user is able to read/write/delete a file from the destination directory. updated my plex server settings to write to the new mountpoint.
now just waiting for it to make the next regularly scheduled back via the schedule tasks. looks like it will actually be tonight at midnight. if you know how to make it happen sooner, i’d love to test it out beforehand when i can report back on it
I can understand the tendency to use SMB.
Windows has no knowledge of NFS. ( it should )
Folks who transition to Linux from Windows tend to use SMB out of familiarity
I know it runs during Scheduled Tasks
I think there’s an API endpoint for it but not certain.
I’ll look into that (read all the API documentation)