Corrupted DB on qnap NAS

Server Version#: latest
Player Version#: latest

I had plex not opening and tried for 4 days with no success. I have 5 backups (over 10days) of the databases.

So i have done a fresh install which of course has the watched info missing. I have over 10,000 watched shows and movies info now missing . The database 5 backups I added to the correct folder
but none would open as per the original.
My question is there software that might check these DB and see if corrupt and fix .

I would really like my watched info back !!

If you restore the corrupt database ChuckPa as a nice tool for fixing that:

Thanks, I have gone over the readme several times.

I want to check plex DB on 2 Qnap NAS but can’t even get to the install part .

I do have the folder extracted :+1:

Your best bet is reading here, and asking questions.

@ChuckPa Any chance you can provide some guidance?

1 Like

thanks Dbirch
And thanks Chuckpa if u can give me “Fix Plex DB with PlexDBRepair for dummies”

The ‘Fix DB for dummies’ on QNAP

  1. Get the file and put in /share/Public
  2. SSH / Putty into the box
  3. sudo bash to gain root privilege
  4. cd /share/Public
  5. tar xf PlexDBRepair*.tar.gz (if you got the tar.gz file
  6. chmod +x DBRepair.sh
  7. ./DBRepair.sh stop auto start exit

:sunglasses:

PS: If you want to interact with the new UI,

./DBRepair.sh

then you can type the sequence of commands (one at a time)

  1. stop

  2. auto

  3. start

  4. — check PMS and confirm working

  5. — If good – then type ‘exit’

  6. — If not, ‘replace’ and let it find the most recent backup to use and install for you

Thanks Chuck
With lots of trial and error I managed to ‘repair’ my DB to the stage it works .
But some of my watched is missing !!

THe repair gives me this message when trying automatic

./DBRepair.sh: line 208: [: 74%: integer expression expected
Error: Unable to run automatic sequence. Insufficient free space available on /share/CACHEDEV4_DATA/.qpkg/PlexMediaServer/Library
Space needed = 8457 MB, Space available = MB

Enter command # -or- command name (4 char min) : 6

./DBRepair.sh: line 208: [: 74%: integer expression expected
Error: Unable to perform processing. Insufficient free space available on /sh are/CACHEDEV4_DATA/.qpkg/PlexMediaServer/Library

The drive is 500gb and nothing on it except plex!!

Wow.

./DBRepair.sh: line 208: [: 74%: integer expression expected
Error: Unable to run automatic sequence. Insufficient free space available on /share/CACHEDEV4_DATA/.qpkg/PlexMediaServer/Library
Space needed = 8457 MB, Space available = MB

I will work on that. If you’re at that level, something is wrong because you should NEVER get a ‘%’ result from ‘stat’

    190 FreeSpaceAvailable() {
    191 
    192   Multiplier=3
    193   [ "$1" != "" ] && Multiplier=$1
    194 
    195   # Available space where DB resides
    196   SpaceAvailable=$(df -m "$AppSuppDir" | tail -1 | awk '{print $4}')
    197 
    198   # Get size of DB and blobs, Minimally needing sum of both
    199   LibSize="$(stat $STATFMT $STATBYTES "$CPPL.db")"
    200   BlobsSize="$(stat $STATFMT $STATBYTES "$CPPL.blobs.db")"
    201   SpaceNeeded=$((LibSize + BlobsSize))
    202 
    203   # Compute need (minimum $Multiplier existing; current, backup, temp and room to write new)
    204   SpaceNeeded="$(expr $SpaceNeeded '*' $Multiplier)"
    205   SpaceNeeded="$(expr $SpaceNeeded / 1000000)"
    206 
    207   # If need < available, all good
    208   [ $SpaceNeeded -lt $SpaceAvailable ] && return 0
    209 
    210   # Too close to call, fail
    211   return 1
    212 }

it tells me your df -m /var/lib/plexmediaserver isn’t structured like everyone.

What do you get with that command ?

[chuck@lizum Downloads.2020]$ df -m /var/lib/plexmediaserver/
grep: invalid max count
[chuck@lizum Downloads.2021]$ /bin/df -m /var/lib/plexmediaserver/
Filesystem     1M-blocks  Used Available Use% Mounted on
/dev/nvme0n1p2    124870 30689     94182  25% /
[chuck@lizum Downloads.2022]$ /bin/df -m /var/lib/plexmediaserver/ | tail -1 | awk '{print $4}'
94182
[chuck@lizum Downloads.2023]$ 

there’s no “%”

[~] # df -m /var/lib/plexmediaserver
Filesystem 1M-blocks Used Available Use% Mounted on
df: /var/lib/plexmediaserver: can’t find mount point
[~] #

Sorry


On QNAP, it’s not safe to specify (my fault)

df -h
Retaining all temporary work files.
[/share/Public] # df -h
Filesystem                Size      Used Available Use% Mounted on
none                    400.0M    316.1M     83.9M  79% /
devtmpfs                 23.5G      4.0K     23.5G   0% /dev
tmpfs                    64.0M      2.3M     61.8M   4% /tmp
tmpfs                    23.5G    164.0K     23.5G   0% /dev/shm
tmpfs                    16.0M         0     16.0M   0% /share
/dev/sdo5                 7.7M     52.0K      7.3M   1% /mnt/boot_config
tmpfs                    16.0M         0     16.0M   0% /mnt/snapshot/export
/dev/md9                499.5M    189.0M    310.6M  38% /mnt/HDA_ROOT
cgroup_root              23.5G         0     23.5G   0% /sys/fs/cgroup
/dev/mapper/vg1-lv1313
                         38.6M     40.0K     38.6M   0% /mnt/pool1
/dev/mapper/vg2-lv1312
                          6.4G     11.8M      6.4G   0% /mnt/pool2
/dev/mapper/cachedev1
                        379.0G    123.3G    255.1G  33% /share/CACHEDEV1_DATA
/dev/mapper/cachedev2
                         63.1T     48.0T     15.2T  76% /share/CACHEDEV2_DATA
/dev/mapper/cachedev3
                        403.2G     99.9G    302.7G  25% /share/CACHEDEV3_DATA
/dev/mapper/cachedev4
                        723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA
/dev/md13               417.0M    384.3M     32.7M  92% /mnt/ext
tmpfs                    32.0M     27.2M      4.8M  85% /samba_third_party
tmpfs                     1.0M         0      1.0M   0% /share/external/.nd
tmpfs                     1.0M         0      1.0M   0% /share/external/.cm
tmpfs                     1.0M         0      1.0M   0% /mnt/hm/temp_mount
tmpfs                     1.0M         0      1.0M   0% /share/.quftp_client
tmpfs                     8.0M         0      8.0M   0% /var/syslog_maildir
tmpfs                    16.0M         0     16.0M   0% /share/NFSv=4
/dev/mapper/cachedev1
                        379.0G    123.3G    255.1G  33% /share/NFSv=4/Public
/dev/mapper/vg1-snap10001
                        379.1G    175.0G    203.5G  46% /mnt/snapshot/1/10001
/dev/mapper/vg1-snap10002
                        379.1G    150.0G    228.6G  40% /mnt/snapshot/1/10002
/dev/mapper/vg1-snap10003
                        379.1G    158.8G    219.7G  42% /mnt/snapshot/1/10003
/dev/mapper/vg1-snap10004
                        379.1G    160.7G    217.9G  42% /mnt/snapshot/1/10004
/dev/mapper/vg1-snap10005
                        379.1G    161.9G    216.7G  43% /mnt/snapshot/1/10005
/dev/mapper/vg1-snap10006
                        379.1G    121.9G    256.7G  32% /mnt/snapshot/1/10006
/dev/mapper/vg1-snap10007
                        379.1G    122.5G    256.1G  32% /mnt/snapshot/1/10007
/dev/mapper/vg1-snap10008
                        379.1G    123.0G    255.6G  32% /mnt/snapshot/1/10008
/dev/mapper/vg1-snap10009
                        379.1G    123.3G    255.3G  33% /mnt/snapshot/1/10009
/dev/mapper/cachedev4
                        723.4G    535.3G    187.5G  74% /lib/modules/5.10.60-qnap/container-station
tmpfs                   100.0K         0    100.0K   0% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/lxd/shmounts
tmpfs                   100.0K         0    100.0K   0% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/lxd/devlxd
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/docker/overlay2/a9227a48297880850361362359b7591eeac2880241b6ea5451a0a770f3291c21/merged
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/docker/overlay2/6083c11ed7e53ae839434bb0d5ccf95cb7750c405961068e6dd6e5c8c830278a/merged
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/docker/overlay2/7a5abd2293d4d44801ee0c7cab2b0c5ccd144426b7bc23c4275f4386deb98537/merged
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/docker/overlay2/db23e8bb9e51bd697db0d4c40ed2d0d9039d432ebce361cf1f3cc9f214f2fddc/merged
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/docker/overlay2/d6bbf7354b76afd0d6bf04f43c8f834bb3e0af5efdf30c0edea294e2bcaaab24/merged
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/docker/overlay2/15eddc61457ac7841e9a0d50f515aa686d0ea5d940941041721759cc052bf740/merged
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/VMs/container-station-data/lib/docker/overlay2/f9c632a56860e65b6b24295814058f2e7e41e427c81d74383026dcba8029f6b4/merged
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/.qpkg/container-station/system-docker/overlay2/4c18f272ee563eb29ca12fda8622ab091f0230b0074470c8f5a825fcc21156fb/merged
/dev/mapper/vg1-snap10010
                        379.1G    122.8G    255.8G  32% /mnt/snapshot/1/10010
tmpfs                    48.0M     52.0K     47.9M   0% /share/CACHEDEV1_DATA/.samba/lock/msg.lock
tmpfs                    16.0M         0     16.0M   0% /mnt/ext/opt/samba/private/msg.sock
/dev/mapper/vg1-snap10011
                        379.1G    127.4G    251.2G  34% /mnt/snapshot/1/10011
//192.168.1.18/DATA      50.5T     39.8T     10.6T  79% /mnt/RTRR_CIFS/192.168.1.18/admin/DATA
overlay                 723.4G    535.3G    187.5G  74% /share/CACHEDEV4_DATA/.qpkg/container-station/system-docker/overlay2/7fef80fb400488ed4fb78326402f343132e494367eb7fa8ffb295bed05e069a6/merged
ftp://192.168.1.18:21//
                          7.5T         0      7.5T   0% /share/.quftp_client/db336ccd1d924c2ba651fd6c35d81292
/dev/mapper/vg1-snap10012
                        379.1G    123.4G    255.2G  33% /mnt/snapshot/1/10012
//192.168.1.18/media     50.5T     39.8T     10.6T  79% /mnt/RTRR_CIFS/192.168.1.18/admin/media
[/share/Public] #  

MODERATOR EDIT: Legibility

Chuck , What time are u at your “help” desk and where r you ?
I am GMT +8 .

I am EST/EDT (New York time zone)

I see, and have now fixed the problem.

Please download v1.0.3.

You’ll notice it speaks to QTS/QuTS (where this occurs)

Thanks Chuck ,

I really appreciate your help.

I think I am back into the Plex world !!

But get this on NAS #2

Enter command # -or- command name (4 char min) : 2

Unable to run automatic sequence. PMS is running. Please stop PlexMediaServer.

Cannot stop PlexMediaServer. Tried in script several times and from Qnap.
Nothing stops it !

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