Create an NFS 4.1 Datastore

You can create an NFS 4.1 datastore with Kerberos authentication and multipathing.

Prerequisites

  • Verify that you are connected to a vCenter Server system.

  • Verify that the remote NFS share supports multipathing and Kerberos authentication.

Procedure

  1. Get the virtual machine host where you want to create the NFS 4.1 datastore.
    $vmhost = Get-VMHost 'hostname'
  2. Set NTP servers for the virtual machine host.
    Add-VMHostNtpServer -VMHost $vmhost -NtpServer 'ntp_server_ip'
  3. Set a DNS server and search the domain for the virtual machine host.
    $vmhostnetwork = Get-VMHostNetwork -VMHost $vmhost
    Set-VMHostNetwork -Network $vmhostnetwork -DnsFromDhcp $false -DnsAddress 'dns_server_ip' -DomainName 'domain_name' -SearchDomain 'search_domain'
    
  4. Add the virtual machine to the Active Directory domain.
    $vmhost | Get-VMHostAuthentication | Set-VMHostAuthentication -JoinDomain -Domain 'AD_domain_name' -Username 'AD_user_name' -Password 'AD_password'
  5. Create an NFS user on the virtual machine host for Kerberos-based authentication for the NFS 4.1 datastore.
    New-NfsUser -VMHost $vmhost -Username 'NFS_user_name' -Password 'password'
  6. Create an NFS 4.1 datastore with Kerberos authentication and multipathing.
    New-Datastore -Name 'NFS_datastore_name' -Nfs -FileSystemVersion '4.1' -VMHost $vmhost -NfsHost @('remote_host_1_ip', 'remote_host_2_ip') -Path 'NFS_datastore_remote_path' –Kerberos
  7. (Optional) Retrieve the datastore.
    $ds = Get-Datastore 'NFS_datastore_name'
  8. (Optional) Remove the datastore.
    Remove-Datastore $ds -VMHost $vmhost
  9. (Optional) Get the NFS user from the virtual machine host.
    $user = Get-NfsUser -VMHost $vmhost
  10. (Optional) Update the password of the NFS user.
    $user = Set-NfsUser -NfsUser $user -Password 'new_password'
  11. (Optional) Remove the NFS user.
    Remove-NfsUser -NfsUser $user