I can successfully connect my Xubuntu PC (cable-connected to office network) to a Windows NAS using this line in /etc/fstab:

//Hall/Share /media/HallShare cifs credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

And running:

sudo mount -a

The mount is automatic on boot.

The problem is that often (but not always) when I turn on my PC, NAS is not mounted (that is /media/HallShare is empty and sudo mount -l doesn't list anything related to this folder). And when I try to manually run sudo mount -a, the command hangs with no messages for indefinite time:

lorenzo@PC:~$ sudo mount -v -a
mount: proc già montato su /proc
mount: UUID=3c72b8d3-a568-46bd-9fa0-1fa59532b579 già montato su /home
mount.cifs kernel mount options: ip=,unc=\\Hall\Share,credentials=/root/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777,ver=1,user=lorenzo-1,pass=********

I cannot find anything in /var/log/dmsg. Can somebody help me to identify the problem?

Here is my /etc/fstab:

# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0

# Windows NAS (\\hall)
//Hall/Share /media/HallShare cifs credentials=/root/.smbcredentials,noauto,iocharset=utf8,_netdev,file_mode=0777,dir_mode=0777 0 0

And my /etc/rc.local:

mount /media/HallShare
exit 0

Your NAS is being mounted with the auto option. This is known to cause problems on some system setups. You could fix this issue by adding the noauto option to your mount options:

//Hall/Share /media/HallShare cifs credentials=/root/.smbcredentials,noauto,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

However, this way your NAS will be mounted but not bound at boot at all, so you'll have to take another step: in a terminal type

gksudo gedit /etc/rc.local

At the end of the file, add the following line before the exit 0 (if not there, be sure to add exit 0 at the very end):

sleep 20

mount /media/HallShare

Save the file, reboot and you should be all set! Good luck!

(For reference: https://wiki.ubuntu.com/MountWindowsSharesPermanently)

  • 1
    BTW: the command of choice in your case would be sudo mount /media/HallShare instead of mount -a accordingly. – FuzzyQ Aug 4 '12 at 19:15
  • 1
    Another note on the matter: Depending on whether you're using DHCP or fixed IPs, using a fixed IP-adress for your NAS and adding it to your /etc/fstab configuration instead of the resolved name might do the trick as well. – FuzzyQ Aug 4 '12 at 19:25
  • 1
    @FuzziQ Back to work from holydays. Unfortunately it does not work. I placed the noauto option and then done mounting in /etc/rc.local: sometimes it mounts, sometimes does not :( – lorenzo-s Aug 29 '12 at 9:54
  • 1
    Ok, now I'm quite sure it's working every time. Thank you very much! – lorenzo-s Oct 31 '12 at 8:05
  • 1
    Glad it's working, congratulations! – FuzzyQ Nov 2 '12 at 9:48

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.