Link to home
Create AccountLog in
Avatar of hdharkar
hdharkar

asked on

How to make sure a Windows share (smbfs) is mounted only when there is a network connectivity present

I have mounted a Windows share in the fstab entry of RHEL AS 3.0. The entry looks like this
//jabber/EXP    /mnt/jabber/EXP smbfs auto,owner,username=jabber\abcd, password=xxx, uid=501 0 0

But the problem is whenever this Windows machine/drive  is down or not available the Linux OS keeps searching for this mount point and the linux machine sometimes hangs. I want to know if there is a way that I can modify the entry or add some script where it will only search for the mount point if there is a network connectivity present between the Linux box and the Windows box.

Thank you
Harsh
Avatar of ahoffmann
ahoffmann
Flag of Germany image

use automounter (autofs) instead
man automount
man autofs
Avatar of hdharkar
hdharkar

ASKER

Thanks for the clue. Can you please help me further with the map file. I took the above entry out of the fstab file.
In the /etc/auto.master file I added this line.  I created the jabber directory under mnt and also the EXP directory under jabber. Given below is my auto.master file and my map file is auto.vol

 $Id: auto.master,v 1.2 1997/10/06 21:52:03 hpa Exp $
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(8).
# /misc /etc/auto.misc  --timeout=60
  /mnt/jabber  /etc/auto.vol  --timeout=240

My auto.vol file looks like this but I believe there is something wrong in this file. I am also not sure where do I enter the username and the password to be taken automatically in this map file.


# $Id: auto.misc,v 1.2 1997/10/06 21:52:04 hpa Exp $
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage
 
# the following entries are samples to pique your imagination

#removable   -fstype=ext2            :/dev/hdd
jabber/EXP    -fstype=auto            ://jabber/EXP

When I run /etc/init.d/autofs status it also gives me the Active mount point as
/usr/sbin/automount  --timeout 240 /mnt/jabber file /etc/auto.vol

But when I do a df -k it does not still show the mount points.  I appreciate your help.
Thanks
Harsh
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmann
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
You are the Man!!!
Thanks a ton! Its working perfectly fine now.
I had to make sure the path name in the /etc/auto.master file was pointing to the right mount point. Its an excellent solution