Remounting a disconnected NFS datastore from the ESXi command line
search cancel

Remounting a disconnected NFS datastore from the ESXi command line

book

Article ID: 344470

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:

You cannot unmount an NFS datastore because:

  • The NFS datastore has running or registered objects
  • The NFS share has been disconnected from the host
  • NFS datastore cannot be mounted but is also unavailable in the list to unmount

 

  • After a power outage, NFS datastore is listed as "accessible: false" and "mounted: false" on a host under esxcli storage nfs list. VMs are reported inaccessible. Other hosts have access to the NFS share.
     

In the vSphere Client, you see an error:

Unmount Filesystem Busy



Environment

VMware vSphere ESXi 7.0.x
VMware vSphere ESXi 8.0.x

Cause

This issue can occur if the NFS server is removed without removing the NFS datastore. Re-adding the NFS server does not refresh the datastore mount.

Resolution

To resolve this issue, remove and re-add the datastore via the command line.
 

Caution: Before performing any steps in this resolution, ensure that there are no objects registered on the NFS you are trying to unmount. For more information, see: 

ESXi 7.x and later

NFS 3

To remove a datastore:
  1. To list the mounted datastores on the host:

    # esxcli storage nfs list
     
  2. Make a note of the NFS datastore from step 1. Run this command to delete the NFS mount:

    # esxcli storage nfs remove -v <NFS_Datastore_Name>

    NOTE This operation does not delete the information on the share, it unmounts the share from the host. If the NFS datastore is being used by either a virtual machine or a third party script, you may see this error:

    Error performing operation: NFS Error: Unable to Unmount filesystem: Busy.

           If you see this error, refer to the Caution section above

       Note:  After validation, if no active VM or data  and step 2 command not working then please use following command to remove datastore 

        esxcfg-nas -d <NFS_Datastore_Name>

      

To add the datastore:

Run this command to mount the NFS datastore:

# esxcli storage nfs add -H <NFS_SERVER_ADDRESS> -s Share_mount_point_on_the_NFS -v DatastoreName

example:

# esxcli storage nfs add -H ###.###.###.### -s /exports/esx_nfs_vol_1 -v NFS_1

NOTE NFS server host names and mount points are case-sensitive. Be sure to consistently use the same case across different hosts that mount the same datastore.

NFS 4.1

To remove a datastore:
  1. To list the mounted datastores on the host:

    # esxcli storage nfs41 list
     
  2. Make a note of the NFS datastore from step 1. Run this command to delete the NFS mount:

    # esxcli storage nfs41 remove -v <NFS_Datastore_Name>

    NOTE This operation does not delete the information on the share, it unmounts the share from the host. If the NFS datastore is being used by either a virtual machine or a third party script, you may see this error:

    Error performing operation: NFS Error: Unable to Unmount filesystem: Busy.

           If you see this error, refer to the Caution section above

       Note:  After validation, if no active VM or data  and step 2 command not working then please use following command to remove datastore 

        esxcfg-nas -d <NFS_Datastore_Name>

      

To add the datastore:

Run this command to mount the NFS datastore:

# esxcli storage nfs41 add -H <NFS_SERVER_ADDRESS> -s Share_mount_point_on_the_NFS -v DatastoreName

example:

# esxcli storage nfs41 add -H ###.###.###.### -s /exports/esx_nfs_vol_1 -v NFS_1

 

Additional Information