Mounting a network file system on boot?

  • Follow


I have a Windows ANT share network drive and I can mount it on the
command line, but I want to mount it on boot. The relevant line in my /
etc/fstab is:

//my_url.com/dir1   /home/myusername/ant-share      cifs
auto,user,suid,credential=/home/
myusername/.CIFS.credentials,rw,file_mode=0666,dir_mode=0777
0       2

My ~/.CIFS.credentials file contains:

username=myusername
domain=ant
password=secret


How can I mount it automatically on boot?
0
Reply phil.ganchev (6) 2/15/2012 9:10:11 PM

On Wednesday 15 February 2012 22:10, Philip conveyed the following to 
comp.unix.admin...

> I have a Windows ANT share network drive and I can mount it on the
> command line, but I want to mount it on boot. The relevant line in my
> / etc/fstab is:
> 
> //my_url.com/dir1   /home/myusername/ant-share      cifs
> auto,user,suid,credential=/home/
> myusername/.CIFS.credentials,rw,file_mode=0666,dir_mode=0777
> 0       2
> 
> My ~/.CIFS.credentials file contains:
> 
> username=myusername
> domain=ant
> password=secret
> 
> 
> How can I mount it automatically on boot?

My guess would be that your system is mounting the local filesystems 
before your network is up [*], and as such, the share wouldn't get 
mounted.

You have not told us what UNIX version or GNU/Linux distribution you're 
using, but if you have a traditional System V init system, I would put a 
mount command for it in "/etc/init.d/rc.local".


[*] Which itself comprises of several steps, i.e.:
    - loading the network driver (if this is a GNU/Linux system with
      udev and eventually ifplugd);
    - bringing up the network interface;
    - bringing up the daemons to connect to a Windows network; and
    - mounting the Windows shares.

-- 
= Aragorn =
(registered GNU/Linux user #223157)
0
Reply stryder2 (284) 2/16/2012 7:28:37 AM


Philip wrote:
>
> I have a Windows ANT share network drive and I can mount it on the
> command line, but I want to mount it on boot. The relevant line in my /
> etc/fstab is:
>
> //my_url.com/dir1   /home/myusername/ant-share      cifs
> auto,user,suid,credential=/home/
> myusername/.CIFS.credentials,rw,file_mode=0666,dir_mode=0777
> 0       2
>
> My ~/.CIFS.credentials file contains:
>
> username=myusername
> domain=ant
> password=secret
>
> How can I mount it automatically on boot?

Aragorn guessed order of events at start up.  I have CIFS mounts on
several Red Hat Enterprise 4 and 5 systems that work fine in the default
order with /etc/fstab entries like that.  So I'll offer a different
thing to look at -

Is /home a static mount point on your system or an automount?  If it is
a direct mount then all you need is for it to appear below the /home
entry in /etc/fstab and probably not even that.  If it is an automount
you would need to switch /home to a static mount.  Or /home/myusername
to a static mount.  The reason is static mounts happen before automounts
in the boot sequence so Aragorn's reason applies in a different
variation.

Also check the boot logs (likely /etc/rc.log depending on your system
type) for the exact error message at boot time when it reaches that
point.
0
Reply dfreybur (91) 2/16/2012 8:53:27 PM

On Wed, 15 Feb 2012 13:10:11 -0800 (PST)
Philip <phil.ganchev@gmail.com> wrote:

> I have a Windows ANT share network drive and I can mount it on the
> command line, but I want to mount it on boot. The relevant line in
> my / etc/fstab is:
> 
> //my_url.com/dir1   /home/myusername/ant-share      cifs
> auto,user,suid,credential=/home/
> myusername/.CIFS.credentials,rw,file_mode=0666,dir_mode=0777
> 0       2
> 
> My ~/.CIFS.credentials file contains:
> 
> username=myusername
> domain=ant
> password=secret
> 
> 
> How can I mount it automatically on boot?

No need to do a hard mount when booting - if the share is not available
the system might not boot.

This is what the automounter is for.

-- 
Stefaan
0
Reply hoendech (155) 2/16/2012 10:52:09 PM

On Feb 16, 12:53=A0pm, Doug Freyburger <dfrey...@yahoo.com> wrote:
> Philip wrote:
>
> > I have a Windows ANT share network drive and I can mount it on the
> > command line, but I want to mount it on boot. The relevant line in my /
> > etc/fstab is:
>
> > //my_url.com/dir1 =A0 /home/myusername/ant-share =A0 =A0 =A0cifs
> > auto,user,suid,credential=3D/home/
> > myusername/.CIFS.credentials,rw,file_mode=3D0666,dir_mode=3D0777
> > 0 =A0 =A0 =A0 2
>
> > My ~/.CIFS.credentials file contains:
>
> > username=3Dmyusername
> > domain=3Dant
> > password=3Dsecret
>
> > How can I mount it automatically on boot?
>
> Aragorn guessed order of events at start up. =A0I have CIFS mounts on
> several Red Hat Enterprise 4 and 5 systems that work fine in the default
> order with /etc/fstab entries like that. =A0So I'll offer a different
> thing to look at -
>
> Is /home a static mount point on your system or an automount? =A0If it is
> a direct mount then all you need is for it to appear below the /home
> entry in /etc/fstab and probably not even that. =A0If it is an automount
> you would need to switch /home to a static mount. =A0Or /home/myusername
> to a static mount. =A0The reason is static mounts happen before automount=
s
> in the boot sequence so Aragorn's reason applies in a different
> variation.
>
> Also check the boot logs (likely /etc/rc.log depending on your system
> type) for the exact error message at boot time when it reaches that
> point.

Thank you all.

Aragorn's suggestion works. I added the mount command at the end of /
etc/rc.d/rc.local and the directory is mounted automatically.

The system is a Red Hat Enterprise 4. /home is within the / partition,
and / is listed in /etc/fstab before the CIFS volume.  There is no
file rc.log in /etc or /var. dmesg does not list anything about
mounting, and the other log files do not show anything that seems
relevant to me. Only /var/log/messages lists some Ext3 mounts like:

kernel: EXT3-fs: mounted filesystem with ordered data mode.

but nothing about CIFS.
0
Reply phil.ganchev (6) 2/17/2012 7:52:47 PM

4 Replies
228 Views

(page loaded in 0.393 seconds)

Similiar Articles:













7/20/2012 10:00:07 AM


Reply: