1

When we first setup ESXi, we over allocated drive space (allocated 300 GBs of a 250GB hard drive) thinking ESXi would shuffle things intelligently like it does with memory and CPU but found out later it doesn't work that way. We were told there was no way to reduce the allocations without deleting the associated drive and major problems could occur if we use more of the drives than exist.

But today, I found I was able to easily extend a drive without even rebooting and was hoping a could use the same technique to shrink a drive. I was able to shrink the drive through Windows 2008 but when I try to decrease the provisioned size through vSphere, it doesn't let me. In the disk partitioning section, it does show the type as "thin".

Would I be able to decrease the allocation if the VM were powered off? If not, if I just shrink the drives in Windows 2008 below the actual available space, will that resolve the possible problem with more space being allocated than actually exists?

EfficionDave
  • 211
  • 1
  • 4
  • 14
  • From reading the accepted answer on this thread, http://serverfault.com/questions/140019/question-about-vmware-thin-provisioning, it does appear that just decreasing the allocations through Windows Server 2008 would also work for preventing a conflict. – EfficionDave Apr 08 '11 at 22:37

3 Answers3

2

Did you thin provision the disk to begin with? If yes, you can reduce it's size, but only so far as has currently been consumed.

I would point that also, within this virtual disk, it has a formatted size that the guest has formatted and recognized.

SpacemanSpiff
  • 8,733
  • 1
  • 23
  • 35
  • How can I tell if it was thin provisioned? There were 70GBs available on the drive overall and through Windows 2008 I've shrunk the drive by 20GBs and that 20GBs is showing as unallocated. – EfficionDave Apr 08 '11 at 22:18
  • I just looked and it does say "Thin" for the type in the Disk Provisioning box. So, how do I reduce it? When I type the new number in the Provisioned Size box it immediately jumps back up to the previous number when the box loses focus. – EfficionDave Apr 08 '11 at 22:23
  • 1
    I could be wrong about being able to reduce it. Most likely, it won't let you reduce it to any smaller than the number of blocks that have been touched. Basically the "virtual disk" file has grown to a certain size and cannot be truncated, though space inside it has been reduced. I think at this point it will be easier for you to hook up an external disk, provision that as a new datastore and use some tools to create and then copy the virtual disk there to get your space back. Then move it back when it is convenient. – SpacemanSpiff Apr 08 '11 at 22:30
2

Sounds like the disk isn't thin provisioned in the first place. Power off the VM and clone it using vmkfstools to thin clone the disk and then just add the new disk (cloned) and remove the older in the VM settings.

" vmkfstools -i /vmfs/volumes/datastore1/test-vm/test-vm.vmdk /vmfs/volumes/datastore1/test-vm/testvm-thin.vmdk -d 'thin' -a "

colealtdelete
  • 6,009
  • 1
  • 29
  • 34
0

First, defrag the drive(s) and then use a disk zeroing tool, (like sdelete -c ) to tidy up. Then, if you have vSphere Enterprise licensing, you can reclaim with a storage vMotion. Right click on the machine, choose "Migrate" and then "Change Datastores". Make the destination type a thin disk and go.

If you don't have the bells and whistles license, or if you want the virtual disk to appear smaller to Windows, use VMware Converter Standalone, (free download from VMware), to perform a V->V (virtual to virtual) conversion. Just make sure to edit the machine's disk(s) and change the destination sizes to the desired value.

Paul Doom
  • 841
  • 6
  • 9