I’ve noticed that the disk on my NAS (a WD My Cloud) doesn’t always spin down after connecting to it with OSMC, and I’d like to debug this. First, I need to see if there’s a persistent connection to the NAS, using the command line. I find that “mount” doesn’t show anything extra when I play a video file that’s stored on the NAS, so Kodi evidently doesn’t use the Linux OS’s normal mounting mechanism to access remote samba shares. How does Kodi access remote samba shares? How do I list the current connections, please?
If you mount at the OS level, lsof will probably work
I’m not sure what you mean. At the OSMC command line, I want to list the connections that are made by Kodi’s normal access mechanism to a remote samba share. And given that I don’t know what that is, I have no parameters to pass to lsof.
Kodi uses libsmbclient. I don’t think you’ll be able to easily see it from the command line, but you could try lsof | grep libsmbclient
OK, I’ll Google for libsmbclient connection debugging.
Hmmm. lsof does show this:
ActiveAE 257 350 osmc 40u IPv4 9806 0t0 TCP osmc.local:41763->WDMyCloud.local:microsoft-ds (ESTABLISHED)
It seems that I can use lsof to reliably show the state of the external connection:
root@osmc:~# lsof -c kodi.bin -a -i TCP@osmc.local COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME kodi.bin 257 osmc 35u IPv4 8309 0t0 TCP osmc.local:44842->WDMyCloud.local:microsoft-ds (ESTABLISHED) kodi.bin 257 osmc 42u IPv4 8309 0t0 TCP osmc.local:44842->WDMyCloud.local:microsoft-ds (ESTABLISHED) kodi.bin 257 osmc 43u IPv4 8313 0t0 TCP osmc.local:44843->WDMyCloud.local:microsoft-ds (ESTABLISHED) kodi.bin 257 osmc 44u IPv4 8313 0t0 TCP osmc.local:44843->WDMyCloud.local:microsoft-ds (ESTABLISHED)
If I play a video, then stop it by pressing “x”, then under normal circumstances, the above connection apparently has a timeout of 90 seconds, after which it disappears, then the disk of my NAS spins down after its timeout of 10 minutes.
I can’t reproduce the fault of the persistent connection right now, but I know what to look for if it happens again.
OK, question answered.