Running KodiBuntu (Lubuntu 14 ?) and I want to mount some shares from my windows computer. I have them mounted in /media/ using fstab and it works fine as long as the Windows machine is on when ubuntu boots. But if the Windows machine goes down, I have dramas with my other mounts and if the Windows machine isn't on when uBuntu boots, nothing gets mounted.

Is there anyway to mount the share regardless of whether the Windows machine is on or not and perhaps just show a empty folder with write permissions denied for all or something?

Thank you :)


To mount your share with Linux

First of all, you can add the nofail option in your fstab line, so that the system does not complain if it does not find your network share. If that happens, you will have to manually mount after booting your windows machine, for example with a sudo mount -a.

But there is another approach that I tend to advise in such cases : use autofs. Instead of mounting your shares at boot-time, it mounts them when you try to use them, and unmounts them when you don't.

The following should work in your case. Please note that I chose to mount everything under /mnt instead of /media, because /media is usually used for dynamic mounts (I would not advise to use it for permanent mounts or autofs).

First remove (or comment) your line in fstab, then install autofs :

sudo apt-get install autofs

Create your parent directory :

sudo mkdir /mnt/smb

then modify /etc/auto.master to add a line like this one :

/mnt/smb /etc/smb.auto --ghost

And create a file /etc/smb.auto with a content like this one :

windowsserver -fstype=cifs,rw,username=myuser,password=mypass ://windowsserver/share

Then restart autofs

sudo service autofs restart

And try to browse the content :

ls -al /mnt/smb/windowsserver

It should mount the share automatically at the moment you try to use it. If mounting fails (for example because your server is off), you will see an empty directory (and "Host is down" error messages, at least on command-line). Then, if you start your server you should be able to access your files automatically (without the need to ssh on your kodibuntu).

See https://help.ubuntu.com/community/Autofs for more details.

To mount your share with Kodi

If you're using Kodibuntu, there is another option, which seems a lot easier, and probably more suitable : instead of mounting your share at the OS level, Kodi is able to access network shares by itself.

This can be done through the user-interface of Kodi : see http://kodi.wiki/view/Adding_video_sources#Adding_Remote_sources

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.