How to Mount NFS Automatically After Boot-Time?

Erik Norgaard norgaard at locolomo.org
Tue Oct 11 01:50:16 PDT 2005


David Marshall wrote:
> We have several servers that mount from an NFS server for a lot of
> reading and writing.  We typically have this mount listed in
> /etc/fstab.
> 
> If one of these servers reboots when the NFS server is offline, it
> hangs in single-user mode until the NFS server comes back online.
> 
> We have tried usiing amd(8), but the sorts of traffic we have been
> generating has been just a little too much for amd to handle. 
> Occasionally it will become overwhelmed and will not work properly
> until it (amd) is restarted.  So, it is back to a straight NFS mount.
> 
> How can we cause this NFS mount to be made after the system has
> reached multi-user so that we can log in and perhaps mount from
> another server?  (The servers are in a colo, so it's not easy to gain
> physical access to the console to operate the machine in single-user.)
> 
> I've played with putting a mount command into /etc/rc.local, but I
> don't know whether that would make us equally susceptible to a server
> outage.

If you look in /etc/rc.d/ there are two scripts: mountcritlocal and 
mountcritremote - the last one mounts nfs mounts if present in fstab.

In the beginning of the file you will find the lines:

# PROVIDE: mountcritremote
# REQUIRE: NETWORKING root mountcritlocal cleanvar
# KEYWORD: nojail

These are comments for /bin/sh but the affect the order of execution. 
The scripts in /etc/rc.d are executed in the order sorted by 
/sbin/rcorder(8)

So, you can postpone the nfs mounts till later by changing the REQUIRE 
line. Note that some scripts may have "mountcritremote" in their REQUIRE 
line.

Hope this helps,

Erik
-- 
Ph: +34.666334818                                  web: www.locolomo.org
S/MIME Certificate: www.daemonsecurity.com/ca/8D03551FFCE04F06.crt
Subject ID:  9E:AA:18:E6:94:7A:91:44:0A:E4:DD:87:73:7F:4E:82:E7:08:9C:72
Fingerprint: 5B:D5:1E:3E:47:E7:EC:1C:4C:C8:3A:19:CC:AE:14:F5:DF:18:0F:B9


More information about the freebsd-questions mailing list