Reclaim FC Datastore Space

Reclaim unused space on Thin Provisioned NetApp LUN

Something that’s annoying when you’re implementing thin provisioning for your Fibre Channel LUNs is that when you delete or move VMs from the LUN, the freed up space is not seen on the NetApp storage controller.

You can see this problem here where I’ve deleted files from the datastore so that VMware sees plenty of free space but NetApp still sees a 70% full LUN. Space has become available on the VMFS filesystem but the NetApp storage controller doesn’t recognize it because we don’t know what’s going on inside that filesystem.

There’s an easy way around this that could be handy if you need that extra space in NetApp ONTAP. Make sure that space-allocation is enabled on your lun before you try this. If it isn’t enabled – by default it will be disabled in ONTAP – you will see that the SCSI UNMAP is not supported in ESXi.

esxcli storage core device vaai status get
naa.600a09803830344a583f497178583352
VAAI Plugin Name: VMW_VAAIP_NETAPP
ATS Status: supported
Clone Status: supported
Zero Status: supported
Delete Status: unsupported

You can follow these steps to enable them. Unfortunately it requires you to offline the LUN to reflect the changes so you’ll obviously want to move any VMs away from the LUN.

  1. Offline the LUN
    lun offline -vserver Infra-SVM -path /vol/workload2/lun1
  2. Modify the LUN to ensure space-allocation is enabled
    lun modify -vserver Infra-SVM -path /vol/workload2/lun1 -space-allocation enabled
  3. Online the LUN
    lun online -vserver Infra-SVM -path /vol/workload2/lun1

Now you can see that Delete Status is supported; we can continue on to free up some space.

esxcli storage core device vaai status get
naa.600a09803830344a583f497178583352
VAAI Plugin Name: VMW_VAAIP_NETAPP
ATS Status: supported
Clone Status: supported
Zero Status: supported
Delete Status: supported
esxcli storage vmfs unmap -l Test

After this you can see that my LUN in ONTAP’s System Manager reflects the correct size used!

Just a warning… You will probably take a performance hit in your vSphere cluster when you run the unmap command. Keep that in mind and run it during off peak hours.

-Kirk