Wednesday, March 29, 2017

Space reclamation with vSphere 6.5 and NetApp storage

In vSphere 6.5 VMware re-enabled automatic space reclamation. Automatic space reclamation was once introduced in vSphere 5.0 but gave a lot of problems with some arrays. In the next update VMware disabled the automatic part. Since then I have not seen many users running space reclamation by hand. But now its back, although you have to enable it, it is not enabled by default.
In this post I will show how to enable Automatic Space Reclamation with the setup in my lab and do some tests.

There are of course already some very good blogs about this topic:
Automatic space reclamation (UNMAP) is back in vSphere 6.5

And the vSphere documentation:
Storage Space Reclamation

First some bad news, you will need the latest version of VMFS (Version 6) and there in no in place upgrade from VMFS 5. So you need to create a new datastore.

on the datastore there is a new setting:

SSD2 a a datastore on al local SSD.

From the ESXi host you can check the settings.
Deploy an Window 2016 vm on the datastore.
It got 2 disks, the boot drive and a test drive. The test drive is formatted with Microsofts new filesystem: ReFS.
The boot disk has 10GB of data on it, the second disk is empty.
At this moment the datastore has 14GB space used.
Lets copy some data to the test drive. Some ISO files.
So, let's look at the datastore.

The VMDK has grown with data we put in it.
For Windows to send the correct command the disk should be recognized as a thin disk.
And it is.

Next. delete the data.

Has the VMDK shrunk?
No is has not.
Now, test with the same VMDK reformatted with NTFS.

Repeat the same trick: Copy data, then delete.
Before the copy:

After the copy:

After the delete:
And there it is: The VMDK has shrunk.
So on my local SSD this works with NTFS.
Now add a NetApp FAS iSCSI lun and use it as a datastore. The same test VM will get a new disk on the datastore. As this is no manual on how to create a lun on a NetApp controller we will skip that part but there is one setting very crucial. The -space-allocation enabled setting on the lun. Without it the ESXi host will not be able to detect that the NetApp controller is able to handle the unmap commands.
The lun created:
Use this command to change the setting:
lun modify -path /vol/iSCSI_DS_vol/iSCSI_DS -space-allocation enabled

Empty lun to start with:
After copy:
After delete, almost empty again:
As I am testing on a simulator, the lun does not shrink immediately. How fast this works on a real production system I don't know yet. 

From an storage efficiency standpoint this is a great feature, but you have to be willing to go thin on thin. Not many administrators would want to run manual unmap but when it happens automatic it will be used.
I also tested with a NFS datastore but Windows does not recognize the VMDK as a thin disk and the VMDK is not shrunk. (tested without the NetApp NFS VAAI plugin)