Kodi Community Forum

Full Version: NFS IP address
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I am using NFS to access files from my NAS in XBMC (Raspberry Pi, raspbmc), because a lot of reports state that the protocol is a lot more efficient than SMB. When browsing for a source though, it presented me with a list of NFS servers using their IP addresses. Because I am using a crappy router built into my cable modem, there is no way to assign static IP addresses to my devices. I still used the nfs://<IP> paths for my shares, because using the hostname sometimes gives me problems (XBMC not being able to find the host), probably also due to the crappy router.

Because my NAS is always active, the IP address actually didn't change until now; I guess it has to do with the power failure I had. After the IP address changed, I obviously couldn't access the shares on XBMC. I used path substitution in advancedsettings.xml to fix this, but still updating my library hangs at the "preparing..." stage (translated form dutch). To finally fix this again, I logged on to my XBMC box, opened the video and music database in sqlite and replaced the paths (in my case: "update path set strPath = replace(strPath, '192.168.0.240', '192.168.0.241');").

My questions are:
- Is there a reason why browsing for NFS shares uses IP addresses instead of hostnames?
- If not, when the IP address of your shares changes, is there a better way to replace the paths?

I know a better solution would be to use a decent router which allows me to at least set fixed IP addresses for my fixed devices, and I will be doing that soon. But than I have to explain to my girlfriend why there is another box plugged in next to the modem :-)

Greetings,
JeDi
Blame it on me and get a setup with static ips - everthing else will get wonky and i just save my time to explain why nfs shows ip addresses instead of hostnames... Wink
(2013-01-19, 02:02)JeroenDierckx Wrote: [ -> ]My questions are:
- Is there a reason why browsing for NFS shares uses IP addresses instead of hostnames?
- If not, when the IP address of your shares changes, is there a better way to replace the paths?

I know a better solution would be to use a decent router which allows me to at least set fixed IP addresses for my fixed devices, and I will be doing that soon. But than I have to explain to my girlfriend why there is another box plugged in next to the modem :-)

Greetings,
JeDi

IP addresses are used because most networks don't have a DNS server, so they can't resolve the names (personally, I think this is an oversight on the part of all the router manufacturers, but I can understand that it only really affects a small proportion of the users. I run a Raspberry Pi with DHCP server and Dynamic DNS update, simply so that I can use names!)
The way to avoid problems with your NAS changing its IP address is to reconfigure your NAS, not your router: simply give the NAS a static IP address in its configuration. But make sure you pick an address that the router isn't going to give out to another device (if necessary, you may need configure the router to restrict its available set of IPs slightly).

Thanks for the tip!
I can actually choose the range of IP addresses for the DHCP server of my router, so I will reserve the first 100 addresses for static ones.

On another note, would it be possible to write an XBMC addon that does the replacement of the IP address in the database? Can we access the raw databases using python? Learning the XBMC addon system is on my TODO list for a while now, and that could be a good exercise for a first addon.

Greetings,
JeDi
well changing the db will screw all your fanart/thumbs because they are hashed on the complete url which would change. I wouldn't recommend that. You could try to export your db as xml (somewere under system->video->database) - change all pathes in the xml and import it back. But the fanart/thumb problem is the same then i guess.
Hmm, I did change the database, and all artwork seems to still work correctly. If the hash changes is the artwork just downloaded again?

