In this article we will take a look on how to connect a network folder from Windows Server as a datastore on the VMware ESXi host and use it to store files of your virtual machines (VMs) or ISO images. VMWare ESXi cannot work directly with Windows shares (over SMB protocol), so we have to use it in another way to mount windows folder esxi configuration, allowing you to have an additional VMFS datastore along with your existing VMFS datastore.
What is VMware ESXi?
Unlike other hypervisor solutions from VMware, such as VMware Workstation, VMware ESXi is the enterprise type-1 hypervisor that allows running enterprise workloads in the data center. It is fully featured, providing many robust capabilities for organizations looking at self-hosting critical services.
It also includes many storage-related command line tools such as VMFS tools allowing VI admins to work with storage without having to install VMFS tools as an add-on, since it is natively included.
VMware ESXi storage types
ESXi host can use 2 types of storage as a VMFS datastore:
- Local disk or LUN from an external storage device connected over Fibre Channel or iSCSI
- Network File System (NFS) — network protocol for remote access to file systems, commonly used in Unix/Linux environment
- These are formatted with the VMware VMFS file system and VMFS partitions
Microsoft NFS storage services
Firstly, Microsoft implemented basic NFS server functionality in Windows Server 2003 R2, which is still present in the latest version — Windows Server 2022.
Tip. NFS directory usage as a storage for VMWare VM’s files should be considered only for the test or non-critical production environment.
Configuring Microsoft NFS storage services
So, at first we first need to configure NFS share in Windows Server and then connect it as a datastore on ESXi host which will house the VMFS partition. We already have a Windows machine configured with the File and Storage Services role. To install NFS Server feature:
- Open Server Manager console and select Manage > Add Roles and Features.
- On the Server Roles tabs expand section File and Storage Services > File and iSCSI Services.
- Tick the item Server for NFS.
- After installation is finished, click on “Close”.
Tip. You can install Server for NFS Features even easier with a single Powershell command:Add-WindowsFeature "FS-NFS-Service"
Next you need to create a new Windows directory that will be used as an NFS mount point for the VMFS volume. In this example we created folder c:\nfs , and it is not the best practice :).
Note. Check our VMware Distributed Switch ultimate guide.
Switch to the Server Manager console and go to File and Storage Services > Shares. Run New Share Wizard (Tasks > New Share) and then select NFS Share-Quick.
Specify share path and desired name. In this example we are using share name nfs. In this case, full NSF path (Remote path to share), that can be used on Unix environment looks like this: srv_fs01:/nfs
On authentication method page disable Kerberos authentication methods and select only “No Server authentication” and “Enable unmapped user access”.
To configure Windows share permissions enter your ESXi host FQDN name / IP address, select Read/Write permissions and tick Allow root access for NFS sharing.
Tip. Also you can restrict access to NFS service using Windows Firewall by denying access except the required IP address or subnet.
You can create an NFS share and restrict access to it via PowerShell (not command prompt window):
New-NfsShare -Name "NFS " -Path "c:\nfs" -AllowRootAccess $true -Permission Readwrite -Authentication sys Grant-NfsSharePermission -Name “NFS” -ClientName 192.168.1.111 -ClientType host -LanguageEncoding ANSI
So we have created a new network NFS share on Windows Server 2012 R2. It remains to connect it as a datastore to VMWare host.
Tip. Make sure that vmkernel port is configured on your ESXi server.
- Login to your vSphere server / ESXi host and select your host. From Action menu select Storage > New > Datastore on your existing or new VMware ESXi host.
- Select NFS as a datastore type.
- Select NFS 4.1 (supported on Windows Server starting from Server 2012).
- Give your Datastore a name (WindowsNFS), enter NFS Folder (/nfs) and NFS server name (IP address or DNS name).
After successfull adding the NFS datastore, it appears in the list of available host datastores. You can use this datastore (yet empty) to place the VM files or store operating systems ISO images.
In case you run into issues while mounting a Windows folder in VMware ESXi using NFS shares, here are some helpful troubleshooting tips to get you back on track:
- Verify NFS Share Configuration: Double-check your NFS share configuration on the Windows Server, ensuring the correct path, permissions, and authentication settings have been applied. Remember to grant Read/Write permissions and allow root access for your ESXi host.
- Check Network Connectivity: Ensure your ESXi host and Windows Server are on the same network and can communicate with each other. Use ping and tracert to test the connection between the two systems.
- Examine Firewall Settings: Inspect the firewall settings on both the Windows Server and ESXi host. Ensure that the necessary ports are open and that the appropriate IP addresses or subnets have access to the NFS service.
- Review ESXi Host Logs: If you encounter issues while connecting the Windows share to the ESXi host, check the host’s logs for any errors or warnings that might provide insight into the problem.
- Restart NFS Services: If the NFS share is not accessible from the ESXi host, try restarting the NFS services on the Windows Server.
VMware vSphere Compatibility
When implementing the steps provided in this guide, it’s essential to consider compatibility between different versions of VMware ESXi and Windows Server. The following information can help you determine whether the process is compatible with your setup:
- VMware ESXi Versions: The steps outlined in this guide should work with VMware ESXi 6.x and later versions. However, consulting the official VMware documentation for any version-specific nuances or changes is always a good idea.
- Windows Server Versions: Microsoft introduced NFS server functionality in Windows Server 2003 R2. This feature is present in subsequent versions, including Windows Server 2012 R2, 2016, 2019, and 2022. Configuring NFS shares and permissions may vary slightly between versions, so consult the appropriate documentation for your specific Windows Server version.
- NFS Versions: This guide uses NFS 4.1, supported on Windows Server 2012 and later versions. If you use an earlier version of Windows Server, you may need to use NFS 3.0 instead. Note that this may impact compatibility with your ESXi host.
- VMFS Versions: The VMFS partition format is compatible with all ESXi versions. However, ensure you use a VMFS version supported by your specific ESXi host.
Note. Learn how to share a disk between VMs on VMWare.
Windows NFS and VMware ESXi FAQs
No, VMware ESXi cannot work directly with Windows shares over SMB protocol. You’ll need to use an alternative method, such as mounting a Windows folder in the ESXi configuration, to create an additional VMFS datastore.
2. What storage types can ESXi use as a VMFS datastore?
ESXi can use two types of storage as a VMFS datastore: a local disk or LUN from an external storage device connected over Fibre Channel or iSCSI, and Network File System (NFS) – a network protocol for remote access to file systems, commonly used in Unix/Linux environments. These are formatted with the VMware VMFS file system and VMFS partitions.
3. Can NFS directory be used as storage for VMware VM’s files in a production environment?
It is recommended to use NFS directory as storage for VMware VM’s files only for test or non-critical production environments.
4. How can I install the Server for NFS feature in Windows Server?
You can install the Server for NFS feature using the Server Manager console or with a single PowerShell command: Add-WindowsFeature “FS-NFS-Service”.
5. Can I restrict access to the NFS service using Windows Firewall?
You can restrict access to the NFS service using Windows Firewall by denying access, except for the required IP address or subnet.
After creating a new network NFS share on your Windows Server, log in to your vSphere server or ESXi host, and select your host. From the Action menu, select Storage > New > Datastore. Choose NFS as the datastore type, NFS 4.1 as the version, and enter the Datastore name, NFS folder, and NFS server name. Once the NFS datastore is added successfully, it will appear in the list of available host datastores.
In this post, we have considered mounting a VMware NFS datastore backed by an NFS share running in Windows Server. The File services can be easily added to Windows Server and used for providing additional storage for ESXi server. This may provide administrators with interesting options for storage in certain edge or corner use cases or even lab environments. As mentioned, it is not recommended for production environments.