How to Boot FreeBSD Normally When a Mounted Drive Goes Offline

When a drive you have mounted in FreeBSD goes offline unexpectedly, the OS will refuse to boot until you edit fstab and tell it to stop looking for the non-existent drive. Unfortunately, it’s not clear how to do this if you’re somewhat new to FreeBSD or have never had to deal with this before. If that describes you, here’s how you get past it and get on to more important things. 

In my case, I was running pfSense on FreeBSD, running a Squid proxy server plugin that used a separate drive for its cache. When that drive suddenly died, I was unable to get FreeBSD/pfSense/Squid to boot since it was complaining about not being able to mount the drive.

While everyone knows that you need to edit /etc/fstab to comment out (or otherwise modify) the line referencing the bad drive, the stripped-down console you get in this situation gives you basically no useful info/suggestions for how to actually do this. More frustratingly, you may notice that you can see the contents of fstab by doing a “more” or “cat” on it, but when you try opening it in vi/vim, you just see a blank screen.

To get access to it, do the following:

  1. Enter single-user mode.
  2. Update the file system’s mount options by typing: mount -u /
  3. Mount ufs file systems by typing: mount -t ufs
  4. Now you can edit it with: vi /etc/fstab
    (If you’re rusty on how to use vi, here‘s a good reference.)

You should now be able to reboot normally and make further changes to fstab, etc. the usual way you did before the drive failure.

Steve