LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-26-2012, 05:20 PM   #1
ceh383
Member
 
Registered: May 2003
Location: The Left coast, USA
Distribution: Slack_64 14.2
Posts: 226

Rep: Reputation: 29
Delay mount


I added 2 lines to my fstab file on my laptop, these are the same that I use on my desktop.
They work perfectly on the desktop, but on the laptop they don't.
I believe fstab runs before the wireless is up and running.
I've looked, and can not find an answer to this.
Is there a way to have a delayed automatic mount?
 
Old 05-26-2012, 05:30 PM   #2
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 528

Rep: Reputation: 273Reputation: 273Reputation: 273
Use rc.local instead of auto

If you are mounting a partition not needed initially, the post below suggests removing the fstab entry and mounting it in rc.local after a delay.

http://www.linuxquestions.org/questi...unting-908699/

This may not apply in your situation.

If you post your fstab others may be able to help.
 
Old 05-26-2012, 05:52 PM   #3
ceh383
Member
 
Registered: May 2003
Location: The Left coast, USA
Distribution: Slack_64 14.2
Posts: 226

Original Poster
Rep: Reputation: 29
Ok, here's the fstab file...
Code:
/dev/sdb1        swap             swap        defaults         0   0
/dev/sdb3        /                ext4        defaults         1   1
/dev/sdb2        /boot            ext4        defaults         1   2
/dev/sdb5        /var             ext4        defaults         1   2
/dev/sdb6        /usr             ext4        defaults         1   2
/dev/sdb7        /home            ext4        defaults         1   2
/dev/sda2        /win-restore     ntfs-3g     fmask=133,dmask=022 1   0
/dev/sda3        /win7            ntfs-3g     fmask=133,dmask=022 1   0
#/dev/cdrom      /mnt/cdrom       auto        noauto,owner,ro  0   0
/dev/fd0         /mnt/floppy      auto        noauto,owner     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
//192.168.83.240/movies  /home/chuck/Videos cifs    auto,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/unlock       0 0
//192.168.83.240/music  /home/chuck/Music   cifs    auto,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/unlock       0 0
It's the last two lines that I'm interested in....
 
Old 05-26-2012, 05:59 PM   #4
ysg
LQ Newbie
 
Registered: Nov 2007
Distribution: Slackware 13.37 (64-bit on desktop, 32-bit on netbook)
Posts: 17

Rep: Reputation: 0
You need to add '_netdev' to your cifs options. This will tell your system to not try to mount this until your network is working.

Like so:
Code:
//192.168.83.240/movies  /home/chuck/Videos cifs    auto,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/unlock,_netdev       0 0
//192.168.83.240/music  /home/chuck/Music   cifs    auto,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/unlock,_netdev       0 0
 
Old 05-26-2012, 06:25 PM   #5
ceh383
Member
 
Registered: May 2003
Location: The Left coast, USA
Distribution: Slack_64 14.2
Posts: 226

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by Tracy Tiger View Post
If you are mounting a partition not needed initially, the post below suggests removing the fstab entry and mounting it in rc.local after a delay.

http://www.linuxquestions.org/questi...unting-908699/

This may not apply in your situation.

