Jump to content

How do I prevent emby from removing library information?


Recommended Posts

Posted

Hey there!

I have embyserver running on a dedicated Linux mint box. Emby is the only thing this machine does. I have a large library of TV shows, over 30,000 files worth. The library has 3 folder sources, all of which are smb shares added with smb://.

For reasons I have yet to determine, occasionally emby will drop one of the folders from the library. The folder still appears in the library setup menu, but it'll fail to scan for whatever reason, and when that happens emby will drop the metadata on maybe 10,000 files. The folder it drops is not always the same one.

I can rescan the library and emby will rediscover all the files that never went anywhere and re-add them to the library again, but the "video preview thumbnail extraction" and "detect episode intros" processes on this many files takes a week or longer to complete.

I've tried some settings to mitigate these issues. I have disabled real time monitoring. I have enabled Metadata Savers Nfo. I have enabled "Download images in advance". I have taken all scheduled tasks off any schedule so they only run manually.

The Metadata saver did not seem to work, generating errors like "System.IO.IOException: Create Handle Failed: Movies\Drama. NTStatus: FILE_DOES_NOT_EXIST" and "System.IO.IOException: System.IO.IOException: Authentication Failed." I've confirmed that the permissions are correct on the server, and emby has no issues saving subtitle files into the library, so I'm not sure what's going on there.

My questions are:

Is there any way to avoid having to go through the video preview thumbnail extraction and detect episode intros process when emby decides to dump the library? Can I somehow make this data read-only until I authorize a deletion, or maybe have emby preserve this data and re-associate it instead of having to rebuild everything?

What is the difference between "Scan media library" and "Refresh metadata" if any they seem to be the same function?

If I enable "Save Artwork into Media folders" does that include video thumbnails? I am reluctant to enable this, as redoing the entire thing will take a good part of a month.

Posted

Hello Klaitu,

** This is an auto reply **

Please wait for someone from staff support or our members to reply to you.

It's recommended to provide more info, as it explain in this thread:


Thank you.

Emby Team

Posted

So much for Emby's "great customer support" I guess. If anyone figures it out, let me know.

GrimReaper
Posted (edited)
On 4/1/2025 at 8:14 PM, Klaitu said:

Is there any way to avoid having to go through the video preview thumbnail extraction and detect episode intros process when emby decides to dump the library?

Not for Chapter thumbs, but 10-second BIFs can be stored next to media files. 

On 4/1/2025 at 8:14 PM, Klaitu said:

Can I somehow make this data read-only until I authorize a deletion

Nope. 

On 4/1/2025 at 8:14 PM, Klaitu said:

maybe have emby preserve this data and re-associate it instead of having to rebuild everything?

As above, not Chapter thumbs but 10-second BIFs will be read/reassociated if stored in media folders. 

On 4/1/2025 at 8:14 PM, Klaitu said:

What is the difference between "Scan media library" and "Refresh metadata" if any they seem to be the same function?

Scan media library checks for new/changed/updated content made to libraries, Refresh Metadata replaces item metadata/artwork. 

On 4/1/2025 at 8:14 PM, Klaitu said:

If I enable "Save Artwork into Media folders" does that include video thumbnails?

It doesn't, it includes only item artwork, Chapter thumbs cannot be saved in media folders, 10-second BIFs can and they have their own separate setting for saving into media folders irrespective of Saving artwork into media folders. 

Edited by GrimReaper
Posted

Thanks for the responses, guys, I understand a lot better how emby is intended to work now.

The one thing left to resolve is the issue with writing data to the server share folders. Previously I thought it was saving subtitles there successfully, but as it turns out it was not. Emby is not able to save data into the file shares where the media resides. The shares were added with smb://. /mnt isn't an option for me right now. The server credentials that I provided to emby have full read/write access, and indeed the read portion of this seems to work just fine.

I've attached the relevant section of log below:

