ESXi

 View Only
Expand all | Collapse all

a way to reclaim freed space in thin provisioned drives?

  • 1.  a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 04:37 AM

    I read some where that with vsphere 5, there is a way to reclain free space from a thin provisioned vmdk. I wish I could remember when I saw it but I'm sure I saw it on vmwares web site. I think it had something to do with running a command from the vma but the guest os would have to have vmware tools installed on it. Is it true?



  • 2.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 03:23 PM

    Reclaim of free space from  thick provision is valid. Reclaim of free space from thin disk, i dont think as a right choice.

    Its already in such a way that the free space is not used. only as the data grows disk is used.

    any way. vmkfstools command was used to reclaim free disk space.

    But from vsphere its not possible to use vmkfstools to reclaim the free disk space, i mean shrink of vmdk.

    YOu can use vmware standalone convertor best tool to do this and also a free tolol. coverter the VM and during customization screen reduce the disk space as you want.

    Award points for the useful and correct answer by clicking the below tab :smileyhappy:



  • 3.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 03:52 PM

    So I could pull it off with converter? Could convert the vm to another vm on the same esxi host and still reclaim that free space?



  • 4.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 05:47 PM

    Yes ofcourse you can do that.

    For example.

    esxi host 1 with VM c: drive 100GB thin disk and you want that 100 GB :drive to be reduced to 50 GB.

    Use VMware convertor and start covertion during customization change the disk size from 100 GB to 50 GB.

    and start the process on the same esxi host. once done. swap the virtual machines.

    Award points for the correct and helpful answer by clicking the below tab :smileyhappy:



  • 5.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 05:51 PM

    But then the virtual disk will be 50GB instead of 100GB. Is there a way to still have the 100GB disk but just free up the space inside that disk? For example, I have a file server vm that's 100GB with a thin disk. over time I write 60GB worth of data but one day I do some cleanup and now I'm only using 20GB of the 100GB. Since the 40GB of previously occupied space is freed up, it's still taking up storage space on my san because esxi doesn't know it can reclaim those 40GBs back and reduce the amount of physical space the vmdk is taking up.



  • 6.  RE: a way to reclaim freed space in thin provisioned drives?
    Best Answer

    Posted Nov 27, 2011 05:57 PM

    Really.

    We have our whole environment in provisioned with thin disk and we never faced such problem.

    Once i free up some space it will be reflected in the datastore as what ever the actual free space is.

    Did you do a rescan on the datastore.

    did you try svmotion the VM that was freed up with space from 60 GB to 40 GB.

    if you have tried all the above and still it shows as the same.

    Then go with vmware convertor again.

    Award points for the helpful and correct answer by clicking the below tab :smileyhappy:



  • 7.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 07:40 PM

    Your right. I did a test by uploading a 3GB file to my file server. I checked the provision space and it went up around 3GB. I deleted the file and refreshed the datastore and it went down 3GB automaticly. Thanks for the help.



  • 8.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 07:41 PM

    dirtdevil01 wrote:

    For example, I have a file server vm that's 100GB with a thin disk. over time I write 60GB worth of data but one day I do some cleanup and now I'm only using 20GB of the 100GB. Since the 40GB of previously occupied space is freed up, it's still taking up storage space on my san because esxi doesn't know it can reclaim those 40GBs back and reduce the amount of physical space the vmdk is taking up.

    The first thing is to make sure that the space is being free inside the VM. This is depending on the guest operating system, but most file systems do not actually erase data when files are deleted, they are just free in the file system tables, but left on disk to later be over written by other data. However, if you delete 40 GB as in your example you must make this space actually deleted from inside the VM before there is any possibility to reclaim the space from the "outside".

    If you are running Windows Server you could look at sdelete from Microsoft for this.



  • 9.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 07:49 PM

    Check out the post I made above. I did a test and it unprovisioned the space after I deleted the file. My file server is ubuntu.



  • 10.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 27, 2011 08:08 PM

    dirtdevil01 wrote:

    Check out the post I made above. I did a test and it unprovisioned the space after I deleted the file. My file server is ubuntu.

    Do you mean that the thin VMDK file was reduced in size automatically when you deleted files inside the VM? That would be really great and amazing if it works, but from my understanding this does not work this way yet.

    I hope I am wrong since it would really nice. But you could you please check again and note the vmdk file size before and after changing files inside the guest file system.



  • 11.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Nov 28, 2011 03:25 PM

    Crap, yeah I think your right. I did the same test again and it didn't reduce the size. Also, I found this...

    https://www.vmware.com/pdf/vmware-tools-installation-configuration.pdf

    On page 33 under "Shrinking disks is not allowed under the following circumstances" ...

    "The virtual machine is hosted on an ESX/ESXi host. ESX/ESXi can shrink the size of a virtual disk only

    when a virtual machine is exported. The space occupied by the virtual disk on the server, however, does
    not change."

    Crap. Welp, thats a feature I hope they release in vSphere 6.



  • 12.  RE: a way to reclaim freed space in thin provisioned drives?



  • 13.  RE: a way to reclaim freed space in thin provisioned drives?

    Posted Dec 28, 2011 08:06 PM

    If you can power off the Vm and you have enough space on the datastore

    1. Make free space in guest os

    2. use sdelete or dd as in previous link http://www.jules.fm/Logbook/files/shrink_vmdk_files_in_vmware_vsphere.html

    3.  Power off vm

    4. vmkfstools -i original_disk.vmdk -d thin newdiskname.vmdk

    5. rm original_disk.vmdk

    6. mv newdiskname.vmdk original_disk.vmdk

    power on vm.