vSphere Hypervisor

 View Only
Expand all | Collapse all

Large vmdk file size compared to virtual machine data

  • 1.  Large vmdk file size compared to virtual machine data

    Posted Jan 10, 2021 05:37 PM

    Good evening,

    I have a vSphere Client version 6.7.0.42000 framework. I have numerous virtual machines, but I note that the size of the vmdk file inside the storega is much higher than the space occupied by the data inside the windows virtual machine. To give you an idea, data occupied 500 GB vmdk file size 1500 GB. I have no snaptshots and the disks are in think mode. I am aware that some differences are normal, I would like to understand how to fix the situation.

    Thanks



  • 2.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 10, 2021 06:34 PM

    Is your storage set to thin provisioning?



  • 3.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 10, 2021 11:27 PM

    Yes



  • 4.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 10, 2021 11:30 PM

    I know that if I transfer the virtual disk to another datastore the disk size would return to normal but I would like to avoid doing this.
    I am looking for a faster method. Maybe from the command line so you can schedule it



  • 5.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 11, 2021 10:08 AM

    Hi ,

    Are you using VMFS6? This has Space Reclamation with auto-unmap (https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.storage.doc/GUID-98901BEE-8675-4D39-8AA2-E790EE341986.html, I know this is for vSphere 7, but it's the same.) 

    If not, you might want to consider to move to VMFS6 for your LUN's. Another way would be to do a manual unmap on the lun. I suggest to read this KB for that: https://kb.vmware.com/s/article/2057513 

    The easiest method would be to move the VM to another LUN, convert the previous LUN to VMFS6 (if applicable) and then move the VM back.



  • 6.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 11, 2021 10:45 AM

    currently my configuration is as follows



  • 7.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 11, 2021 10:45 AM


  • 8.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 11, 2021 11:33 AM

    Hi  

    Thin provisioning will not release automatically that space what was used before. Once the space was used at least once, that count as used in the future until you clean it.This is something you have to do manually or an automated script as VMware is not responsible to clear out non-zeroed disks  in the guest VMs.

    For example:

    Your vm size is 500GB and you can go up to 1500GB. Started to populate the disk with iso files and download to the vm 100gb new data. Your disk is growing up to 600gb but when the ISOs have been removed, the used disk will not shrink back to 500 on VMware level. You will see 500gb used on Windows, but 600 in VMware.

    To reclaim the unused disks in the guest vm, the unused blocks should be zeroed out,  then run vmkfstool on the vmdk.:

    in windows guest os you can use sdelete.  For example:  sdelete c:/

    then on the esxi you can run: vmkfstool -K yourcdrives.vmdk

    I recommend to test on a dummy vm first, and/or create a backup of your vm.

    Related KB:  https://kb.vmware.com/s/article/2004155



  • 9.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 12, 2021 03:27 PM

    Excuse me but at this point I will give a practical example:
    I have a virtual machine with a secondary data disk set in thin mode with maximum 1,536 GB. today the vmdk file is 1,593 GB in size, with a data fill of 456 GB. now if i create a new 700gb file in thik mode, that way i am sure the disk won't get bigger than 700gb? do I save myself any subsequent work?



  • 10.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 12, 2021 05:26 PM

    Not sure if I understand, but if you have a disk in thin mode, if you create a new 700GB file, the disk would be 700GB large (if this is a new disk). If you delete that 700GB file the thin disk will still be 700GB. You will have to clean this up.

    This is why I always ask somebody to right size their virtual machine, start small and grow in small increments so that you don't have to go all this in the end.



  • 11.  RE: Large vmdk file size compared to virtual machine data
    Best Answer

    Posted Jan 12, 2021 08:54 PM

    Hi All,

    We are talking about different things.

    What we have here is 3 different layer:

    1, Guest os
    2, vmdk
    3, storage lun

    To reclaim unused space the following order should be followed:

    1, If you delete something in the guest os, that something will be deleted only logically. Your guest os will be aware about those logically deleted items but on vsphere level its invisible. That is why necessary to write zeroed out all the unused blocks. In windows vms, this could be the sdelete command. Once its complete, and the deleted/unused space is zeroed, then we can jump to point 2.
    2, Shrink the vmdk: this can be happen with the vmkfstools.
    3, Once vmdks are shrinked or in other cases deleted, can the lun reclaim the space on storage level, this is called unmap. With vmfs v6 unmap can be automated but also there are esxcli commands to do that.

    Now. if you have thin disk then its maximum size cannot be larger (just a little bit) than what you set.  If you create a think disk as large of 700GB, then it is its maximum size. The initial size could be between 0-700. Of course if you utilize all of the space then its will be 700gb at the beginning.

    Regards,

     

     

     

     



  • 12.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 12, 2021 09:08 PM

    Hi! I understand what you are telling me, but I was thinking that being a disk that is part of a file server machine therefore in continuous saving and deleting data. If, on the other hand, I create a 700gb thick mode disk, the space used by the vmdk file will immediately be 700gb and will not change abnormally over time. Quite right?



  • 13.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 13, 2021 07:33 AM

    Yes, if you create a 700GB Thick disk, it initially is 700GB, and it will stay 700GB over time.



  • 14.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 14, 2021 08:58 AM

    Thanks to all problems solved



  • 15.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 14, 2021 09:22 AM

    Awesome!

    Please mark post as solution or just give kudos.

    Thanks,



  • 16.  RE: Large vmdk file size compared to virtual machine data

    Posted Jan 13, 2021 08:12 AM

    Yes, thick disk will allocate all the spaces during the creation and keep its size.