Yes, I know, many of you now said “Misha is going to talk about Shrink”. You know what, you pretty true, but ...
Everybody knows What the "shrink" does. Shrink removes an empty space from .VMDK file.
However, the problem is this: What is empty space?
When Windows deletes a file, it doesn't actually delete the data on the disk, it just deletes the references/pointers in the file allocation table. So when “Shrink” is processing a vmdk and is looking at the raw disk, it's seeing values that aren't empty (non-zero), and exports them as such.
You can easily test this out. Create a new vmdk on a VM. Export the VMDK right after you've created it. The exported files will be very small. Now fill the vmdk up with files and export; it will be very big. Now, delete all the files in the vmdk and export; it'll still be big! If you will try to do a "Shrink", you will see that the vmdk file is still big.
So, before doing a Shrink, I’m always using a really cool command line tool developed by Mark Russinovich, SDelete. Simply, execute SDelete with parameter -c inside running Virtual machine, then shut down the Guest and do a Shrink.
Last note. Just in case you forget how to do a shrink ;). From command line go to C:\Programme\VMware\VMware Server\ and execute the vmware-vdiskmanager.exe as shown in following example:
"C:\Programme\VMware\VMware Server\vmware-vdiskmanager.exe" -k "ITSTUFF-SRV-1.vmdk"
If you enjoyed this post consider subscribing via or Email
Pretty cool ! Thanks, I'll try it (have a couple of VMs that will be a lot lighter in space occupation.
ReplyDeleteLet us know about result.
ReplyDeletevery useful and there are tricks for unix as well (sdelete equivalent). Just be aware that this usually hammers the undelying disk during the procedure. If you can not sustain thedisk crunch, tread lightly.
ReplyDeleteThanks for the good post. Here's the Linux/Unix solution http://www.howtoforge.com/how-to-shrink-vmware-virtual-disk-files-vmdk which I used to shrink a 30GB VM disk down to 5.5GB.
ReplyDeleteJust doing the Windows VM right now.
Great article. I think ideals data room service will help to solve your problem!
ReplyDelete