Jellyfin Forum
Lost entire database - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: Lost entire database (/t-lost-entire-database)



Lost entire database - prborg - 2024-05-31

OK yesterday we had some rolling thunderstorms and i lost power for a split second. When the power came back the network share where all of my movies are did not come up automatically like it is supposed to, the underlying OS did not mount the drive properly (no data loss though). But for some reason Jellyfin was displaying that there were no movies anywhere (although I was able to connect to the network share and see that the files were there). I made sure to shutdown JF and make sure that the network share was accessible before starting JF again. I left JF run for several hours and still nothing. Eventually I just went to my libraries definition and toll JF to scan them again, which did the trick, I had to fix some of the images and metadata, but no big deal.

My question is... How can I prevent this from happening in the future? I have shutdown the server where the movies are several times before (after upgrades/patches) and never had an issue. TIA for any ideas!


RE: Lost entire database - gnattu - 2024-05-31

I'm very sorry to hear that. I had a similar experience where a thunderstorm caused a power outage, and my PSU died as a result. Luckily, my data was safe.

After that, I bought a UPS to ensure I have time for a graceful shutdown if this ever happens again. If you live in an area where unexpected power outages are common, a UPS is definitely worth it.


RE: Lost entire database - Mel_Gibson_Real - 2024-05-31

I would just do daily backups, if anything bad happens you can just roll back to the previous day. If you use something like borgbackup it wont even take up much space to keep a weeks worth of backups just incase.


RE: Lost entire database - pcm - 2024-05-31

Your library is stored in library.db SQLite db-file and all the library metadata (posters, thumbnails, people/artists, views etc) is stored in metadata directory. 

So, to avoid losing your library, you can periodically make a backup-copy of library.db and metadata directory. 

On ubuntu-linux the library.db file is at
Quote:/var/lib/jellyfin/data/library.db
and the metadata dir is
Quote:/var/lib/jellyfin/metadata

I have a shell-script that I run on a daily cron schedule. I can share it if you'd like it but it'll only work on a Linux or Mac or Windows with WSL2 enabled.


RE: Lost entire database - MisterMcDuck - 2024-05-31

yeap, I do a duplicity backup every day myself and have used it to restore many times successfully (all due to my own fault, unlike OP).