Pain & Suffering. Cleanup Jellyfin Libraries
说明与用途
在 Jellyfin 中,删除文件系统中的文件夹会留下悬空引用,导致库扫描失败。Bash 脚本可停止服务、查找并删除 SQLite 中对应条目,然后重新扫描库。
问题
Jellyfin ignores filesystem deletions, leaving dangling references that break library scans and prevent new files from being recognized.
结果
Dangling references are removed and the library rescans without errors, restoring normal media discovery.
工作流
- Delete the folder from the Jellyfin UI if present
- Stop the Jellyfin service via Dashboard or systemctl
- Locate and backup the Jellyfin SQLite database (e.g., /var/lib/jellyfin/data/jellyfin.db)
- Install sqlite3 if missing
- Search the BaseItems table for items matching the deleted folder name
- Delete those items and their children from the database
- Start Jellyfin
- Run a library rescan for the affected folder and verify no errors
证据
Jellyfin still has the references to those files, but they are absent in the filesystem. This breaks the library scanning and Jellyfin won't be able to recognize new files when you add them.
Here's a bash script to automate the deletion step
- 记录日期: 2026-09-06T15:36:45.653Z