Let's talk about the scenario first:
- The host is installed with unraid 6.9.2.
- A virtual machine running Synology DSM is set up, with a network interface and two hard drives passed through.
- 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:
- Switch to SAMBA. SMB cannot be unmounted, but it won't affect the shutdown and won't cause a freeze.
- 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:
-
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:
-
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:
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
.
- Click Save.
Testing:
- Mount the NFS service in Unassigned Devices.
- Shut down or disconnect the NFS server.
- Click on UNMOUNT in Unassigned Devices (If it can be unmounted properly, then there is no problem).
--EOF--
Reference articles: