LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-14-2015, 01:57 PM   #1
gooner47
LQ Newbie
 
Registered: Aug 2015
Posts: 2

Rep: Reputation: Disabled
Can't get a CIFS network drive to mount on boot


I have added a share in fstab to access a network drive with all my files on... fstab looks like:

Code:
proc /proc proc defaults 0 0
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
//192.168.1.73/disk1 /media/disk1 cifs username=pi,password=raspberry,_netdev,uid=1000,gid=1000,iocharset=utf8, 0 0
# a swapfile is not a swap partition, so no using swapon|off from here on, use dphys-swapfile swap[on|off] for that
When I run sudo mount -a the network drive mounts successfully and I can do cd /media/disk1 then ls which correctly gives me a list of all the folders on said network drive.

However, after rebooting the pi when I cd to that location and run ls again, nothing is there. I have to manually run sudo mount -a again, which then mounts the drive.

I have seen this reported many times, and the consensus seems to be that the mounts in fstab are happening too early - before the network has been established. I've tried to implement the things I understand - but to be honest a lot of it is way over my head. I've added _netdev to the line in fstab, I've added rootdelay=10 into /boot/cmdline.txt, I've installed networkmanager... none of this has helped.

And so I turn to you, about ready to throw the pi out the window - followed by myself. Any help, much appreciated.
 
Old 08-14-2015, 09:12 PM   #2
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 1,437

Rep: Reputation: 192Reputation: 192
The '_netdev' option is not always sufficient for slow networks. In particular, if Network Manager is involved, and systemd there can be problems. So, you might want to tell us the OS and version. Are you using Network Manager? There are solutions for coping with that situation.

There are a number of possible options (depending on answers to the above). Anyway, 2 to start with...

1. You could try adding the 'noauto' option, so that the samba mounting does not occur at boot, but later on. For example, add the mount via /etc/rc.local
Code:
mount /media/disk1
exit 0
2. I recall an old openSUSE thread where it was suggested to remount via crontab.

Last edited by ferrari; 08-14-2015 at 09:18 PM.
 
Old 08-14-2015, 09:16 PM   #3
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 6,403
Blog Entries: 6

Rep: Reputation: Disabled
Hi & Welcome to Linux Questions.

Sorry you have to keep running the mount -a cmd over and over again.

I'm sure there is a way to make this permanent but I don't have experience with that. I think you need udev.
http://linuxconfig.org/automatically...ve-with-autofs

Don't throw your pi out the window and most certainly don't even think of jumping out yourself.
-::-Hang in there gooner47 until a member with more experience can chime in to help you.-::-

*You might want to include what distribution you are using and post the output of lsusb to see if the device is showing up.*

In the meantime look here.
https://wiki.archlinux.org/index.php...torage_devices
 
Old 08-14-2015, 09:24 PM   #4
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 1,437

Rep: Reputation: 192Reputation: 192
@Ztcoracat: The NAS is not a usb device, it's on the network. The network isn't available when the fstab mounting takes place, so it must be delayed.
 
Old 08-14-2015, 09:36 PM   #5
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 6,403
Blog Entries: 6

Rep: Reputation: Disabled
Quote:
Originally Posted by ferrari View Post
@Ztcoracat: The NAS is not a usb device, it's on the network. The network isn't available when the fstab mounting takes place, so it must be delayed.
Ok, thanks-

How do you delay the process?
 
Old 08-14-2015, 09:50 PM   #6
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 1,437

Rep: Reputation: 192Reputation: 192
That can depend on the init system and the network manager in use. The crontab approach (mentioned above) does work for some. Others use auofs to do the mounting.

Where systemd is employed, it is possible to use the x-systemd.automount option

http://www.freedesktop.org/software/...emd.mount.html
https://wiki.archlinux.org/index.php....2Fetc.2Ffstab

For those using system and Network Manager, there is the NetworkManager-wait-online.service freedesktop

http://www.freedesktop.org/wiki/Soft...NetworkTarget/
https://wiki.archlinux.org/index.php...er_Wait_Online

Although I have no experience (or need) with using this.
 
Old 08-14-2015, 10:02 PM   #7
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 1,437

Rep: Reputation: 192Reputation: 192
Similar thread here

http://raspberrypi.stackexchange.com...as-drive-fails

where a script runs 'mount -a' later in the boot process.

If necessary, an additional delay can be included using the sleep command eg 'sleep 10'
 
Old 08-14-2015, 10:15 PM   #8
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 6,403
Blog Entries: 6

Rep: Reputation: Disabled
Good links ferrari; thanks.

Quote:
Although I have no experience (or need) with using this.
Ditto:-

If I'm not mistaken systemd has some control over the start and stop services so it may not be a walk in the park to make the delay happen. I'll re-read the links you posted.
 
Old 08-14-2015, 10:24 PM   #9
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware
Posts: 6,403
Blog Entries: 6

Rep: Reputation: Disabled
It looks like it boils down to this:
Code:
If you use NetworkManager you can do this by enabling NetworkManager-wait-online.service:

systemctl enable NetworkManager-wait-online.service

If you use systemd-networkd you can do this by enabling systemd-networkd-wait-online.service:

systemctl enable systemd-networkd-wait-online.service
Sorry gooner47 I'm not good with NAS and the process by which you'd have to set up to make it work.
 
Old 08-25-2015, 04:01 PM   #10
gooner47
LQ Newbie
 
Registered: Aug 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
Firstly apologies for the time taken to respond to this thread, I've literally only just had time to sit down and have a play around with this again.

Secondly thanks for all your input and help.

In the end, I followed some very clear instructions provided in a response to another post I made elsewhere:

http://raspberrypi.stackexchange.com...-mount-on-boot

Thanks again for all your help.
 
Old 08-25-2015, 05:04 PM   #11
ferrari
Senior Member
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 1,437

Rep: Reputation: 192Reputation: 192
Very good.... that uses the crontab method to re-mount as I suggested in post #2.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux (RHEL/SLES) CIFS mount of Windows network drive is unreliable: Input/Output err gqdabien General 2 02-25-2013 06:47 PM
manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied CADIT Linux - Newbie 6 11-20-2009 03:48 PM


All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration