Change NFS source (IP address)

Hi,

the media sources of my Vero 4k points to “\192.168.1.x\share” of my QNAP NAS

I had to transfer all my data of the NAS to another location an now I want to point the share to a new NFS-share (IP address).

Is there a way to change the IP address (ssh?) without rescan all the files?

bes regards

https://kodi.wiki/view/Path_substitution

If this is a filesystem mount mounted to a local folder then just change the ip and mount it to the same location and so long as the structure of the directories/files hadn’t changed then Kodi will not know this lives on a new server and no re-scraping will be needed.

Hi,

where do you mean to change the ip? In the gui (media settings)?

Typically in the same place you set up the NFS mount in the first place. There are different ways to do this (AutoFS, fstab, within Kodi) so without knowing how you initially set up your mount it’s a bit hard to say.

Ah ok understood, I managed this with fstab …

regards,

Sarge

Hi,

i checked fstab, but I there is only one entry, whereas in sources.xml i have all the entries for my movies

example:

video
default pathversion=“1”**/default
source
nametv*/name*
path pathversion="1"nfs://192.168.1.20/share1//path
allowsharingtrue*/allowsharing*
/source
source
namemovies*/name*
path pathversion="1"nfs://192.168.1.20/share2//path
allowsharingtrue*/allowsharing*"

I tried to modify the ip address with the new one, but then a re-scraping will be made. So what is the best way to point to the new ip without re-scrape?

The path substitution linked above

This guide on path substitution may be a bit easier to follow if you still had questions after reading the wiki article linked above.

Hi,

yesterday I had no success with “path substitution”. Thanks for the guide, I’ll have a look.

best regards,

Sarge

Hi Sarge,

This is how I’m set up using fstab and I’m pretty sure what gets store in the library is the ‘effective’ path & filename rather than the IP address. My movies are therefore stored as /mnt/sharedmedia/mymovies/… and I can relocate the server IP address simply by amending fstab if necessary.

1 Like

Yep, that’s why I like using fstab/autofs. I’ve moved drives from server to server several times and don’t need to re-scrape. Just adjust fstab/autofs.

I do however use path subsitution on a windows PC that shares the library to convert the Linux path to an IP address Windoze can understand. Seems to all work well for me. Just never try to update the library from the Windows side…

If you have it setup correctly, you can update a MySQL shared database from any connected device without issue. The important bit is that all clients are using the exact same file paths for the sources as that is what gets added to the database. When you use a path substitution that does NOT get stored in the database. So if on Windows your source path is set to /mnt/something and you do a path substitution to point to smb:/computer/something then any library updates in Windows will store /mnt/something/… paths in the database.

Hi Guys,

Sorry for hijacking this thread, but I’m planning to do something very similar, conmecting my usb HDDs to another NFS server - moving from a popcorn Hour NFS share to a newly built Raspberry Pi NFS server.

So, the IP address and the first part of the path will change - depending on how popcorn named the NFS link to the HDD and how Raspberry openmediavault vill name them, however no other changes in the file structure.

To make everything a bit more difficult, my raspberry pi also works as an SQL server for my kodi media database.

So I would need to replace the links to all my 12 usb HDDs in the database with an SQL commands as the easiest way? Or exporting the database to XML and simply replace in text editor the links and import back to the database via myphpadmin?

  1. Current NFS link to the HDD
    Nfs://192.168.1.114/opt/sybhttpd/localhost.drives/USB_DRIVE_XXXXDRIVESERIALNO-2/TV-SERIES-1/moviefile.mkv

  2. New NFS link to the same HDD via new server
    Nfs://192.168.1.133:2049/export/TV-SERIES-1/moviefile.mkv

If thats the solution, how or where can I change the media source links on Vero not to force a library rebuild?

Or do you have any better sllution for this project?

Thx!

If you would like to use a MySQL database for several Kodi clients that use different methods to access the shared media (e.g. a mix of SMB, NFS and/or system mount based access), or have need of modifying a path of an existing source (such as converting from a Kodi path to a system mount) you can use the path substitution function of Kodi to facilitate this. The following guide will provide instruction on how this works, including a section specific to MySQL usage and how your sources should be configured.

Please see [HowTo] Repairing File Paths with Path Substitution for details.

Hi fzinken,
Thanks, for that. Well, yes, that’s why I made this setup to be able to reach the central database and HDDs from my two Vero 4K+, and my PC kodi or any other Kodi clients. However, I will only use the NFS share on that central server (USB HDDs plugged into the Raspberry Pi OpenMediaVault NAS.

As using the Path substitution will not change the database it can cause issues with cleaning databases, and adding new movies from the new location, therefore I’d like to get rid of the old links since they won’t be used anymore. I’d like to keep them tidy with valid information for the future.

Can you please confirm, if I modify the SQL database, and replace all the links in the MyMusic72.sql and MyVideos116.sql, and in the sources.xml on the Vero 4K+ to the new links, then I won’t run into any unrepairable issues? How about the thumbnails, and album arts stored on Vero? I guess they are not related to physical network addresses.

Thanks for your help!

I am confused, I thought you are using a central MySQL database?

Yes, I’m using the mariaDB server on that raspberry pi. But can export the databases to SQL files, and then do the modifications with simply REPLACE TEXT in Notepad ++, save, and import back the SQL file into the mariaDB server. Well, actually the server running at the moment on my QNAP NAS, but just moved the database to the Raspberry pi with the same way (export - import), and works like a charm.
Since the SQL export file is a text file, it must be super easy to replace all links with the text editor, rather than trying to figure out which tables contains links to HDDs.

If you want to edit your MySQL database like that then just back it up and give it a go. If you bork everything then restore from the backup. I don’t think anybody is going to recommend you go down that path and it really is not needed.

Once you have scraped in a library you just need to treat those sources as being fixed. Any clients should use the exact same sources.xml EVEN IF THE PATHS IN THEM ARE NO LONGER VALID. You can then use path substitution to fix any file path that changed or is different as described in that how-to. You can also change it on any client at any given time. If on one machine you decided to switch over to a system mount you can just change the ‘to’ part of the substitution to point to a mount instead of the network share.

If you do this as I described there is zero issues adding new movies, cleaning the database, or anything else. The database will store a file path based on what is in sources.xml and path substitution does not change this. As long as the file paths in sources.xml do not change, then how the information gets stored in the database will not change.

As for the thumbs I don’t think they would be effected either way. Your current cached thumbs are local to the client as is the database that manages them. If you have local art sources they will have links to them in the MySQL db that will have to be corrected but they would be dealt with by the same method you used for your media paths.