Oct 29, 2012 Blogs
A while back, one of my collegaes, Hans Lenze Kaper experimented with the new Windows Server 2012. He wanted to present a NFS Export from the 2012 box to his ESXi host. Here’s his journey:
Microsoft is trying to put Server 2012 in the market as a serious storage platform. Features such as ReFS, CSV Cache and SMB3 Transparent Failover make it interesting enough to give it a spin. All the demos from TechEd look really cool and most work in my homelab. So this got me thinking: Would an NFS share from a Storage Space be usable as an ESXi datastore? This would enable me to have a single file-based storage box that serves shared storage for my Hyper-V cluster as well as shared storage for my vSphere cluster. Maybe even with deduplication for both Hyper-V and vSphere VMs. Wouldn’t that be wonderful?
I have a rarely used HP Microserver N36L and a bunch of disks available to set up this test. Three 500GB and one 1TB disk have been set up as a Storage Space. Since the first test showed a significant performance difference between the ‘simple’ and ‘parity’ space (virtual disk), the rest of this post will use the ‘simple’ space. I’m all for new and shiny things, but no masochist. ReFS partitioning is only available with the ‘mirror’ space, so that’s something for another post.
First we’ll set up the Storage Pool on the four available disks. On top of the Storage Pool we create a Virtual Disk. This Virtual Disk is visible in Disk Management. The end result with a basic volume and NTFS formatting should look something like this.
In the Server Manager, we can easily see the physical disks that are part of this Pool, the virtual disks that reside on the pool and the volumes that are on top of the virtual disk.
Now that we have made the storage available to Windows, it’s time to present the storage to the network using an NFS share. Use Server Manager to add the required role to the server.
Skip the welcome page and choose “Role-based or feature-based installation” since we’re not setting up a VDI or Terminal Server environment.
Select the right server or cluster to install the NFS role to.
Select the “Server for NFS” role from the tree with roles. Accept the pop-up screen asking if you would like to install the management tools.
We won’t be needing any extra features so we’ll skip the features page. If a restart is needed to finish the installation, it may do so without prompting me.
Now we open Server Manager and browse to Share management under File and Storage Services.
On the top of the Shares windows or anywhere in this window under the context menu, you’ll find the “New Share…” wizard.
Choose “NFS Share – Quick” and click next.
I’m a fan of the default folder setup that is suggested in the wizard (the “Shares” folder under the root of the disk) so I’ll choose the drive letter of our new simple Storage Space and click next.
We’ll enter a descriptive name for our new share. I’ll use NFS.
Remember the “Remote path to share” for the ESXi datastore connection later on.
ESXi does not support authenticated NFS connections, so we’ll choose “No Server Authentication”.
Since NFS uses IP addresses for filtering, we add the IP Address to the share permissions.
Language Encoding = BIG5
Share Permissions = Read/Write
Allow root access = Yes
Check if System has full control of the files in the share. (The root access will be remapped to the local System account)
That’s all! You’ll be able to map the NFS share in the “Add Storage” wizard by using the server IP Address/DNS name and the “Remote path to share” we saw earlier.
The PowerShell Way
Since we’re using Server 2012, the steps above can be executed through PowerShell.
We make a new Storage Pool named “SPool1″ out of all the available disks.
New-StoragePool -FriendlyName SPool1 -PhysicalDisk (Get-PhysicalDisk –IsPooled $false)
Next, we carve a virtual disk out of the Storage Pool.
New-VirtualDisk -FriendlyName vDisk1 -StoragePoolFriendlyName SPool1 -ProvisioningType Thin -ResiliencySettingName Simple -Size 250GB
As with every new disk, we should initialize it before partitioning.
Initialize-Disk -VirtualDisk (Get-VirtualDisk vDisk1)
Let’s give our new disk a partition. Find the right drive number by using the following cmdlet.
Get-VirtualDisk vDisk1 | Get-Disk | Format-List -property number
Fill in the drive number in the following cmdlet to create a new partition, volume, set it to NTFS formatting and assign a drive letter to the new volume.
New-Partition -DiskNumber [EnterYourDriveNumberHere] -UseMaximumSize -AssignDriveLetter | Format-Volume -NewFileSystemLabel "Striped" -FileSystem NTFS
After these steps, the virtual disk with NTFS formatting is ready to be used.
In order to present the storage to the ESXi server. We have to install the “Server for NFS” service.
This service comes with a full set of PowerShell cmdlets so there’s no need to grab your mouse.
We start by making the NFS share. Enter your own path to the folder that you wish to share.
New-NfsShare -Name NFS -Path [DriveLetter\Folder]
Since ESXi does not support NFSv4, there’s no need for Kerberos authentication on the share.
Set-NfsShare -Name NFS -Authentication sys
By default, all IP addresses are blocked. Let’s add the ESXi server by IP address.
Set LanguageEncoding to BIG5 or you won’t be able to browse the datastore!
Grant-NfsSharePermission -Name NFS -ClientName [EnterIPAddress] -Permission "READWRITE" -ClientType host -LanguageEncoding BIG5 -AllowRootAccess $true
Of course you could pipe the three commands to deliver the same result in one line.
In the past, enabling a Windows box to host NFS Expert was cumbersome, since the user name mapping feature couldn’t be easily enabled. In Windows Server 2012, this has changed to our benefit, making it very easy to create NFS Exports available to VMware ESXi.