Jump to content

After move to another machine: a scan for new files rebuilds the whole library (and how to avoid it?)


Recommended Posts

Posted (edited)

So far, I have used Emby directly on the NAS, but now I want to move it to another Linux server. The files are accessible from the Linux server, but the path has changed. The meta-data is not stored with the media files, so I needed to take extra steps.

I tried the backup, but it didn't really work for me (the restored server just showed the libraries, but no artwork). So, I switched to manual copying.

The backup restore provided my with the root/default/<LIBARARY>/options.xml files which I changed to point to the new location of the library folders. I also copied the complete metadata folder form the NAS and the data folder. After that, I changed also the paths in the collections/<COLLECTION>/collection.xml files.

After that, I opened the library.db and executed these commands:

UPDATE MediaItems SET Path= replace(Path, '/share/Multimedia2', '/mnt/datavol2/Multimedia') where Path like '%/share/Multimedia2%';
UPDATE MediaItems SET Images= replace(Images, '/share/Multimedia2', '/mnt/datavol2/Multimedia') where Images like '%/share/Multimedia2%';
UPDATE MediaStreams2 SET Path= replace(Path, '/share/Multimedia2', '/mnt/datavol2/Multimedia') where Path like '%/share/Multimedia2%';

And that's it.... IT WORKED (yeah!). I opened Emby and it showed me everything. I can play movies, I can even continue watching where I stopped on the old server.

But...

When scanning the libraries for new files, problems start. Emby would remove (I guess) all items from the library just to rebuild it from scratch.

The log shows something like this:

2021-03-20 14:25:29.165 Info Server: http/1.1 POST http://schroeder:8096/emby/Items/b5f7738551ba5f0ed30ebe31ab2baf50/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&ReplaceAllMetadata=false&X-Emby-Client=Emby Web&X-Emby-Device-Name=Firefox&X-Emby-Device-Id=8b5a7ce4-3114-492a-842e-5ccb678ecb2e&X-Emby-Client-Version=4.5.4.0. UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:87.0) Gecko/20100101 Firefox/87.0
2021-03-20 14:25:29.175 Info Server: http/1.1 Response 204 to 192.168.3.233. Time: 11ms. http://schroeder:8096/emby/Items/b5f7738551ba5f0ed30ebe31ab2baf50/Refresh?Recursive=true&ImageRefreshMode=Default&MetadataRefreshMode=Default&ReplaceAllImages=false&ReplaceAllMetadata=false&X-Emby-Client=Emby Web&X-Emby-Device-Name=Firefox&X-Emby-Device-Id=8b5a7ce4-3114-492a-842e-5ccb678ecb2e&X-Emby-Client-Version=4.5.4.0
2021-03-20 14:25:29.293 Debug XmlSerializer: Deserializing file /var/lib/emby/root/default/TV Shows INT/options.xml
2021-03-20 14:25:29.302 Debug XmlSerializer: Deserializing file /var/lib/emby/root/default/TV Shows INT/options.xml
2021-03-20 14:25:29.543 Debug XmlSerializer: Deserializing file /var/lib/emby/config/users/205c291af2bf4bb79348bfebe6fc45b1/policy.xml
2021-03-20 14:25:29.552 Debug XmlSerializer: Deserializing file /var/lib/emby/config/users/2da81595cbc24f67917d020bffcd682a/policy.xml
2021-03-20 14:25:29.568 Debug XmlSerializer: Deserializing file /var/lib/emby/config/users/7a53c152b54948418537ae8125f038ef/policy.xml
2021-03-20 14:25:29.654 Debug XmlSerializer: Deserializing file /var/lib/emby/config/metadata.xml
2021-03-20 14:25:29.703 Debug BaseItem: Removed item: /mnt/datavol2/Multimedia/TV Shows/INT/Mirzapur
2021-03-20 14:25:29.707 Info App: Removing item from database, Type: Series, Name: Mirzapur, Path: /mnt/datavol2/Multimedia/TV Shows/INT/Mirzapur, Id: 135719
2021-03-20 14:25:29.733 Info App: Deleting path /var/lib/emby/metadata/library/39/39655af05c62a304c3a1f4a19fa67fcc
2021-03-20 14:25:29.745 Info App: Deleting path /var/lib/emby/metadata/library/0b/0bf87f909e4f5dab842785683a7fbbf6
2021-03-20 14:25:29.746 Info App: Deleting path /var/lib/emby/metadata/library/d9/d91c1af63d4d6fd774b0c65f123765d6
2021-03-20 14:25:29.777 Info App: Deleting path /var/lib/emby/metadata/library/7a/7a4b37bc6bc6840d732f61e0e006e0cd
2021-03-20 14:25:29.777 Info App: Deleting path /var/lib/emby/metadata/library/d0/d08c9765673d816d9ed6fb19447be40c
2021-03-20 14:25:29.807 Info App: Deleting path /var/lib/emby/metadata/library/57/57fb5fef2478c99e67f14d723833aab6
2021-03-20 14:25:29.807 Info App: Deleting path /var/lib/emby/metadata/library/4d/4da85b8fcf8f6e748c5079454293ce61

This is a problem for me as I have libraries with thousands of items and I made a lot of manual changes to them (e.g., right identification, changing images, etc).

The same process on the old (NAS) instance does not do this. This is also a one-time process. After rebuilding the library, Emby will not do that again.

So, my question (at last) is: have I missed something? Why does Emby throw away the content of my (perfectly working) library just to rebuild it?

Is there a way to prevent this? I cannot (well, don't want to) go through thousands of entries to check if they were correctly identified.

Thank you!

Edited by romankk
Posted

Hi, it's because the guid column is partly based on the full path. it's something we'll look at improving in future updates. thanks.

Posted

HI,

Ok, understood. This makes my life a bit easier. Now, I just copied everything and create a symlink.

Any improvement on that end will be appreciated. 🙂

Thank you!

Posted

Thanks for the feedback 

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...