• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Yellow Bricks

by Duncan Epping

  • Home
  • ESXTOP
  • Stickers/Shirts
  • Privacy Policy
  • About
  • Show Search
Hide Search

Punch Zeros!

Duncan Epping · Jul 15, 2011 ·

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.

Share it:

  • Tweet

Related

Server 5, 5.0, Storage, vmfs, vSphere

Reader Interactions

Comments

  1. Bilal Hashmi says

    15 July, 2011 at 07:08

    nice…!

  2. David Hill says

    15 July, 2011 at 12:44

    Nice find, I have never noticed that in 4.1 either 🙂

  3. iwan rahabok says

    15 July, 2011 at 13:21

    I like the “punchzero” wording!

  4. Rynardt Spies says

    18 July, 2011 at 13:24

    Nice find!

  5. john says

    18 July, 2011 at 18:15

    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

      18 July, 2011 at 21:03

      zero out the disk first by using “sdelete”

  6. john says

    18 July, 2011 at 23:37

    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.

  7. dan pritts says

    19 July, 2011 at 17:32

    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

      6 August, 2011 at 21:14

      Sdelete does overwrite all areas, not only those who previously held a file.

  8. Michael says

    22 August, 2011 at 16:17

    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

  9. Robert Kloosterhuis says

    4 August, 2012 at 21:24

    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.

  10. udhayakumar says

    19 September, 2012 at 15:09

    Thankyou. My 2008 server space has been restored to valid used data space.

Primary Sidebar

About the author

Duncan Epping is a Chief Technologist in the Office of CTO of the HCI BU at VMware. He is a VCDX (# 007) and the author of multiple books including "vSAN Deep Dive" and the “vSphere Clustering Technical Deep Dive” series.

Upcoming Events

04-Feb-21 | Czech VMUG – Roadshow
25-Feb-21 | Swiss VMUG – Roadshow
04-Mar-21 | Polish VMUG – Roadshow
09-Mar-21 | Austrian VMUG – Roadshow
18-Mar-21 | St Louis Usercon Keynote

Recommended reads

Sponsors

Want to support us? Buy an advert!

Advertisements

Copyright Yellow-Bricks.com © 2021 · Log in