I was just playing around with vSphere 5.0 and noticed something cool which I hadn’t noticed before. I logged in to the ESXi Shell and typed a command I used a lot in the past, vmkfstools, and I noticed an option called -K. (Just been informed that 4.1 has it as well, I never noticed it though… )
-K –punchzero
This option deallocates all zeroed out blocks and leaves only those blocks that were allocated previously and contain valid data. The resulting virtual disk is in thin format
This is one of those options which many have asked for as in order to re”thin” their disks it would normally require a Storage vMotion. Unfortunately though it only currently works when the virtual machine is powered off, but I guess that is just the next hurdle that needs to be taken.
Bilal Hashmi says
nice…!
David Hill says
Nice find, I have never noticed that in 4.1 either 🙂
iwan rahabok says
I like the “punchzero” wording!
Rynardt Spies says
Nice find!
john says
I may not be understanding this correctly. If a File System deletes a file, it doesn’t necessarily delete a file, so it doesn’t get zeroed out. How can space be reclaimed from that vmdk?
Duncan Epping says
zero out the disk first by using “sdelete”
john says
ah, yeah, i’d assume that with that utility scheduled on the servers to run on a regular interval should make a difference. Very nice. Thank you Duncan.
dan pritts says
On a *nix guest, you can do something like this to fill the disk with nulls:
mkdir /junk
cd /junk
dd if=/dev/zero of=/junk/zero bs=1024k
this will fill the unused space on the virtual disk, which is almost certainly slower than finding the used blocks and zeroing only them.
I do not know whether the windows command referenced above fills the disk or only overwrites the previously-used space. I’d guess the latter.
Rickard Nobel says
Sdelete does overwrite all areas, not only those who previously held a file.
Michael says
Just noticed that if there exists a xxx-ctk.vmdk for changed block tracking, the -K Option no longer works:
Hole Punching: 0% done.Could not punch hole in disk ‘xxx.vmdk’: Function not implemented
ESXi 4.1 U1
Robert Kloosterhuis says
I use came across this command reading the vSphere Storage guide documentation while studying for VCP5 exam. Its so little know, yet so very useful. No instructor I ever asked knew this was also an option. I don’t understand that to this day, they do not provide a standard right-click function to shrink a VMDK. In any enviroment where thin-provisioning is used, this is critical to have.
udhayakumar says
Thankyou. My 2008 server space has been restored to valid used data space.