How to Make a Windows-based NFS Share for XenServer using Windows Server 2008
When working with XenServer, it can be very convenient to have an NFS storage repository. First, NFS SRs can be shared storage between two or more XenServers so that you get all the benefits of a resource pool such as XenMotion capability. Second, NFS SRs automatically create any virtual hard disks in them as VHDs, which makes interoperability with Hyper-V, Virtual Server, or Provisioning Server really easy.
In the past, setting up an NFS share on Windows was a real chore. Windows Services for Unix was just temperamental and difficult to work with, and on my Windows XP box, it caused bluescreens. So, I set up a Linux box just for NFS. However, with Windows Server 2008, all the difficulty is gone, at least if you are using a Windows 2008 Active Directory domain.
So, if you have a Windows Server 2008 Active Directory domain controller, here is how to set up Windows Server 2008 for NFS file sharing.
On the Windows 2008 domain controller, install a Role Service under Active Directory Domain Services of “Identity Management for UNIX” with all the secondary check boxes checked. This will require restarting the domain controller, and then allow the configuration to complete after logging back in.
Create a global security group in Active Directory with a name like “NFSGroup” (the name isn’t important, but it needs to be all one word.) In the Properties of the group, go to the Unix Attributes tab and change the NIS Domain to the NetBIOS name of the AD domain and give the group a GID of 0 (zero). No members need to be added.
In the Properties of the Administrator’s AD account, go to the Unix Attributes tab and set the AD domain’s NetBIOS name for the NIS domain, enter 0 for the UID, and enter the group created above as the Primary group. This maps the Administrator account to the XenServer root account.
Now, on the file server, go to Administrative Tools > Services for Network File System (NFS). Right-click “Services for NFS” and choose Properties. For the Identity mapping source, choose Active Directory domain name and enter the NetBIOS name of the domain. Leave User Name Mapping unchecked.
Create a folder on the 2008 server you wish to use as the NFS share. Right-click on the folder and choose Properties and you will see an NFS Sharing tab. Click the Manage NFS Sharing… button and share the folder with whatever name you like, (for example nfsshare); ANSI encoding; do not click Allow anonymous access (unless you wish to); and click the Permissions button.
Give ALL MACHINES Read-Write access and check Allow root access. Then click OK, OK, and Close.
In your XenCenter console, click Storage from the top menu and choose New Storage Repository… and choose NFS VHD and click Next. Give it whatever name you wish and for the Share Name: enter IP address:/nfssharename. (For example: 192.168.1.5:/nfsshare ). Click Scan to see if you’ve done it correctly. If no error, click Finish.