Moving Kodi Folder/Database to SD Card

Awesome, this is probably a good read. I’ll check it out in a bit. Thanks.

The internal storage is quite limited. With a large/huge media library you will sooner or later run out of storage. Thus moving the library away from the internal storage might be a good idea.
Linux is great with symbolic links, mounting, and rebinding filesystems. So it’s quite easy to move the location off the internal storage.
I’m new to Kodi, but I read somewhere that it is possible to set configure options to place the library somewhere else.
The question I have is, if it is better to use Linux tools or the Kodi settings. I suppose that people in this forum have some experience with that, which means there must be either a best practice document, an article, a blog post, or something that someone can recommend or refer to.

I have a few Kodi questions that probably nobody can answer, so I will have to work in trial and error mode to figure it all out, but the library thing should be something that has come up a few times.

But the library question might be better asked in a new topic. It might be off-topic here.

Yes, start a new topic about the library.

Your overthinking the library. Your only talking about media. When you plug in whatever storage media it gets an auto-mount and you can do with that whatever you wish including moving that to fstab or whatever (full disclosure i’m NOT a *nix person) and you are free to mount network shares as well. That is all outside of Kodi.

As far as Kodi goes you go to the “Videos” section of the main menu, then “Files”, and finally “Add videos” and that is where you setup the sources for your media. You can find lots of information about this process over in Kodi’s wiki. Although you can use symbolic links, path redirection, etc. this is normally something you would only do when you had some kind of a special use case. For your current needs its sounds like you would actually be best just leaving the SD card formatted as it is (sense ext4 is really not going to give much of any benefit) and just making some folders on that for the types of media you want (you can have many separate sources). My only concern would be that a SD card would get filled pretty fast and you might think about starting off with spinning rust or a network share.

Thanks, I will open a new topic. I was not talking about my media library (which is about 15 TB), I was talking about the library kodi creates scraping the info.
I don’t want to put any media on the SD card. I only want to use it for the kodi library and backups (vero4k and kodi), which will be synced via rsync to a NAS, because CIFS/samba doesn’t allow : in filenames and kodi unfortunately creates filenames with a colon.

No worries, I’ll open a new topic tomorrow.

I checked my .kodi folder and couldn’t find a file having : in the filename. Could you give an example?

Have a movie or series in your library that includes a colon, e.g. Star Trek: The Next Generation. Now make a backup of your library. It will export all the artwork, actor info, but it will also create directories that match the title. So, if you want to backup to a cifs share, you are out of luck. Thus rsync comes in handy. This is better anyway, since it will only transfer new data.

That export option is not a backup and if you wanted to backup the database and artwork you only need a copy of the profile (userdata) directory. If you wished you could just backup the whole .kodi directory.

Now you confuse me. Before you were talking about the .kodi folder and not your Media files.
The Library is a SQL Database so will not impact filenames under .kodi unless you have a strange addon doing something on a file base.

Well if you would use rsync via ssh instead of samba that wouldn’t be an issue

FYI you do not need exact name matching for proper scraping in Kodi. If you planning on touching anything MS you would be best to not use any reserved characters in the first place. “Star Trek: The Next Generation” gets matched the exact same way as “Star Trek The Next Generation” does.

If you goal is to simply backup the database, then just copy the files in .kodi/userdata/Database. The sqlite3 database isn’t that large. Thumbnails are normally what takes a lot to space.

you forgot “and self replicating”

Everybody, please forget me mentioning local backups and data exports. I should have never done that.

The topic is: how do I move the kodi library (the meta data that is created by scraping the media on a NAS) off the internal storage. So we can either move it to an SD card or an USB disk.

Option 1:

  • create filesystem
  • move ~/.kodi to the new filesystem
  • mount new filesystem as ~/.kodi

Option 2:

  • change advancedsettings.xmlor whatever, so that the meta data library (and the artwork, actor images, …) is created somewhere else and not in ~/.kodi

Which is the better option? In case of the second one: what would happen, if you already had data in your meta data library? How would you then change the config file and move the existing meta data to the new location?
Are there even proper settings available so that kodi does that? As I said, I’m just guessing that option 2 is even possible. I’m ne to kodi and have only read a few topics about it.

I’m looking for a how-to or a best practices document. Something the community recommends.

My data is on a raid 5 ext4, but I access it via samba (I despise nfs and afp is deprecated, so samba is the only option really). I don’t touch anything MS, except samba for sharing.

My files on the NAS do not contain colons. A colon is a path separation character on macOS thus I rather try to avoid colons even on ext4.
But when you scrape a movie the colon get’s added to the name in the library. When you export the library, kodi uses the data in the library to save meta data to the disk and not the original filename.
Thus you will have colons in filenames in your backup directory. If you don’t but do have movies that have a colon in their name, you already have a corrupted export.

But please forget this part of the discussion. I should have never brought it up.

In my opinion, option 1 is your best bet, and the easiest option. Trying to use advancedsettings for moving thumbnails does not work well. That I know from experience.

1 Like

Just do a path substitution for the thumbnail folder since that is the only part you could ever fill the internal storage with and move that to the SD card. If you move the whole .kodi folder the databases get moved to slower storage with nothing to gain. I’m a bit suspect that would even be needed though.

As for the rest i’m rather confused. If your talking about .NFO files and artwork exported from Kodi then just delete them… seriously, and stop doing that. Those are mainly intended for moving a library or adding custom entries. If you are backing up the sql database then all of the info came out of there and the artwork you exported was pulled from the the texture13.db and thumbnails folder. You are only storing redundant information. What’s more by having those files there if you tell a video to refresh its information it will pull it from the local source instead of getting updated info from the internet.

1 Like

Thank you both for the info. However the answers are somewhat orthogonal. It might be a good idea to add that topic to the FAQ with an answer all moderators agree on.

So as far as I can ascertain the best would be to just mount over the thumbnail path and not the entire .kodi directory.

Forget the rest. I won’t even try to explain my reeasoning here. It’s not important.

Sorry about that, and you are correct we are of two different mindsets on this issue. I think we are going to have to leave it that way as this topic slips into the realm of opinion and different views from pasts experiences. I would suggest you read up on path substitution and check over on the kodi forum regarding the topic. There have been issues with that feature and if it doesn’t look like it would be the correct choice for you then you have another path to get where you want to be. Kodi is a very flexible program and there is often not a ‘best’ or ‘correct’ way to do a certain function.

That would be difficult as it depends on your exact usage. It’s easy to say do this this way, but sometimes there is no one-fits-all answer to how to do that.

We try to cover all of the standard things in the FAQ. But we can’t cover everything.

If you want to go exotic, I’ve been wondering about extending Vero’s LVM into an SDcard. Not sure what happens if the SDcard goes tits up and I think Sam’s plan is to get rid of the LVM with the next kernel bump anyway.

This sounds rather dangerous to me and I doubt I would go down this road. SD cards are still a little bit too unreliable for my taste.
However, if you were to opt for a raid1 with 2 cards… :wink: