My OS is Linux Mint 18.1.
I have a NAS in my home net. I used to mount it's volumes via fstab file and everything was fine.
After some upgrading of my PC I added one more partition to mount (on the SSD). And when I added due automount line in my fstab, problems began.
I tried various options. The PC hanged at the start and I had to return default fstab file to continue… At last the system refused to start altogether and I had to reinstall my Linux Mint.
My problem with fstab: I cannot fix the error message. So I decided to use /etc/rc.local and view errors.
I added such commands in rc.local:
mount -t ext4 -L Data /mnt/data
mount -t cifs -o credentials=/home/user/my-sys/.user,iocharset=utf8,file_mode=0775,dir_mode=0775 //192.168.0.100/Volume_1 /mnt/vol1 2> /home/user/mounterr.log
The Data partition is being mounted OK.
The CIFS gives error:
mount error(101): Network is unreachable
Manual launch of this mount command gives OK.
What is the cause of the error during rc.local execution? I'd like to understand – instead of just to use one more way (crone or what else…).
Regards,
Yury
Best Answer
The error
mount error(101): Network is unreachable
means that you attempted the mount before the network came up.To fix this, add the
_netdev
option to your/etc/fstab
CIFS entry._netdev
means to delay the mount until your network is connected.Your
/etc/fstab
line should look like this:To continue using
/etc/rc.local
for your mount, you'll need to set up a new job (to prevent blocking) that loops until the network is up.From this answer in Ask Ubuntu:
Replace
W.X.Y.Z
with an IP address that responds to ICMP requests, like your router gateway.