Jump to content

How to Move Your Library to Another Location


Recommended Posts

dannymichel
Posted (edited)

Lets say you want to move everything from /mnt/mergerfs/tv to /mnt/mergerfs/media/tv

cd /var/lib/emby-server/data
sqlite3 library.db
UPDATE MediaItems
SET Path= replace(Path, '/mnt/mergerfs', '/mnt/mergerfs/media')
where Path like '%/mnt/mergerfs%';
UPDATE MediaStreams2
SET Path= replace(Path, '/mnt/mergerfs', '/mnt/mergerfs/media')
where Path like '%/mnt/mergerfs%';
UPDATE TypedBaseItems
SET Path= replace(Path, '/mnt/mergerfs', '/mnt/mergerfs/media')
where Path like '%/mnt/mergerfs%';
.save library.db; .exit
simple as that Edited by dannymichel
  • Like 3
Posted

Thanks for the info !

dannymichel
Posted

no problem

  • 7 months later...
spaceman07
Posted (edited)

hello.. i would like to add to this where the table TypedBaseItems does not exist anymore and i needed to update the options.xml files in the directories found under

/opt/emby/root/default

as my installation is via cloudbox dockers.

hope it helps someone.. thanks

Edited by spaceman07
  • Like 1
Posted

hello.. i would like to add to this where the table TypedBaseItems does not exist anymore and i needed to update the options.xml files in the directories found under

/opt/emby/root/default

as my installation is via cloudbox dockers.

hope it helps someone.. thanks

 

Hi, the newer table is called MediaItems now.

  • 8 months later...
Posted (edited)

Hi,

   Need help with same topic, i just need to change the library path of my media from "/mnt/gdrive" to "/mnt/unionfs". The contents of my media are both present in both directories just want to change the path in emby server. I tried doing the steps listed above with no success. Thanks.

 

was able to figure it out, i needed to edit options.xml on library. Thanks.

Edited by stavol23
  • 1 month later...
neunghaha28
Posted

2021.

Not working, Please update.

Happy2Play
Posted
5 minutes ago, neunghaha28 said:

2021.

Not working, Please update.

Sorry what is not working? 

But you would have to manually edit the database and each library options.xml.

neunghaha28
Posted (edited)
On 3/8/2021 at 9:40 AM, Happy2Play said:

Sorry what is not working? 

But you would have to manually edit the database and each library options.xml.

Yes, I manually edit database and options.xml on embyserver beta 4.6.0.30 not working after from scan library again.

Edited by neunghaha28
Posted

What exactly is not working?

neunghaha28
Posted
8 minutes ago, Luke said:

What exactly is not working?

Library is completely gone after another scan.

Posted

OK, I would try re-setting them up in emby library setup.

  • Thanks 1
n3farious
Posted

