Skip to content

Prevent Ubuntu to mount offline NFS mounts at startup

October 21st, 2023 Ubuntu Network cables and switches

To prevent NFS mounts from attempting to mount while your system is offline and disable retry attempts in Ubuntu, you can use the noauto option in conjunction with the retry=0 option in your /etc/fstab file. Here's how to do it:

  1. Open a terminal window.

  2. Edit the /etc/fstab file using your preferred text editor. You may need superuser privileges, so use sudo:
    sudo nano /etc/fstab .

  3. Locate the line for the NFS mount you want to modify. It will look something like this:
    server:/export /mnt/nfs nfs defaults 0 0

  4. Add the noauto and retry=0 options to the list of options. The modified line will look like this:
    server:/export /mnt/nfs nfs noauto,retry=0 0 0

  5. Save the file and exit the text editor.

After making this change, the NFS share will not be automatically mounted at boot, and it will not attempt to retry if the server is offline. You can manually mount it when needed using the mount command or by accessing the directory. For example:
sudo mount /mnt/nfs

Photo by Jordan Harrison

About Marcel Bootsman

Marcel discovered the web in 1995. Since then he has paid attention to and worked with lots of technologies and founded his own WordPress oriented business nostromo.nl in 2009.

Currently Marcel is Business Development Manager Dutch & DACH Markets at Kinsta where he helps Kinsta's client base grow with Managed WordPress, Application, Database and Static site hosting.

You can contact Marcel on a diverse range of online platforms. Please see the Connect section on the homepage for the details.