gooner47
Posts: 10
Joined: Wed May 15, 2013 11:37 pm

Can't get a CIFS network drive to mount on boot

Sat Aug 08, 2015 4:33 pm

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

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 on other forums, 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.

gooner47
Posts: 10
Joined: Wed May 15, 2013 11:37 pm

Re: Can't get a CIFS network drive to mount on boot

Sat Aug 08, 2015 4:41 pm

In addition, after finding another thread I've tried adding the following into rc.local, wih no auccess:

sleep 5
mount -t cifs //192.168.1.73/disk1 /media/disk1 username="pi",password="raspberry"


JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: Can't get a CIFS network drive to mount on boot

Tue Aug 11, 2015 7:47 pm

It is strange how it is a problem for some and not for others. And in my case dmesg says the mount failed yet it's there and working.

I mount a Samba share from a FreeNAS box. Since that NAS powers down all the drives after 45 minutes of inactivity I expected to have trouble, since there was a good chance it may be inactive and wasn't going to respond until the drives spool back up, but that hasn't been the case.

The fstab looks like this:

Code: Select all

//192.168.0.98/NetworkFolder /home/jimmy/network-folder cifs credentials=/home/jimmy/.smbcredentials,uid=jimmy,gid=jimmy 0 0
After the RPi boots up I can check with dmesg and see this:

Code: Select all

>$ dmesg |grep mount
[    2.537940] EXT4-fs (mmcblk0p6): mounted filesystem with ordered data mode. Opts: (null)
[    2.574310] devtmpfs: mounted
[   12.836702] EXT4-fs (mmcblk0p6): re-mounted. Opts: (null)
[   13.365372] EXT4-fs (mmcblk0p6): re-mounted. Opts: (null)
[   21.264140] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
[   28.410045] CIFS VFS: cifs_mount failed w/return code = -101
[   50.009962] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: (null)
Yet if I follow that command with:

Code: Select all

>$ df -h
Filesystem                     Size  Used Avail Use% Mounted on
rootfs                         5.6G  2.9G  2.4G  55% /
/dev/root                      5.6G  2.9G  2.4G  55% /
devtmpfs                       182M     0  182M   0% /dev
tmpfs                           38M  332K   37M   1% /run
tmpfs                          5.0M     0  5.0M   0% /run/lock
tmpfs                           75M     0   75M   0% /run/shm
/dev/mmcblk0p5                  60M   19M   41M  32% /boot
/dev/sda1                       29G  3.5G   24G  13% /home/jimmy/Desktop/usbdrv
/dev/mmcblk0p3                  27M  397K   25M   2% /media/SETTINGS
//192.168.0.98/NetworkFolder  1.8T  302G  1.4T  19% /home/jimmy/network-folder
It is indeed mounted and works fine. So the mount appears to have failed during the initial boot process, but by the time I can enter a "df-h" command, SSH into the RPi, or use the Desktop file manager to have a look the share is mounted and everything is present. So something else happened after the initial mount attempt failed, but I don't have a clue what it was, there is nothing in the fstab line nor have I added any boot delays anywhere.

gooner47
Posts: 10
Joined: Wed May 15, 2013 11:37 pm

Re: Can't get a CIFS network drive to mount on boot

Fri Aug 14, 2015 5:41 pm

Thanks for the info. Not sure it helps me unfortunately. Anyone have any other suggestions?

User avatar
KLL
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: Can't get a CIFS network drive to mount on boot

Sat Aug 15, 2015 3:46 am

same, actually if it is a timing problem the ",_netdev" should fix it, but not, so i added a
sudo mount -a
into .bash_aliases
p.s. here it is a samba share of a subdirectory of a other RPI's SD ( /home/pi/Desktop/share/ )
so it can not be about drives not ready...

rubikwizard
Posts: 95
Joined: Tue Jan 10, 2012 10:37 pm
Location: West Yorkshire
Contact: Website

Re: Can't get a CIFS network drive to mount on boot

Sat Aug 15, 2015 9:54 am


gooner47
Posts: 10
Joined: Wed May 15, 2013 11:37 pm

Re: Can't get a CIFS network drive to mount on boot

Tue Aug 25, 2015 8:01 pm

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/qu ... nt-on-boot

Thanks again for all your help.

Return to “Beginners”