vSphere Storage Appliance

 View Only
  • 1.  How to Shrink the VMDK with Thin Provisioning Enabled

    Posted Aug 19, 2009 09:52 AM

    Hello:

    I have create a Virtual Disk with Thin Provisioning enabled. May I know how can I reduce the disk size? It was because I only have 5G file on the disk but the actual size is about 10G. Does nay action need to be perform can reduce the size? For example shrinking.

    Thanks!



  • 2.  RE: How to Shrink the VMDK with Thin Provisioning Enabled

    Posted Aug 19, 2009 12:04 PM

    Hello.

    You can use the sysinternals sdelete utility or the VMware Tools shrink function.

    More information can be found at Duncan's site.

    Good Luck!



  • 3.  RE: How to Shrink the VMDK with Thin Provisioning Enabled

    Posted Sep 08, 2009 02:03 AM

    vmroyale, tank you for the reply, but how can we make sure that the "shrink" command is always available in the vmware tools, and the sdelete will actually save space rather than growing the disk?

    I have installed ESXi 4 with several guest “Widows Server 2008 32-bit”, “Windows 7 32-bit and 64 bit”, “Windows NT 4.0” and VMWare tools under each guest.

    When the guest is installed in the “thick-provisioned” disk, the shrink option is enabled in VMWare Tools, but shrinking does not actually decrease the used space (this is quite expectable for thick disks, but why then the shrink option is enabled?). For thin-provisioned disks, the shrink option is disabled with a message “shrinking is disabled for virtual disks not used in persistent mode and other factors, see documentation for your VMWare product”. However, documentation didn't give an explanation.

    Under “Windows NT 4.0” and “Windows 7 64-bit”, shrink was always disable, whether the provisioning was thin or thick.

    Since shrink was disabled for thin-provisioned disk under Windows 7 32-bit, I have found an advice to run “sdelete.exe -c” but rather than freeing the space it grew the used space almost to provisioned space.

    Does anybody have shrink enabled for thin-provisioned disk, and what guest Windows are you using?

    In the meanwhile, I have found only one way to free space on a thin-provisioned disk: use the build-in Windows backup tool to backup the entire system to a network, delete a virtual machne, create a new one and restore the backup, but it is clumsy.



  • 4.  RE: How to Shrink the VMDK with Thin Provisioning Enabled

    Posted Nov 05, 2009 11:28 AM

    The answer to shrink a thin vmdk is, after using sdelete app, to use vmotion to move or copy your VMs, or if you don't have vmotion, to use converter standalone to do the 'convert' your VMs.

    I don't have vmotion on my vsphere (I use the simple vsphre client), so I tried the second solution with converter standalone, and it worked :smileyhappy:

    quick guide:

    • create a VM with a thin disk of 12Go), install OS and few apps -> you'll have a more or less 2Go disk.

    • launch "sdelete -c" (if only one disk) within the VM -> the disk grow up to 12Go

    • use converter standalone to convert your Vm to a new one on the same vsphere (don't forget to create it with a thin disk, default is thick)

    • The new VM is 1.2Go.

    • delete the old VM

    bye!



  • 5.  RE: How to Shrink the VMDK with Thin Provisioning Enabled

    Posted Nov 05, 2009 01:53 PM

    I'm using ESXi, not ESX, how can I launch "sdelete -c" there?



  • 6.  RE: How to Shrink the VMDK with Thin Provisioning Enabled

    Posted Nov 05, 2009 04:20 PM

    sdelete is a command that you run inside your Windows guest. When files are created, moved, changed, they are written to new sectors on the virtual hard disk. When files are deleted, the sectors still contain the old information. It isn't removed. Over time the disk fills up with these unused sectors but that have information in them. sdelete zeros out these unused sectors allowing the disk to be shrunk.



  • 7.  RE: How to Shrink the VMDK with Thin Provisioning Enabled

    Posted Nov 05, 2009 06:04 PM

    DSTAVERT explains it well, and if you want to download the exe, follow the link below :smileywink:

    bye



  • 8.  RE: How to Shrink the VMDK with Thin Provisioning Enabled

    Broadcom Employee
    Posted Nov 05, 2009 06:32 PM

    no way you can shrink it again unless you do a storage vmotion after an sdelete...

    Duncan

    VMware Communities User Moderator | VCP | VCDX

    -


    Blogging:

    Twitter: (*NEW*)

    Available Soon: vSphere Quick Start Guide ()

    If you find this information useful, please award points for "correct" or "helpful".