Cleanup after deleted library - ajp_anton - 2025-02-03
I just deleted a library, but it seems that it didn't clean up anything. All the metadata files and all the entries in the database that belonged to this library are still present. How do I go back to how it was before this library was added?
Alternatively, because this was the only library I had, how do I preserve all server settings and plugins if I just start over? Although this feels more like a workaround to a problem I'm going to encounter again in the future.
RE: Cleanup after deleted library - TheDreadPirate - 2025-02-03
There are scheduled jobs that will clean most of that up. Optimize Database, cache cleanup, etc.
What OS is Jellyfin running on? If Linux, is it installed directly in Linux or are you using Docker?
RE: Cleanup after deleted library - ajp_anton - 2025-02-03
(2025-02-03, 02:10 PM)TheDreadPirate Wrote: There are scheduled jobs that will clean most of that up. Optimize Database, cache cleanup, etc.
What OS is Jellyfin running on? If Linux, is it installed directly in Linux or are you using Docker? I'm using Docker (on Linux).
I tried running those manually now, and the metadata directory was almost cleared. Some lyrics files are still there left by the lrclib plugin, but I'm not sure if that's the responsibility of the plugin and not something you can control.
The database still contains everything though. And going to Home, My Media still shows everything I had. The Dashboard's Libraries is empty, as that's where I deleted the library.
Manually running Scan Media Library fails. Logs has the following:
Code: [2025-02-03 14:19:04.876 +00:00] [ERR] [51] MediaBrowser.Controller.Entities.BaseItem: Error refreshing owned items for "/config/root/default/LibraryName"
System.IO.DirectoryNotFoundException: Could not find a part of the path '/config/root/default/LibraryName'.
at System.IO.Enumeration.FileSystemEnumerator`1.Init()
at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileSystemEntries(String path, Boolean recursive)
at MediaBrowser.Controller.Providers.DirectoryService.<>c.<GetFileSystemEntries>b__5_0(String p, IFileSystem fileSystem)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path)
at MediaBrowser.Controller.IO.FileData.GetFilteredFileSystemEntries(IDirectoryService directoryService, String path, IFileSystem fileSystem, IServerApplicationHost appHost, ILogger logger, ItemResolveArgs args, Int32 flattenFolderDepth, Boolean resolveShortcuts)
at MediaBrowser.Controller.Entities.CollectionFolder.CreateResolveArgs(IDirectoryService directoryService, Boolean setPhysicalLocations)
at MediaBrowser.Controller.Entities.CollectionFolder.GetFileSystemChildren(IDirectoryService directoryService)
at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
[2025-02-03 14:19:04.877 +00:00] [ERR] [51] Emby.Server.Implementations.ScheduledTasks.TaskManager: Error executing Scheduled Task
System.IO.DirectoryNotFoundException: Could not find a part of the path '/config/root/default/LibraryName'.
at System.IO.Enumeration.FileSystemEnumerator`1.Init()
at System.IO.Enumeration.FileSystemEnumerableFactory.FileSystemInfos(String directory, String expression, EnumerationOptions options, Boolean isNormalized)
at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
at Emby.Server.Implementations.IO.ManagedFileSystem.GetFileSystemEntries(String path, Boolean recursive)
at MediaBrowser.Controller.Providers.DirectoryService.<>c.<GetFileSystemEntries>b__5_0(String p, IFileSystem fileSystem)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
at MediaBrowser.Controller.Providers.DirectoryService.GetFileSystemEntries(String path)
at MediaBrowser.Controller.IO.FileData.GetFilteredFileSystemEntries(IDirectoryService directoryService, String path, IFileSystem fileSystem, IServerApplicationHost appHost, ILogger logger, ItemResolveArgs args, Int32 flattenFolderDepth, Boolean resolveShortcuts)
at MediaBrowser.Controller.Entities.CollectionFolder.CreateResolveArgs(IDirectoryService directoryService, Boolean setPhysicalLocations)
at MediaBrowser.Controller.Entities.CollectionFolder.RequiresRefresh()
at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken)
at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.ValidateTopLibraryFolders(CancellationToken cancellationToken, Boolean removeRoot)
at Emby.Server.Implementations.Library.LibraryManager.PerformLibraryValidation(IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.Library.LibraryManager.ValidateMediaLibraryInternal(IProgress`1 progress, CancellationToken cancellationToken)
at Emby.Server.Implementations.ScheduledTasks.ScheduledTaskWorker.ExecuteInternal(TaskOptions options)
[2025-02-03 14:19:04.878 +00:00] [INF] [51] Emby.Server.Implementations.ScheduledTasks.TaskManager: "Scan Media Library" Failed after 0 minute(s) and 0 seconds
RE: Cleanup after deleted library - TheDreadPirate - 2025-02-03
Can you share your full log via privatebin.net? The database entries should have been cleared.
Regarding your backup question. Wherever you mounted /config is the only folder you need to backup to restore jellyfin. You should also backup and restore /cache, but that isn't required.
RE: Cleanup after deleted library - TheDreadPirate - 2025-02-03
For anyone following, OP sent me their logs via PM.
Can you re-create the library with exactly the same name then delete it again?
RE: Cleanup after deleted library - ajp_anton - 2025-02-04
(2025-02-03, 10:47 PM)TheDreadPirate Wrote: Can you re-create the library with exactly the same name then delete it again? It worked, thanks. I also thought of this, but wasn't sure if libraries are stored as the library name, or as a unique ID.
Since the original library contained 20k files that took forever to scan, I created the new one with a slightly smaller subset. This replaced the old library in Home with the new one (meaning the 20k files from before were replaced with the ~10 in the new one).
Then I removed it, which again removed it from Dashboard but not from Home. This time, however, a simple restart of the server cleared Home. The database file remained huge, but a docker compose down -> up cleared that as well.
RE: Cleanup after deleted library - TheDreadPirate - 2025-02-04
I think most databases work this way. They don't immediately cleaning up/"vacuum"/compact their database files.
|