Reclaiming space on VMs

Here are some great posts about reclaiming unused space in esxi.

WHAT’S NEW IN ESXI 6.5 STORAGE PART I: UNMAP

IN-GUEST UNMAP FIX IN ESXI 6.5 PART I: WINDOWS

IN-GUEST UNMAP, ENABLEBLOCKDELETE AND VMFS-6

To get automatic space reclamation you’ll need:

  • ESXi 6.5 Update 1
  • iSCSI volume formatted with VMFS6. (I think VMFS5 works but there are caveats.)
  • Thin provisioned disks.
  • discard option enabled on mount points for your Linux guests.

My new esxi 6.5 host connecting to iscsi volume on FreeNAS 11.0 works like a charm at least when I force and UNMAP with sudo fstrim /

I haven’t had it enabled long enough to watch it work it’s magic, but apparently this means no more filling the drive with zeros, then punching a hole while the machine is offline.

UPDATE 2018-01-20: The magic happens immediately. You can see the updated datastore size immediately after deleting a large file in a linux VM.

It also means that as much as I hate setting up iSCSI, I’m not going to go back to NFS if it doesn’t have this.

Advertisements

Convert VMDK to Thin without vMotion

Storage vMotion is wonderful but vMotion isn’t available without vCenter. bah!

This was a nice guide:

  1. Enable SSH to the host.
  2. Browse to the VM
    cd /vmfs/volumes/<datastore>/<vm>
  3. Create a thin version of the VM.
    vmkfstools -i d <vharddrive>.vmdk -d thin <vharddrive>-thin.vmdk
  4. Remove the thick .vmdk
  5. Attach the thin .vmdk
  6. Delete the old .vmdk and *-flat.vmdk

 

Can’t format VMFS5 partition

While trying to add an ssd to my esxi 5.5 server I encountered a bug when it tried to format and add the storage:

Error:A specified parameter was not correct.
Vim.Host.DiskPartitionInfo.spec
Error Stack
Call “HostStorageSystem.ComputeDiskPartitionInfo” for object “storageSystem” on ESXi “x.x.x.x.” failed.

I found a blog post describing the same issue and found it was the existing partitions that was causing it to fail. But instead of dropping into the CLI to delete the partitions manually and continue, the comments had another idea: Create a VMFS3 partition then upgrade to VMFS5.

I ended up creating a VMFS3 partition, but deleted it instead of upgrading it. Then I created a VMFS5 partition successfully. I don’t care for upgrading filesystems. I always prefer to start fresh.