Keep KODI database on SD card?

Marvell Kirkwood based
Post Reply
SLT
Posts: 7
Joined: Sat Feb 20, 2016 12:13 pm

Keep KODI database on SD card?

Post by SLT » Sat Jul 07, 2018 7:06 pm

I recently learned that the KODI database can be kept on NAS for several clients to share the same library more efficiently. Through SSH I've setup phpMyAdmin to accept remote connections outside the LAN and it seems to be working fine so far. One last tweak I'd like to make is to move the database file to an SD card on the NAS. Is that even possible? Several clients will be using the shared database which links to all drives so I'd like to keep the HDD activity to a minimum. A worn out SD card is no issue to replace.

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Keep KODI database on SD card?

Post by Mijzelf » Sun Jul 08, 2018 11:23 am

Using 'Tweaks' you can put the whole package system on an SD card, or on an USB stick. That includes the database.

On my box mysql is started with commandline

Code: Select all

/i-data/38aa86ff/.PKG/PHP-MySQL-phpMyAdmin/mysql/libexec/mysqld --basedir=/i-data/38aa86ff/.PKG/PHP-MySQL-phpMyAdmin/mysql --datadir=/i-data/38aa86ff/.PKG/PHP-MySQL-phpMyAdmin/mysql/data --user=mysql --bind-address=127.0.0.1 --log-error=/i-data/38aa86ff/.PKG/PHP-MySQL-phpMyAdmin/mysql/data/NAS520.err --pid-file=/i-data/38aa86ff/.PKG/PHP-MySQL-phpMyAdmin/mysql/data/NAS520.pid
38aa86ff can be exchange by sysvol.
So I guess that if you exchange /i-data/sysvol/.PKG/PHP-MySQL-phpMyAdmin/mysql/data by a symlink pointing to the SD card (and first copy the contents to the SD card), it will offload the database to the SD card.
But. I don't know if the SD card is already mounted when mysql starts. So maybe you should add a check/mount command to the mysql startscript.

SLT
Posts: 7
Joined: Sat Feb 20, 2016 12:13 pm

Re: Keep KODI database on SD card?

Post by SLT » Tue Jul 10, 2018 9:50 am

Thanks for the reply. I'll have to read up on on how to use Tweaks and commands.

SLT
Posts: 7
Joined: Sat Feb 20, 2016 12:13 pm

Re: Keep KODI database on SD card?

Post by SLT » Sun Jul 15, 2018 3:18 pm

Two questions:

1. How do you start mysql with those commands? Cron job?

2. I've installed Tweaks and moved the pkgs to a USB stick but the action seems to be a one-time thing (btw, is it creating symlinks? I tried to view the .sh file over SSH but it's blank). After moving the pkgs I wanted to install some other apps and they're not transferred to the USB stick, neither are they uninstalled from the USB stick if I choose to uninstall through the web-UI, only the files on sysvol are affected. Also, I can't find a way to reset "Packages on usb stick", even after uninstalling and re-installing Tweaks and formatting the USB stick, it's still shown as "Packages on usb stick -> Tweak active". However it's now showing "103904424 kB free" which is my 4 TB sysvol, so now it's not even pointing to the USB stick.

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Keep KODI database on SD card?

Post by Mijzelf » Sun Jul 15, 2018 7:07 pm

SLT wrote:
Sun Jul 15, 2018 3:18 pm
1. How do you start mysql with those commands? Cron job?
No. That's just the way it is started by the package script.
2. I've installed Tweaks and moved the pkgs to a USB stick but the action seems to be a one-time thing (btw, is it creating symlinks?
No, the data partition of the stick is mounted on /i-data/sysvol/.PKG. And that is quite complicated as it has to be done after the raid array is assembled, and before the package system is started.
To manage that, the stick is divided in 2 partitions, one fat partition containing an usb_key_func.sh, and a second partition which is ext3. The usb_key_func.sh is called at the start of /etc/init.d/rcS, where it injects some code in /sbin/zysh.sh . /sbin/zysh.sh is called after the raid array is assembled and mounted, and before the package system is started, so it's a fighting chance to mount the data partition.
Further it creates a file /tmp/.Tweaks/pkg_on_stick.flag, which is the trigger for Tweaks to think the tweak is active.
I tried to view the .sh file over SSH but it's blank).
Which file?
After moving the pkgs I wanted to install some other apps and they're not transferred to the USB stick, neither are they uninstalled from the USB stick if I choose to uninstall through the web-UI, only the files on sysvol are affected.
That can be normal, as the stick is supposed to be mounted on sysvol.
Also, I can't find a way to reset "Packages on usb stick", even after uninstalling and re-installing Tweaks and formatting the USB stick, it's still shown as "Packages on usb stick -> Tweak active".
Formatting? Did you remove the first partition? As long as the usb_key_func.sh & friends are available, the stick will inject itself. Tweaks is no longer necessary.
However it's now showing "103904424 kB free" which is my 4 TB sysvol, so now it's not even pointing to the USB stick.
Hm. Don't know. Have a look at your mounts.

Post Reply