I just wanted to provide some confirmation that editing the library.db and various options.xml worked fine for me today as of version 4.5.2.0 (I'm a little behind). Consolidating my paths was required to use hardlinking as I prepare to move to docker. It also simplifies my fstab a bit :)

A few words of caution that should be best practice. Backup your .db and /xml files first. Make sure emby is down. You will probably have to chown the . and library.db to edit. Put it back to your emby user and group when you are done editing. Don't forget to edit your paths in any download apps, etc. When you first start emby back up and rescan your library, all of the images might appear to be gone and no content in each library. Give it some time. My libraries took almost two hours to complete scanning, and things were a bit wonky until the scans completed.

 

  • Like 1
Posted

If somebody uses this to change the location of the media files, you might also need to run

UPDATE MediaItems
SET Images= replace(Images, '/mnt/mergerfs', '/mnt/mergerfs/media')
where Images like '%/mnt/mergerfs%';

At least, it was missing for me.

  • 2 weeks later...
Posted

I tried this...

I changed all the paths in my DB,

I changed the options.xml for each library.

Started up emby, and all looks good (so I thought), all the libraries showed the new paths and I could play files.

So then it came to running a scan and now emby is running ffprobe on all the files again.

As these are files on google drive, it is taking ages.

Is there a way to prevent emby from having to run this, as the files have not changed, just the paths?

Thanks

Posted

Hi, this is something we'll look to improve in future updates. Thanks.

  • 2 weeks later...
Posted

Just a question, but is there any particular reason Emby isn't set up to do this from the Setting section OR at setup after installation?  Honestly, the first time I installed emby years ago on my small 120GB SSD I didn't realize that the metatdata would consume over 10GB of my drive.  Maybe I should have but it was my first experience.  Obviously I kept my media files on non SSD drives and it would have been nice to have a screen in setup asking where I wanted to have this data saved along with a warning that it could take up a large amount of space which is why a user might want to locate it somewhere else.

 

Thanks for all the great work!

Posted
6 hours ago, boardbum said:

Just a question, but is there any particular reason Emby isn't set up to do this from the Setting section OR at setup after installation?  Honestly, the first time I installed emby years ago on my small 120GB SSD I didn't realize that the metatdata would consume over 10GB of my drive.  Maybe I should have but it was my first experience.  Obviously I kept my media files on non SSD drives and it would have been nice to have a screen in setup asking where I wanted to have this data saved along with a warning that it could take up a large amount of space which is why a user might want to locate it somewhere else.

 

Thanks for all the great work!

Yes it can be improved. Thanks for the feedback.

  • 3 months later...
neunghaha28
Posted (edited)
On 3/11/2021 at 12:15 AM, Luke said:

OK, I would try re-setting them up in emby library setup.

image.png.d228718bf4358b4a060aeb081bb07ea8.png

Error: no such table: TypedBaseItems.

I ignored Error: no such table: TypedBaseItems. I'm just wondering if it's no longer in use? table: TypedBaseItems.

After modifying the library.db, if I don't Scan media library Poster it stays and works.

Scan media library found that the poster is missing.

Embyserver 4.7.0.3 beta

image.thumb.png.0875a91d6f3447da147944f8945d5f1c.png

Edited by neunghaha28
Posted

TypedBaseItems is no longer used in newer server versions.

Happy2Play
Posted
On 7/20/2021 at 8:26 PM, neunghaha28 said:

image.png.d228718bf4358b4a060aeb081bb07ea8.png

Error: no such table: TypedBaseItems.

I ignored Error: no such table: TypedBaseItems. I'm just wondering if it's no longer in use? table: TypedBaseItems.

After modifying the library.db, if I don't Scan media library Poster it stays and works.

Scan media library found that the poster is missing.

Embyserver 4.7.0.3 beta

image.thumb.png.0875a91d6f3447da147944f8945d5f1c.png

You only updated Path, you would still need to update Images column.

But yes the TypedBaseItems table is obsolete and does not exist in a New database, only OLD migrated databases.  This happens over time on original installs and Emby changes.

neunghaha28
Posted
5 hours ago, Happy2Play said:

You only updated Path, you would still need to update Images column.

But yes the TypedBaseItems table is obsolete and does not exist in a New database, only OLD migrated databases.  This happens over time on original installs and Emby changes.

how to update Images column?

Happy2Play
Posted
1 minute ago, neunghaha28 said:

how to update Images column?

Same as mentioned above.

On 3/19/2021 at 10:34 AM, romankk said:

If somebody uses this to change the location of the media files, you might also need to run


UPDATE MediaItems
SET Images= replace(Images, '/mnt/mergerfs', '/mnt/mergerfs/media')
where Images like '%/mnt/mergerfs%';

At least, it was missing for me.

 

  • Like 1
neunghaha28
Posted (edited)

@Happy2Play @Luke

UPDATE MediaItems
SET Path= replace(Path, '/volume1/rclone/mount', '/media/GoogleDrive')
where Path like '%/volume1/rclone/mount%';
UPDATE MediaStreams2
SET Path= replace(Path, '/volume1/rclone/mount', '/media/GoogleDrive')
where Path like '%/volume1/rclone/mount%';
UPDATE MediaItems
SET Images= replace(Images, '/volume1/rclone/mount', '/media/GoogleDrive')
where Images like '%/volume1/rclone/mount%';
.exit

Scan media library (Failed)

	*** Error Report ***
	Version: 4.7.0.3
	Command line: /app/emby/EmbyServer.dll -programdata /config -ffdetect /app/emby/ffdetect -ffmpeg /app/emby/ffmpeg -ffprobe /app/emby/ffprobe -restartexitcode 3
	Operating system: Linux version 4.4.180+ (root@build13) (gcc version 7.5.0 (GCC) ) #41890 SMP Fri Jun 25 02:37:14 CST 2021
	Framework: .NET Core 3.1.13
	OS/Process: x64/x64
	Runtime: app/emby/System.Private.CoreLib.dll
	Processor count: 4
	Data path: /config
	Application path: /app/emby
	SQLitePCL.pretty.SQLiteException: Corrupt: database disk image is malformed
	SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
	   at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
	   at SQLitePCL.pretty.StatementImpl.MoveNext()
	   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItem(IDatabaseConnection db, BaseItem item, Int64 topParentId, Int64 userDataKeyId, IStatement insertItemStatement, IStatement updateItemStatement)
	   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItemsInTranscation(IDatabaseConnection db, List`1 tuples)
	   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, Action`1 afterSave, CancellationToken cancellationToken)
	Source: SQLitePCL.pretty
	TargetSite: Void CheckOk(SQLitePCLEx.sqlite3, Int32)
	
2021-07-28 17:58:53.359 Error App: Error refreshing James Grogan
	*** Error Report ***
	Version: 4.7.0.3
	Command line: /app/emby/EmbyServer.dll -programdata /config -ffdetect /app/emby/ffdetect -ffmpeg /app/emby/ffmpeg -ffprobe /app/emby/ffprobe -restartexitcode 3
	Operating system: Linux version 4.4.180+ (root@build13) (gcc version 7.5.0 (GCC) ) #41890 SMP Fri Jun 25 02:37:14 CST 2021
	Framework: .NET Core 3.1.13
	OS/Process: x64/x64
	Runtime: app/emby/System.Private.CoreLib.dll
	Processor count: 4
	Data path: /config
	Application path: /app/emby
	SQLitePCL.pretty.SQLiteException: Error: cannot rollback - no transaction is active
	SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
	   at SQLitePCL.pretty.SQLiteException.CheckOk(sqlite3 db, Int32 rc)
	   at SQLitePCL.pretty.StatementImpl.MoveNext()
	   at SQLitePCL.pretty.DatabaseConnection.Execute(IDatabaseConnection This, ReadOnlySpan`1 sqlUtf8)
	   at SQLitePCL.pretty.DatabaseConnection.RollbackTransaction(IDatabaseConnection This)
	   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, Action`1 afterSave, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.Data.SqliteItemRepository.SaveItems(List`1 items, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.Library.LibraryManager.UpdateItems(List`1 items, BaseItem parent, ItemUpdateType updateReason, Boolean setDateLastSaved, Boolean saveMetadata, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.Library.LibraryManager.UpdateItems(List`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.Library.LibraryManager.UpdateItem(BaseItem item, BaseItem parent, ItemUpdateType updateReason)
	   at MediaBrowser.Controller.Entities.BaseItem.UpdateToRepository(ItemUpdateType updateReason)
	   at MediaBrowser.Providers.Manager.MetadataService`2.SaveItem(MetadataResult`1 result, Boolean isFirstRefresh, LibraryOptions libraryOptions, ItemUpdateType reason, IDirectoryService directoryService, CancellationToken cancellationToken)
	   at MediaBrowser.Providers.Manager.MetadataService`2.RefreshMetadata(BaseItem item, MetadataRefreshOptions refreshOptions, LibraryOptions libraryOptions, CancellationToken cancellationToken)
	   at MediaBrowser.Controller.Entities.BaseItem.RefreshMetadata(MetadataRefreshOptions options, LibraryOptions libraryOptions, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.Library.Validators.PeopleValidator.ValidatePeople(CancellationToken cancellationToken, IProgress`1 progress)
	Source: SQLitePCL.pretty
	TargetSite: Void CheckOk(SQLitePCLEx.sqlite3, Int32)	

How to fix?

Edited by neunghaha28

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