NFS for an unreliable server

While I was away in the US (naturally), my house suffered a long powercut. So long that crimson forgot its electronic serial number again.The backup plan swung into action, requiring my loving family to boot the reserve server, chrome.

As usual, the backup plan was not trouble free. Apache did not start up. I think this was because the resolv.conf file still pointed at crimson at the time apache started. It wasn't until a later, local script detected that crimson was not up that the resolv.conf was munged to point at localhost. The only clue to this was the message Alarm clock on the dmesg output. However, as I could ssh to chrome, I could start Apache manually.

Once back home, I decided to fix this problem by always using chrome's DNS, that is by putting 127.0.0.1 as the first entry in resolv.conf. However, I discovered this change had a bad effect on the mounting of NFS volumes at boot time. Since the DNS service was not up by the time the filesystems were mounted, as defined in fstab, the NFS mount of the home directory on crimson failed, with the following message printed every 60 seconds on the console until Control-C was hit.

  [udp] crimson - RPCPROG_MNT RPC: Port mapper failure - RPC : Timed out

If fact, I was puzzled as to how chrome had managed to get itself fully booted when brought up with crimson down. When I had tested chrome's ability to boot in the absence of crimson, I'd done it by unplugging the ethernet cable. The NFS mount had aborted with:

  mount_nfs: crimson: hostname nor servname provided, or not known

Obviously, this was not a good test; FreeBSD behaved differently if there was no network connection as opposed to no server. Despite trying to re-create the conditions of the original problem, I could not get chrome to boot fully without manual intervention (Control-Cing the NFS mount on the console). I am baffled as to how it booted when I was in the US.

I considered not bothering with the NFS mount, as I didn't make much use of it on chrome. Ignoring such defeatist thinking, I decided to use the -b (background) flag, but in conjunction with the new 'late filesystem' feature of FreeBSD 6.2. By marking a filesystem as late in the fstab file, it would not be mounted until after local applications (including named). By also putting in a retry count of one, I would be able to boot whether or not crimson was up.

The NFS mount line in the fstab file now looks as follows:

  crimson:/home/stuff /mnt/crimson nfs rw,-b,-R1,late 0 0