If you post your fstab others may be able to help.
I looked at the link you provided, and added mount -a (don't know how else to do it) to rc.local
didn't work. I think rc.local is run before the wireless is up.

Quote:
Originally Posted by ysg View Post
You need to add '_netdev' to your cifs options. This will tell your system to not try to mount this until your network is working.

Like so:
Code:
//192.168.83.240/movies  /home/chuck/Videos cifs    auto,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/unlock,_netdev       0 0
//192.168.83.240/music  /home/chuck/Music   cifs    auto,gid=users,file_mode=0664,dir_mode=0775,iocharset=iso8859-15,credentials=/etc/unlock,_netdev       0 0
Tried this also, no joy...

After login and wireless is up I can run "mount -a" as su and it does work.
 
Old 05-26-2012, 07:09 PM   #6
Kowal
LQ Newbie
 
Registered: May 2012
Posts: 3

Rep: Reputation: Disabled
I am not expert in Slack but what about services needed for mounting NFS? Like portmap?

Is this nfs v4 or nfs v3
 
Old 05-26-2012, 07:45 PM   #7
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
You could also use autofs to mount those shares on demand.
 
Old 05-26-2012, 07:50 PM   #8
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
Quote:
Originally Posted by Kowal View Post
I am not expert in Slack but what about services needed for mounting NFS? Like portmap?

Is this nfs v4 or nfs v3
The OP is using CIFS not NFS however the Slackware boot scripts treat all network file systems the same.

in rc.S
Code:
/sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts
in rc.M (right after rc.inet2 executes but before wicd/networkmanager/bluetouth)
Code:
mount -a -v 2> /dev/null | grep -v "already mounted"
If it's not working if you do this in rc.local then it's likely that the network is coming up in the background and is not blocking the scripts while it comes up.
 
Old 05-26-2012, 08:01 PM   #9
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
You could also do it from the desktop's autostart with a script that has a while loop until a successful ping to 192.168.83.240 then mount the volumes
 
Old 05-26-2012, 08:07 PM   #10
TracyTiger
Member
 
Registered: Apr 2011
Location: California, USA
Distribution: Slackware
Posts: 528

Rep: Reputation: 273Reputation: 273Reputation: 273
Quote:
Originally Posted by ceh383 View Post
I looked at the link you provided, and added mount -a (don't know how else to do it) to rc.local
didn't work. I think rc.local is run before the wireless is up.
After login and wireless is up I can run "mount -a" as su and it does work.
A few more thoughts ...

At a minimum in rc.local you should wait before running the mount command (sleep 120; mount ... ). This is crude but if you figure out how long it takes for the wireless to connect then you could wait say 150% of that time then mount each network drive. Make it a long time (5 minutes) to test the concept first.

Better would be to test that the network connection (ping,dig,etc) or any other needed services are operational. Write a simple script to do this in rc.local or run the script from rc.local. After the test is successful then mount the drives individually. See the man pages for mount to learn how to translate the fstab entry to a mount command or just reference the fstab entry with the mount command. (i.e. mount /usr/share/myphotos).

Any script you write can be incorporated elsewhere in the /etc/rc.d cascade other than rc.local if it would work better.

Make sure that files in separately mounted partitions don't reference each other - circular reference. That's always fun on cross mounted servers that have been in production for a long time with lots of changes and no reboots. :-) Probably not your problem however.

The netdev cifs option sounded best. I've never used it. Perhaps it needs to be installed/configured before it will work? Comments on this ysg?

EDIT: I'm a slow typist. Some of this was already mentioned.

Last edited by TracyTiger; 05-26-2012 at 08:13 PM. Reason: Slow Typist
 
Old 05-27-2012, 05:21 AM   #11
vdemuth
Member
 
Registered: Oct 2003
Location: West Midlands, UK
Distribution: Slackware 14 (Server),OpenSuse 13.2 (Laptop & Desktop),, OpenSuse 13.2 on the wifes lappy
Posts: 781

Rep: Reputation: 98
Quote:
Originally Posted by Richard Cranium View Post
You could also use autofs to mount those shares on demand.
+1 for that
 
Old 05-27-2012, 09:13 AM   #12
ceh383
Member
 
Registered: May 2003
Location: The Left coast, USA
Distribution: Slack_64 14.2
Posts: 226

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by wildwizard View Post
in rc.S
Code:
/sbin/mount -a -v -t nonfs,nosmbfs,nocifs,noproc,nosysfs,nodevpts
in rc.M (right after rc.inet2 executes but before wicd/networkmanager/bluetouth)
Code:
mount -a -v 2> /dev/null | grep -v "already mounted"
If it's not working if you do this in rc.local then it's likely that the network is coming up in the background and is not blocking the scripts while it comes up.
This seems to be the case.

Quote:
Originally Posted by Tracy Tiger
At a minimum in rc.local you should wait before running the mount command (sleep 120; mount ... )
This does work, however, it creates a delay in boot-up equal to the sleep time given.

Quote:
Originally Posted by Babertje
You could also do it from the desktop's autostart with a script that has a while loop until a successful ping to 192.168.83.240 then mount the volumes
I have no idea how I would go about this one, but, it does sound interesting.

Quote:
Originally Posted by Richard Cranium
You could also use autofs to mount those shares on demand.
This also sounds interesting, I'll look into it...

Thanks all, for the suggestions.
 
Old 05-27-2012, 09:19 AM   #13
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,371

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
How are you starting your wireless networking? If you use wicd, then you could mount the shares in a postconnect script.
 
Old 05-27-2012, 06:23 PM   #14
Babertje
Member
 
Registered: Jun 2009
Location: Haarlem, The Netherlands
Distribution: Archlinux
Posts: 125

Rep: Reputation: 20
Quote:
it creates a delay in boot-up equal to the sleep time given.
To avoid rc.local from stalling, make a script that calls your network stuff like /etc/mymounter.sh
and call this script from /etc/rc.local this
Code:
/etc/mymounter.sh &
mymounter.sh will be running in the background but your rc.local end minus any delay

Example script to be called from /etc/rc.local as above; /etc/nettester.sh &
Code:
#!/bin/bash
# nettester.sh: test runs in loop to MAX = number of TRIES 
#               or until network responds successfully

NETWORK=0
COUNTER=0

# wait till next loop
SECONDS=2

#stop testing after N times
TRIES=100
# your most faithfull url to hit success all the time 
URL=http://www.google.com

until [  $COUNTER -eq "$TRIES" ] 
do
      let COUNTER=COUNTER+1
      GETURL=`curl -vs -o /dev/null $URL 2>&1 |grep -c connected`
      if [ $GETURL -eq 1 ]
	then
	    NETWORK=1
	    if [ $NETWORK -eq 1 ]
	      then
		COUNTER=$TRIES
	      else
		NETWORK=0
	    fi
	else
	    sleep $SECONDS
      fi
done

if [ $NETWORK -eq 1 ]
    then
	  # do your mount stuff here
    else
          exit 1 # -bailing, had to many tries
fi

Last edited by Babertje; 05-27-2012 at 06:40 PM.
 
Old 05-28-2012, 09:08 AM   #15
ceh383
Member
 
Registered: May 2003
Location: The Left coast, USA
Distribution: Slack_64 14.2
Posts: 226

Original Poster
Rep: Reputation: 29
Quote:
Originally Posted by Babertje View Post
To avoid rc.local from stalling, make a script that calls your network stuff like /etc/mymounter.sh
and call this script from /etc/rc.local this
Code:
/etc/mymounter.sh &
mymounter.sh will be running in the background but your rc.local end minus any delay

Example script to be called from /etc/rc.local as above; /etc/nettester.sh &
Code:
#!/bin/bash
# nettester.sh: test runs in loop to MAX = number of TRIES 
#               or until network responds successfully

NETWORK=0
COUNTER=0

# wait till next loop
SECONDS=2

#stop testing after N times
TRIES=100
# your most faithfull url to hit success all the time 
URL=http://www.google.com

until [  $COUNTER -eq "$TRIES" ] 
do
      let COUNTER=COUNTER+1
      GETURL=`curl -vs -o /dev/null $URL 2>&1 |grep -c connected`
      if [ $GETURL -eq 1 ]
	then
	    NETWORK=1
	    if [ $NETWORK -eq 1 ]
	      then
		COUNTER=$TRIES
	      else
		NETWORK=0
	    fi
	else
	    sleep $SECONDS
      fi
done

if [ $NETWORK -eq 1 ]
    then
	  # do your mount stuff here
    else
          exit 1 # -bailing, had to many tries
fi
This worked, thank you for it...
 
  


Reply



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
manual mount cifs works but srcipt mount cifs has mount error (13): Permission denied CADIT Linux - Newbie 6 11-20-2009 02:48 PM
Automount smb-share: delay in mount-process t0bias Linux - Networking 1 03-06-2009 04:36 PM
Delay fstab mount of smbfs during boot Iron City Linux - General 7 01-21-2009 02:58 PM
delay on mount -t nfs eduac Linux - Software 0 08-30-2004 12:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 09:18 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
Open Source Consulting | Domain Registration