Changing networked media drive's hardware without losing library

I currently have some Vero 4k boxes that play media from a networked drive.

My network drive is an old ish Banana Pi board with my HDD attached via sata.

Being bored, and wanting to update things, I’ve now got myself a Raspberry Pi 4, and I’m going to attach my hdd to it via USB3, and make it my new networked drive.

For obvious reasons I’m wanting it to be that once I’ve swapped them all over, the Vero’s won’t notice the difference and will continue functioning as normal, and my media library won’t be affected.

So with that in mind, what files do I have to copy from the Banana Pi to the Raspberry Pi?

My initial presumptions are that I should copy the fstab file so that the drive is mounted in the same place? Changing the UUID of the drive as required, if it is different on the RPi.

I presume also that in the SMB.conf file I should copy the same info regarding the drive’s sharing?

If all that’s correct, that should cover the mounting of the drive so it is seen in the same place, but what about the actual library?

what files do I copy across so that it has the osmc library?

Thanks in advance!

So the question is what is the relation to OSMC :wink:

Well the main question is how do you access the files from OSMC? Are you just using Kodi access or you have mounted them via fstab/autofs?

You should be able to access via same method as currently. But if not you can use path substitution

No relation to OSMC, except I use OSMC to access the media attached to the BPi/RPi. But that’s why I posted in “General Discussion” which states “Discuss anything (including non OSMC related topics) here”.

I’ve mounted the drive using the FSTAB on my Veros with the following line:
// /mnt/media cifs x-systemd.automount,noauto,password= 0 0

So, once I’ve got the drive set up with the RPi4, I’ll just use the path substitution in the advancesettings file with the “from” part as “//” and the “to” part as whatever it ends up being? If I’m able to set the RPi4 up at the same IP address and give it the same name ‘Media_Server’, would there be any difference from the Vero’s point of view?

I presume the SQL database that is on the BPi just now will need to be copied across to the RPi? Do you know what files need to be copied for that?

No need to use path substitution in that case. just change the fstab line on the Vero to point to the new server. As long as you mount to /mnt/media your Library will remain working as before.

So you are using a central MYSQL database on BPi instead the local SQLite Database on the Vero?

Yes, I have two Veros that take media from the current BPi network drive. When I set up the system many years ago I believe I followed the info in this link - MySQL - Official Kodi Wiki - to set up the BPi as the SQL server for the database. That way whenever either of the Veros updated the database to account for new additions, they would be seen by both of them.

So while I could follow the same instructions for setting up the RPi4, I think that may result in me having to scan in the whole media library again to set up the database, which I’d rather not do.

I’m hoping there’s a solution where I can just copy something across so that the library database is there ready to go.

MYSQL database files are in /var/lib/mysql/ but I would suggest to export the mysql from the BPi and import on the RPi

Thanks, I will do that… however, and I’m sorry for the spoon feeding requirement I have here, how do I export and then import it?

Generally for easy mysql management I suggest to install phpmyadmin which also allows you to export and import via a Webinterface

I personally wouldn’t migrate the db. I would export nfo files in Kodi (not the single file export) and then on the new machine install and configure MariaDB. On one of your Kodi clients make sure you have import watched and resume state included in your advancedsettings.xml and change the MySQL to the new server. When you update your library everything should come in as it was before. Once you are sure this is good you can change the other clients to point to this new db as well.

Thanks for the alternate idea. I’m most the way through trying the exporting and importing the DB and setting up the RPi4, so will finish that way first. If it works, great! If it doesn’t I’ll reconnect the BPi, and do your idea.

I think I missed a step. Once you are connected to a clean db the sources will still be there in Kodi but the scraper info I think is stored in the db so you would have to do a set content on all sources in order to get the library to update.

Ok, I’ve decided to go this route as my original export and import of the database doesn’t appear to have worked.

But I’ve run into a problem. It seems that somehow I can no longer write to any of the media drive’s folders to export the database as a single file on to there. I also tried to export the database as multiple files and again, it didn’t work as I can’t write to any of the folders.

Given that I’ve done it in the past, I’ve no idea how the permissions have changed.

I’m not clued up on this. I tried to google changing the permissions, but the things I tried don’t seem to have worked.

How do I change the permissions so that the entire drive is writable?

Edit to clarify - I can write to it via the SMB share from my windows machine, but from my Vero boxes I can’t write to it to export the database to the media drive either as a single file or as multiple files.

Networking in Linux is not something I’m well versed in but if you can write to it from Windows then I would think you have a networking permission issue and not a file permission one. If you have your existing db connected to Kodi on your Windows box you can do the export with that instead.

Unfortunately I don’t have kodi on my windows machine, only my Veros.

I’ll ask in another forum regarding this network issue.

Ok, I’ve had no luck with any method of doing anything at the moment. Nothing’s working.

Tried the exporting DB and reimporting. Didn’t work.
Tried exporting library, then importing again to a clean RPi OS install, with the MariaDB installed. Didn’t work. Selecting the correct folder for the import resulted in nothing happening.
Have now tried to rescrape everything again. Again, didn’t work as nothing happened.

I have the RPi at the same IP address as the BPi was at, the BPi is no longer connected. So in theory it should just be slotting in to take over from the BPi, right?

On my Vero I have the drive attached to the RPi mounted via fstab to the same location, i.e. mnt/media, and when I view my sources I can click through and access and play all the files via the file viewer.

However, when I edit the source to set the content, set it as whatever is relevant, and select ok, it asks do I want to refresh, I select yes, and nothing happens.
I select update library, and nothing happens.

So clearly something is messed up somewhere.

Should I change the RPi’s IP address to something different, just in case there is an issue somewhere regarding the comms as there’s some form of conflict in the communication as it has the same IP as the BPi had?

I’ve got a log for it here -

In this log period I did the following in this order:
Tried to import the library from the library location, then when nothing happened I;
Set content on a source and tried to refresh for everything in that folder, then when nothing happened I;
Tried to update library several times with nothing happening each time.

So any help explaining why it just won’t scan or update anything, would be appreciated!!

Are you sure that you configured the kodi user on the new data base and gave it access to the right database?
Unable to open database: MyMusic72 [2002](Can't connect to MySQL server on '' (115))

On the Vero run mysql -u kodi -p kodi -h
Can you connect?
If yes type show databases;

I thought I had. I followed the Kodi guide to setting up a mysql database (here) and carried out these instructions on the RPi.

  1. Type in: CREATE USER 'kodi' IDENTIFIED BY 'kodi'; and press return
  2. Type in: GRANT ALL ON *.* TO 'kodi'; and press return
  3. Type in: flush privileges; and press return

Running that command line gives:

osmc@osmcveroplayroom:~$ mysql -u kodi -p kodi -h
-bash: mysql: command not found

Edit in
Could there be any issue in that previously I installed mysql-server as per the kodi guide, but when I tried

sudo apt-get install mysql-server

on the RPi, it did not work as said it didn’t exist any more or something like that, so instead I used

sudo apt install mariadb-server

Could any difference between mysql and mariadb be making the difference here?

That’s strange I thought I saw that you had the mysql client installed on that Vero.
Try sudo apt-get install mysql-client and then run again

I get the same message as when I tried to install the mysql server on the RPi

osmc@osmcveroplayroom:~$ sudo apt-get install mysql-client
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package mysql-client is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘mysql-client’ has no installation candidate

This is why I installed the mariadb-server on the RPi.

I presume I should try

sudo apt-get install mariadb-client?

sudo apt-get install mariadb-client