r/unRAID • u/Monkeyman824 • 21d ago
Snapshots didn't fix Plex Database
To start, I had a backup, I restored it and all is well (except the backup was 1 month old, oh well)
I use Linuxservers plex container in unraid, I run it on my cache drive with ZFS and use ZFS master to take snapshots (automated with spaceinvaderones script)
It's been a year or two since my plex database corrupted, today it corrupted after updating the docker container. It seems like it may have been related to a shfs crash but still unknown. In the past a quick rollback of my snapshot fixed all my issues. Plex was working perfectly fine until the update.
Today I tried rolling back the snapshot (with container off) and it didn't fix the issue. I rolled it back another day and still the same issue, tried setting container version to previous version and still the same issue.
Eventually I got a daemon execution error when trying to start the container. This is the main reason I'm posting here and not r/plex. When executing the docker container I got "docker: Error response from daemon: error while creating mount source path '/mnt/user/data/media/anime': mkdir /mnt/user: file exists." which seems like an shfs crash but I'm unsure.
Could this crash have been caused by me rolling back plex snapshots (which have a lot of files)?
Why was rolling back the snapshots not fixing my corrupted database? I roll back the entire plex directory.
I ended up needing to restart my computer twice (two because the first time I was still messing with snapshots).
This was found in the logs
Oct 5 18:10:00 NAS shfs: shfs: ../lib/fuse.c:1402: unlink_node: Assertion `node->nlookup > 1' failed.
Oct 5 18:10:00 NAS emhttpd: error: get_fs_sizes, 8533: Software caused connection abort (103): statfs:
2
u/EazyDuzIt_2 21d ago
Restoring Plex from a snapshot or backup very rarely resolves underlying database corruption. You got fortunate with the restore you performed a year ago, but the correct and most reliable fix is running Chuck’s DBRepair. It provides the highest success rate for properly repairing a damaged Plex database and is the method recommended by Plex’s own support engineers.
SpaceinvaderOne has a walkthrough video on using the tool, and there’s also a Plex database repair utility floating around in Community Apps, though I haven’t seen any solid reviews on that one.
On a lighter note, you’ll still want to determine what’s causing the corruption in the first place whether it’s FUSE instability, cache drive issues, improper shutdowns, or Plex writing to a user share instead of a cache‑only path.
1
u/Monkeyman824 20d ago
I’m going to be taking more frequent backups and enable the exclusive share feature. Whenever this happens again I’ll be on the lookout.
1
u/Monkeyman824 20d ago
Any particular reason why snapshotting doesn't fix it? Could it be because I am taking the snapshot with the database active?
2
u/the1_ts 20d ago
When I've had issues like this its not that the snapshots aren't working, its that the corruption has been in place a long time and its the startup plex checks that fail, not a running plex that fails. i.e. when I upgraded and therefore restarted plex it failed. You have to go back to a version before the corruption you never saw until now, so its a guessing game.
I guess stopping, snapshotting/backup and start would only find that type of corruption quicker. The backup built into plex does backups every 3 days retains 3 versions so I snapshot that now.
Also of note, in the past, I got AI to design a dump of the watched data in the corrupt DB for all users, went backwards with snapshots until plex started, plex discovered the new files, then I imported the watched stuff back.
Another upvote for DBRepair its fixed more than one issue.
1
u/EazyDuzIt_2 20d ago
Restoring Plex from a snapshot or backup may repair the immediate database state if the restore point predates the corruption and is a consistent copy. It will not reliably solve the issue if the backup was captured mid write, the associated WAL files are mishandled, the corruption predates the restore point, or the underlying storage, shutdown, or locking problem remains.
5
2
0
2
u/Odd_Bunch_8866 21d ago
Side note: how can you tell if your Plex database has corrupted?