VMware Cloud Community
matteocim79
Contributor
Contributor
Jump to solution

Large vmdk file size compared to virtual machine data

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

0 Kudos
1 Solution

Accepted Solutions
vxprthu
Enthusiast
Enthusiast
Jump to solution

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,

 

 

 

 



Blog: vxprt.hu

View solution in original post

0 Kudos
15 Replies
Laithan
Contributor
Contributor
Jump to solution

Is your storage set to thin provisioning?

0 Kudos
matteocim79
Contributor
Contributor
Jump to solution

Yes

0 Kudos
matteocim79
Contributor
Contributor
Jump to solution

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

0 Kudos
bryanvaneeden
Hot Shot
Hot Shot
Jump to solution

Hi @matteocim79,

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..., 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.

Visit my blog at https://vcloudvision.com!
0 Kudos
matteocim79
Contributor
Contributor
Jump to solution

currently my configuration is as follows

0 Kudos
matteocim79
Contributor
Contributor
Jump to solution

 
0 Kudos
vxprthu
Enthusiast
Enthusiast
Jump to solution

Hi @matteocim79 

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



Blog: vxprt.hu
0 Kudos
matteocim79
Contributor
Contributor
Jump to solution

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?

0 Kudos
bryanvaneeden
Hot Shot
Hot Shot
Jump to solution

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.

Visit my blog at https://vcloudvision.com!
0 Kudos
vxprthu
Enthusiast
Enthusiast
Jump to solution

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,

 

 

 

 



Blog: vxprt.hu
0 Kudos
matteocim79
Contributor
Contributor
Jump to solution

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?

0 Kudos
bryanvaneeden
Hot Shot
Hot Shot
Jump to solution

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

Visit my blog at https://vcloudvision.com!
0 Kudos
vxprthu
Enthusiast
Enthusiast
Jump to solution

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

 

 



Blog: vxprt.hu
0 Kudos
matteocim79
Contributor
Contributor
Jump to solution

Thanks to all problems solved

0 Kudos
vxprthu
Enthusiast
Enthusiast
Jump to solution

Awesome!

Please mark post as solution or just give kudos.

Thanks,



Blog: vxprt.hu
0 Kudos