DietPi-Software | Kodi: Use tmpfs for temp directory

Created on 30 Mar 2020  路  5Comments  路  Source: MichaIng/DietPi

Creating a feature request

Is your feature request related to a problem? Please describe:

Kodi saves temporary files, including kodi.log under ~/.kodi/temp which it occasionally cleans up. To avoid SD card corruption we could mount ~/.kodi/temp with tmpfs

Describe the solution you'd like:

  • Mount ~/.kodi/temp with tmpfs
Feature Request

All 5 comments

@glogiotatidis
Many thanks for your request, great idea.

What I was actually thinking of is to switch our starter to a systemd service with a fixed kodi user. This allows us to grant the process specific permissions and have a central config and data dir, as we have it for most other software services. I guess it would be possible as well then to statically move the Kodi tmp dir to e.g. /run/kodi or similar. What is Kodi actually storing there, how large needs the tmpfs to be?

+1 on using systemd.

Kodi uses .kodi/temp for special://logpath and special://temp by default. According to Kodi doc they are for

special://temp

Kodi's temporary directory. This path is used to cache various data during normal usage. Unless you need the log, nothing in this directory is detrimental to Kodi's operation. Normally special://home/temp

special://logpath

This path points to the path where the log file is saved.

I queried 3 dietpi installs i have and it ranges from 6Mb to 90Mb. I'd say 200Mb should be enough (maybe even 100 if 200 is a stretch)

@glogiotatidis
Okay, I think /tmp/kodi/ should work well for this. We can even configure the systemd unit to use a PrivateTmp=true. systemd then creates a /tmp/systemd-private-<string>-kodi.service-<string> directory that is readable to the Kodi process only and is removed automatically on service stop. Only for the logs this is suboptimal, but probably those can be redirected to systemd-journald or to /var/log/kodi/, hence the RAMlog, if enabled.

I personaly use tmpfs for /tmp
Then i use /etc/tmpfiles.d to create /tmp/kodi
~/.kodi/tmp is then just symlink to /tmp/kodi

Reason for this is that if every app has its own ramdisk, it will not be possible to limit total ramdisk usage. I have limited the size of /tmp and that way i can enforce global limit for all apps, since they just use symlinks to the same filesystem, which already has limit.

Yes that is an alternative. However instead of using a symlink it is indeed cleaner to tell Kodi directly which directory to use.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kapot picture Kapot  路  3Comments

Fourdee picture Fourdee  路  3Comments

MichaIng picture MichaIng  路  3Comments

oshank picture oshank  路  3Comments

aesirteam picture aesirteam  路  3Comments