Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using an Ubuntu 12.04 (Server) VM as a development web server. I keep the served files on the VM host, therefore Apache uses NFS mounted directories for DocumentRoot To keep things as automated, I have Apache set to start on boot.

  • I have no problem with automounting NFS at boot.
  • I have no problem with starting Apache at boot.

The problem: mountall starts after upstart fires up Apache.

After fiddle-farting around with upstart and initctl I came up with a hack that works -- but is certainly not ideal -- nor portable.


nfs_server:/    /mnt/nfs_server  nfs4   _netdev,noauto  0   0

The following was inserted at the top beneath the INIT INFO section:

if [ ! -s "/var/www/default/index.php" ]; then
    echo -n "  Mounting NFS and Samba shares...."
    mount nfs_server:/
    if [ 0 -ne $result ]; then
        echo "  ERROR. mount returned $result";
        echo "    [ OK ]";

Otherwise, the script is what was installed originally ( see default file here ).


  1. I've tried using mountall instead of mounting the NFS share by name.
    • This results in other error messages (notably, swapon didn't mount my swap partition)
    • (however) upon final startup, everything seems fine.
  2. This VM will be zipped up and given to other developers. Some may mount using NFS, some may use Samba.
share|improve this question

One way to solve this is to change the order that these things load by modifying the order the init script calls them. There may be other (easier) ways to do this, but the bare metal way would be to -

  1. Find the runlevel the server is running on by issuing the command (as root) "runlevel".
  2. Go to /etc/rcX.d where X is the runlevel number you are in.
  3. You will see a whole lot of symlinks in that directory - they will typically be in the form SxxNAME, where "S" means start, xx is the order - earlier scripts run first - and name is the name of the script this links to in etc/rc.d. Rename the apache script to have a higher number then the nfs script.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.