JoeZhao

跨出界

Hey, I’m JoeZhao, a software engineer, and a gamer.

Resolve the issue of Unraid being unable to unmount NFS after shutdown.

Let's talk about the scenario first:

  1. The host is installed with unraid 6.9.2.
  2. A virtual machine running Synology DSM is set up, with a network interface and two hard drives passed through.
  3. Unraid mounts the hard drives of Synology DSM using the NFS protocol through Unassigned Devices.

Problem:
When trying to replace the hard drives, directly clicking on "Stop Array" didn't stop successfully even after waiting for a long time.
Upon checking the system logs, it was found that it was stuck at "Unmounting Remote SMB/NFS Share" and continuously retrying without success.

The cause of this problem is that Synology DSM is also running on unraid. When stopping the array, the operation will prioritize shutting down Docker and the virtual machine services, causing the NFS connection to become unresponsive and unable to unmount properly.

After searching, it was found that many people have encountered similar issues: when the NFS server loses network connection for some reason, the NFS client cannot unmount until the latest nfsv4. This causes the process to get stuck in retry.

There are two solutions:

  1. Switch to SAMBA. SMB cannot be unmounted, but it won't affect the shutdown and won't cause a freeze.
  2. Before shutting down, manually unmount all NFS mounts that have been mounted in Unassigned Devices, or you can open a terminal and run umount -l /mnt/remotes/* to forcefully unmount all NFS mounts.

The remaining problem is how to automate solution 2, so it doesn't require manual execution every time. In the unraid forums, a solution was found:

  1. Go to the Main interface, find the "SMB Shares | NFS Shares | ISO File Shares" row, and click on the settings button for the NFS service, as shown in the image:
    main

  2. Click on "Default" and in the Script that appears, find UNMOUNT ACTION and add a new line with umount -l /mnt/remotes/* at the # do your stuff here location, as shown in the image:
    setting

PS: If you only want to unmount a specific disk, you need to set it separately (repeat step 2) and enter the specific drive letter, such as umount -l /mnt/remotes/Meida_4.

  1. Click Save.

Testing:

  1. Mount the NFS service in Unassigned Devices.
  2. Shut down or disconnect the NFS server.
  3. Click on UNMOUNT in Unassigned Devices (If it can be unmounted properly, then there is no problem).

--EOF--

Reference articles:

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.