VMware Cloud Community
Nikhil11
Contributor
Contributor

Reducing Disk Space on thin provisioned disk

Hi,

We have a VM in the environment which is occupying thin provisioned disk space of 1 TB now the corporation has decided that the requirement of the VM is of 500 GB only. Hence, have asked me to reduce the disk space of the VM to 500 GB so that the additional disk space can be freed. Now in here lies my problem. On inspecting i found that the VM is using only 142 GB of actual disk space on the data store but if i reduce the size of Disk directly from edit settings of the VM , i am afraid i might have some data loss. Can anyone please guide me as should i reduce the disk space from the edit settings tab of the VM or should i do it via Vmware converter using V2V.

5 Replies
john23
Commander
Commander

Nikhil,

Go with V2V way to reduce the size of vmdk. Its a safer way.

Still I would recommend, before doing this exercise please take the backup of vmdk.

-A

Thanks -A Read my blogs: www.openwriteup.com
0 Kudos
abhilashhb
VMware Employee
VMware Employee

Go with V2V. You could also use vmkfstools but i would suggest you to go with converter which is the better  option as you can do the conversion on the fly. where as vmkfstools would require a downtime.

Abhilash B
LinkedIn : https://www.linkedin.com/in/abhilashhb/

0 Kudos
SatyS
Hot Shot
Hot Shot

You can use sdelete option.

-Move to temp datastore

-sdelete -z from within guest

-move to another datastore as eager zero thick

-move again as thin.

You can get more info here

Regards,

SatyS

If you find this useful,mark the answer as correct/helpful

If you find this useful,please mark the answer as correct/helpful

Regards,
SatyS
http://myvirtuallearning.wordpress.com/

0 Kudos
kermic
Expert
Expert

Reducing the provisioned size of a virtual disk (aka what guest detects as total size of the disk), wether it's thick or thin, can no longer be done with vmkfstools.

Yes, there was a time when you could use vmkfstools -X --force to set the new size smaller than current, however too many customers have shooted their own legs off with this (setting the new size smaller than last block of guest partition) and therefore the --force option was removed. Now with -X option you can only make the vmdk bigger.

The sdelete tool is commonly used in conjunction with vmkfstools -K (--punchzero) command but that's a different scenario:

You create a thin disk, let's say 1TB in provisioned size. Initially the used size for that vmdk on datastore is very small.

Then you copy a bunch of movies to that disk within a guest. Guest says that used space on that disk is 800GB and you see that vmdk size has blown up to something similar.

Now you delete those movies, guest reports that used space after deletion is 40GB, however vmdk size is not reduced and is still around 800GB. This is because the guest normally does not delete the data from disk. It only marks the blocks as "free" in FSTables and therefore vmkernel has no idea about the fact that data has been actually deleted.

You run sdelete within guest. What it does is writes zeros in all blocks that are marked as "free" in guest FSTables. Caution! - in case of a thin disk this will "blow" up the vmdk to it's provisioned size, 1TB in our case.

Then you run vmkfstools -K on that vmdk and what it does is "reclaims" zeroed blocks - basically throws them out and tells the vmkernel "hey, let's ged rid of zeroed blocks, that's not a real data, no need to store them on datastore". After the process completes you should have your vmdk occupying those 40GB (what is real, non-zero data within guest) on datastore, however the provisioned size will still be 1TB.

In order to reduce the provisioned size or what is considered by guest as "physical", the easiest way probably is using VMware Converter.

Nikhil11
Contributor
Contributor

Hi,

Thanks a lot for your response .

Regards

Nikhil Shetty

0 Kudos