NTFS format triggers a fully UNMAP first, then it allocates its metadata, in this case about 87 MB. I had completely forgot about that behavior.
![allocatipon iunit allocatipon iunit](https://bestoftechguide.com/wp-content/uploads/2021/03/Allocation-Unit-Size-Fat32.jpg)
Well I first thought that maybe I didn’t wait long enough for UNMAP to finish. I noticed that the remaining 1.5 GB virtual disk, was now ~80 MB. So during testing I decided to try deleting the virtual disk instead of removing and adding an entirely new virtual disk. I got back about half of what I expected.Ībout 1.5 GB was returned. I would permanently delete the file and then run the disk optimizer tool, not everything would be reclaimed though. I had copied an ISO to a thin virtual disk which made it 3.1 GB in size: I was testing some other UNMAP stuff and I couldn’t get UNMAP to work fully. Paste that into a PowerShell window and you will get your answer. Get-WmiObject -Query $wql -ComputerName '.' | Select-Object Label, Blocksize, Name To check, here is a short PowerShell script from this blog post that will do it easily: $wql = "SELECT Label, Blocksize, Name FROM Win32_Volume WHERE FileSystem='NTFS'" This is a common SQL best practice so many of you probably are have NTFS configured as such. The reason I am blogging about it just now is that I just figured it out. NOTE: This behavior is common to ESXi 6.0, 6.0 U2 and 6.5.
Allocatipon iunit Patch#
UPDATE: This is fixed in 6.5 Patch 1! You no longer need the right allocation unit size! See this post: In-Guest UNMAP Fix in ESXi 6.5 Part I: Windows So make sure your NTFS volumes are using a 64K allocation unit. Anything else will prevent automatic in-guest UNMAP with virtual disks from Windows.
![allocatipon iunit allocatipon iunit](https://www.remosoftware.com/info/wp-content/uploads/2016/12/allocation_unit_size.png)
Long story short, make sure when formatting your NTFS that the allocation unit is 64K. One thing really bothered me about this, which is why doesn’t automatic UNMAP work? In Windows 2012 R2 and later, by default, when you delete a file UNMAP is supposed to be issued automatically to reclaim the space. CBT cannot be enabled (though this restriction is removed in ESXi 6.5 see this post).If EnableBlockDelete is enabled on the ESXi hosts, ESXi will issue UNMAP to reclaim the space on the array.
![allocatipon iunit allocatipon iunit](https://i1.rgstatic.net/publication/281630272_MAUSS-R_Multivariate_Allocation_of_Units_in_Sampling_Surveys/links/55f1314d08ae0af8ee1d49d0/largepreview.png)
Run Disk Optimizer to reclaim the space.The high-level workflow if you don’t want to read the post is:
Allocatipon iunit how to#
I posted shortly after ESXi 6.0 came out a while back explaining how to do in-guest UNMAP with Windows.