2025-04-04 06:22:13.592 Error ProviderManager: Error in metadata saver
        *** Error Report ***
        Version: 4.8.11.0
        Command line: /opt/emby-server/system/EmbyServer.dll -programdata /var/lib/emby -ffdetect /opt/emby-server/bin/ffdetect -ffmpeg /opt/emby-server/bin/ffmpeg -ffprobe /opt/emby-server/bin/ffprobe -restartexitcode 3 -updatepackage emby-server-deb_{version}_amd64.deb
        Operating system: Linux version 6.8.0-57-generic (buildd@lcy02-amd64-040) (x86_64-linux-gnu-gcc-13 (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0, GNU ld (GNU Binutils for Ubunt
        Framework: .NET 6.0.36
        OS/Process: x64/x64
        Runtime: opt/emby-server/system/System.Private.CoreLib.dll
        Processor count: 6
        Data path: /var/lib/emby
        Application path: /opt/emby-server/system
        System.IO.IOException: System.IO.IOException: Authentication Failed.
           at EzSmb.Transports.Connection..ctor(PathSet pathSet, ParamSet paramSet)
           at EzSmb.Node.GetNode(String path, ParamSet paramSet, Boolean isDirectory)
           at Emby.Server.Implementations.IO.SmbFileSystem.CreateDirectory(String path)
           at NfoMetadata.Savers.BaseNfoSaver.SaveToFile(Stream stream, String path, LibraryOptions libraryOptions, CancellationToken cancellationToken)
           at NfoMetadata.Savers.BaseNfoSaver.Save(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken)
           at Emby.Providers.Manager.ProviderManager.SaveMetadata(BaseItem item, LibraryOptions libraryOptions, ItemUpdateType updateType, IMetadataSaver[] savers, CancellationToken cancellationToken)
        Source: Emby.Server.Implementations
        TargetSite: Void .ctor(EzSmb.Paths.PathSet, EzSmb.Params.ParamSet)

Posted

Hi, did you enter your smb credentials when you setup the library?

Posted
18 minutes ago, Luke said:

Hi, did you enter your smb credentials when you setup the library?

Of course, otherwise emby would not be able to scan the library in the first place.

After doing some further digging on the server end, the server is accepting the credentials, but there are multiple entries of the connection being denied because emby is attempting to use SMB1. I am not sure if this is related to the issue or not, but it's the only thing that appears in the server log other than "Authentication successful".

Posted

OK I think there are cases where the server isn't applying the credentials. We are looking into that. Thanks.

  • 2 weeks later...
Posted

I have identified the root cause of my library scanning issue.

If the drives on the NAS are in power saving mode when emby begins a library scan, emby appears to just start deleting entries for every file in that path immediately. This happens even if embyserver is running on the NAS directly.

I've been able to workaround by restricting the library scans to only run manually, making sure that all drives are active before initiating the scan.

If would be nice, though if there were either an "additive only" library scan that I can run, or if the Library scan would poll the paths it is scanning to wake up the drives before the actual scan begins.

  • 6 months later...
Posted

I have a frustrating problem. All of my media are on SMB shares while a different machine runs Embyserver. Every time a library scan runs, emby starts removing media from the library seemingly at random. It will scan tens of thousands of files, but randomly decide to remove 1 or 2. Then, on the next scan it will detect those it removed and re-add them, but it will randomly remove other media files from the library. Sometimes it will remove media AND detect the exact same media in the same library scan!

Yeah, I know there's weirdness with SMB and emby and that it could take years to get solved, but is there some way I can just do an "additive only" library scan? Can I make the metadata folder read-only or something? Is there an option buried in an obscure menu somewhere and I'm just not seeing it? There is never a time when I want library data to be removed from the library, ever.

Posted

I'm not sure how to be more specific other than to say "Emby's library scan randomly removes valid paths from the library seemingly at random" I am on 4.9.1.80

Here's a screenshot of a log file where Emby removes Person of Interest and then immediately readds it in the same scan.

There is nothing particular about this TV show. All the other TV shows in the same folder on the same drive were unaffected. Sometimes it removes and readds it in the same scan, sometimes it requires another scan. Sometimes it's a TV show, sometimes it's a movie. There really doesn't seem to be any pattern.

Specifically, I would like to know if there's any way to to an additive-only library scan.

Thanks!

Screenshot 2025-11-03 174910.png

Posted
1 hour ago, Luke said:

Hi there, please attach the Emby server log from when the problem occurred:

Thanks!

 

Luke.

We have had 3 interactions, and all 3 have been unacceptable. I've provided you a log file above which is irrelevant because I'm not asking you to troubleshoot anything. I am interested in the answer to one question:

I would like to know if there's any way to to an additive-only library scan.

Please pass this question onto a member of your team who is not yourself. I refuse to interact with you further and will ignore you entirely.

Thanks. 

Posted

HI, apologies. The reason I asked for your log is because the behavior in your screenshot is not normal, so I asked for that in hopes of being able to learn what's going on.

Quote

I would like to know if there's any way to to an additive-only library scan.

There isn't any such option, however I would like to get to the bottom of what you are seeing.

Posted

Thank you for answering my question. 

I can't provide you further logs at the moment, but I can tell you what I've observed:

The screenshot is a 100% typical example of this happening.

This problem happens on the latest embyserver version, but it was happening on the previous version as well. It happens no matter the hardware that embyserver is running on, though I have never tested it on a Windows machine. Presently it's running on Linux Mint.

This is a very large library with over 35,000 media files. 

This behavior does not seem to happen with music files at all (or at least it's never happened to me).

The emby server is connected to the samba shares via wired 1gbps ethernet. The connection is as solid as a smb share can be.

There are 3 samba shares on 3 different physical devices that compose the emby library. The behavior has only been observed on media shared from a synology NAS.

To date, I've never seen emby remove individual files, when this happens it always removes an entire folder from the library (such as Person of Interest in the screenshot, or a movie that is in its own folder with multiple formats of the same movie inside). I've never seen it remove an individual media file.

I have had some positive results running a script that will ls the entire library contents and every subfolder on the system before running the library scan. Doing this dramatically decreases the probability that emby will drop data.

Other information that may or may not be relevant:

Even though emby has correct permissions, it still flakes out trying to save data to all samba shares (it can't store .nfo or subtitles to the shares). 

The shares are added to the emby library via smb:// and not via system links through linux for similar "entire library destroying" potential.

I only perform library scans manually, and always supervised for the same reasons. 

Video Preview Thumbnail Extraction also behaves strangely. I often run it after a library scan completes, and it will miss media that it finds on subsequent runs. I often run 3 of 4 of these in a row after a library scan to get everything. This behavior is bizarre, but is not an issue for me as it is non-destructive.

Likewise Detect Episode Intros behaves strangely, missing media files that it should have detected. Like with the thumbnail extraction I often run it 3 or 4 times in a row before it detects everything.

My understanding of whats happening and what I'm doing to mitigate the issue:

Emby and Samba do not get along very well. Emby is *super duper* gung-ho about deleting library data, and will not hesitate to obliterate 100+GB of stored library data if a share drive takes even the smallest amount of time to spin up. Depending on what it deletes, it could take weeks to rescan. Therefore, all activity on my emby server is done manually and is supervised. Metadata backups are automated and run daily. I run a script that will ls the entire folder structures of each share before I run a library scan, which ensures that the drives are spun up and the folder structure is cached. The Synology NAS is checked, and any extensive IO operations it might be doing are suspended. Doing all this gives me about an 80% chance of successful library scan with no deletions.

Personally, I think having a non-destructive library scan option would be incredibly beneficial. Emby has had issues doing unsolicited library nuking for years, the forums here are full of situations that would never have existed if Emby weren't so eager to delete metadata, and implementing a checkbox with such a feature is probably much easier than tracking down whatever samba edge case is the culprit this time.

That's all the information I have. I hope it's some use to you, and thanks again for answering my question. I'll probably start experimenting with file permissions to see if I can prevent emby from even being able to delete its own metadata.

Posted

HI ,yes I believe you and there is one other active report of this, so I would very much like to know what's going on. So with that in mind, the more information the better because there is a greater chance that I will spot something, so that is why I ask for examples and log files.

Quote

but it was happening on the previous version as well

Do you mean a 4.8 version?

Posted
1 minute ago, Luke said:

HI ,yes I believe you and there is one other active report of this, so I would very much like to know what's going on. So with that in mind, the more information the better because there is a greater chance that I will spot something, so that is why I ask for examples and log files.

Do you mean a 4.8 version?

I'm pretty sure I was on 4.8.11.0. I keep up on the latest releases hoping that one of them will fix the problem, but I never do beta releases. I've been having issues with emby destroying metadata on valid paths since I started using it in 2024. I don't know if it was always this same issue as I've been troubleshooting this since April. I only specifically noticed the "remove and re-add the same media in a single scan" phenomenon since September, but it could have been happening earlier than that and I just confused it for one of the other library issues.

Posted

Do yo

3 hours ago, Klaitu said:

I'm pretty sure I was on 4.8.11.0. I keep up on the latest releases hoping that one of them will fix the problem, but I never do beta releases. I've been having issues with emby destroying metadata on valid paths since I started using it in 2024. I don't know if it was always this same issue as I've been troubleshooting this since April. I only specifically noticed the "remove and re-add the same media in a single scan" phenomenon since September, but it could have been happening earlier than that and I just confused it for one of the other library issues.

Do you have your libraries set up to read the local metadata in the files? I find letting emby rely on tmdb and tvdb and save it to a nfo to be better

Posted
8 hours ago, guunter said:

Do yo

Do you have your libraries set up to read the local metadata in the files? I find letting emby rely on tmdb and tvdb and save it to a nfo to be better

Yeah, I save it to .nfo, but the issue is that when the library scan incorrectly removes a valid path, it deletes all the .nfo files, images, and thumbnails associated with that path, so they have to be rebuilt again from scratch.

Running another library scan to rebuild everything carries risk, as emby might decide to delete something else from the library while re-adding the first thing.

Posted

Hi, from where are you referring to nfo files? It won’t delete nfo files from your media directories, if you have those.

Posted
3 minutes ago, Luke said:

Hi, from where are you referring to nfo files? It won’t delete nfo files from your media directories, if you have those.

I have it configured to save .nfo files into the media folders, but because emby's SMB implementation is flawed, it reports that it is unable to save them into the media folders due to authentication issues and instead saves them into whatever default fallback location. The server permissions for emby are 100% correct.

But we're kind of getting off into the weeds, here. Even if emby didn't delete the .nfo files it still removes the media from the library, and getting it to rescan the library without dropping some other piece of media is the main issue I am having.

When I add media the library, I ONLY want to add media. I don't want to remove media, and I don't want to sync folders. I just want to add new media.

Posted (edited)

Well Radarr and Sonarr does do this, when replacing files ( update / opgrade )

So if @Klaituare using those apps, then nfo's will be deletet.

Edited by Neminem
Posted
1 minute ago, Neminem said:

Well Radarr and Sonarr does do this, when replacing files.

So if @Klaituare using those apps, then nfo's will be deletet.

I don't use these. 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...