Is there a better way to change the paths when an IP address changes? Or is exporting+importing the database the most efficient way?
exporting + importing is fine i guess...
I was in a situation again where I had to change the IP address of my NAS (double NAT environment, don't ask), so I had to deal with this problem again. There still is not an ideal way to solve a changing IP address of your sources. I only have one NAS, I can imagine it is even more unpleasant when multiple sources are used. I probably did a lot of things wrong, but here is the description of this rather painful process.

I managed to export a video database using the old IP address, so with the video locations intact. I exported both to one file and separate files to be sure. At this point, XBMC was already without internet connection (due to the new NAT situation). The single file export ended up with a videodb.xml file and a bunch of empty directories. According to the wiki page, there should be thumbnails and fanart, but I can't find them. Could that be due to the lack of internet connection?

This is what I did after I changed everything to the new NAT setup, so with a new IP address for my NAS:
- I updated the locations of my NFS video sources to the new IP address
- Cleaning the video database in settings took a very long time (I guess it tries to access the files on the old IP address). So I stopped XBMC and deleted the database files in the shell (the whole Database directory in .xbmc/userdata). After I restarted XBMC, the database files are created again.
- I replaced the old IP address in videodb.xml to the new one.
- I imported the changed database by doing Import database in the settings screen, and selecting the folder with the videodb.xml file. At this point XBMC hangs, no progress indicator is shown. I could see in the shell that XBMC was using 100% of the CPU though, so I kept it running for a while. After 15 minutes, an import progress dialog appeared. This progresses very very slowly, and after more than an hour I stopped XBMC again because it takes a lot less time to just start from scratch.

At this point, I wanted to take a look at my xbmc log to see if something strange was in there. Strangely, the log file seems to be corrupt at the beginning and end. In the middle, there is some readable text: a lot of lines stating about the same thing. This is a snippet:

Code:
18:42:38 T:3037581312   ERROR: GetDirectory - Error getting /home/pi/xbmc_videodb_1970-01-01/actors/.actors
18:46:23 T:3037581312   ERROR: Previous line repeats 20 times.
18:46:23 T:3037581312 WARNING: GetDurationFromMinuteString <runtime> should be in minutes. Interpreting '0' as 0 minutes
18:46:24 T:3037581312   ERROR: GetDirectory - Error getting /home/pi/xbmc_videodb_1970-01-01/actors/.actors
18:46:33 T:3037581312   ERROR: GetDirectory - Error getting /home/pi/xbmc_videodb_1970-01-01/tvshows/Californication
18:46:42 T:3037581312 WARNING: GetDurationFromMinuteString <runtime> should be in minutes. Interpreting '0' as 0 minutes
18:46:42 T:3037581312   ERROR: GetDirectory - Error getting /home/pi/xbmc_videodb_1970-01-01/actors/.actors
18:47:46 T:3037581312   ERROR: Previous line repeats 7 times.
18:47:46 T:3037581312 WARNING: GetDurationFromMinuteString <runtime> should be in minutes. Interpreting '0' as 0 minutes
18:47:47 T:3037581312   ERROR: GetDirectory - Error getting /home/pi/xbmc_videodb_1970-01-01/actors/.actors
18:48:06 T:3037581312   ERROR: Previous line repeats 1 times.
18:48:06 T:3037581312 WARNING: GetDurationFromMinuteString <runtime> should be in minutes. Interpreting '0' as 0 minutes
18:48:06 T:3037581312   ERROR: GetDirectory - Error getting /home/pi/xbmc_videodb_1970-01-01/actors/.actors
18:48:27 T:3037581312   ERROR: Previous line repeats 1 times.
18:48:27 T:3037581312 WARNING: GetDurationFromMinuteString <runtime> should be in minutes. Interpreting '0' as 0 minutes
18:48:27 T:3037581312   ERROR: GetDirectory - Error getting /home/pi/xbmc_videodb_1970-01-01/actors/.actors
18:48:57 T:3037581312   ERROR: Previous line repeats 2 times.

Update: I just noticed that the log file is interpreted as an image when opening in Google Chrome. Something very strange is going on here...

After this, I just deleted the databases again to be sure, and rescanned my entire library. This takes about half an hour (a lot slower on my Rapberry Pi than on my Apple TV).

Now my library is functional again, but I have lost all my watched statuses of my movies, which is a bit annoying... Also, I lost the image cache, so all images have to be downloaded again. Does anyone know a method that could work where I don't loose the watched status and image cache? Is the above method better than just replacing the IP address in the various databases? Because that seemed to work (although as stated by Memphiz possible corrupted the image cache database) and I could easily write an SQL script to do that automatically next time.

I personally do not have any problem doing all these steps, only the part where I loose my viewed status of my items are a problem. But non-technical users will be uncomfortable even setting a fixed IP address, let alone logging into a shell, exporting the database, doing a search/replace, importing the database again, ... So I still feel there should be a way to automate this, preferably using a plugin. A lot of people (especially here in Belgium) use cheap routers that come with their cable modems, which implement very poor DHCP handling.

Any thoughts? Maybe a step-by step plan in the wiki would be enough for this situation?

Edit: I forgot to add some information about the setup I am using: it is a Raspberry Pi Model B, using the latest release of RaspBMC. The root filesystem is installed on a USB drive because that results in somewhat faster I/O speed, and I am using the supported version of XBMC, for which I cannot seem to find the proper version (stated as 12.0 GIT:unknown). I did not update to the latest nightly, so it is a version of XBMC from a couple of weeks back. If you need more info, I will happily provide it.

Greetings,
JeDi