VMware Cloud Community
dmsousa
Contributor
Contributor

How to shrink a vmdk in ESXi 5?

Hi,

I have a server with ESXi with DAS. We have no SAN and little to none space avaliable.

One of the VMs has a thin provisioned disk that as space avaliable that I need to recover.

How can I do that?

Thanks in advance.

dmsousa

Reply
0 Kudos
11 Replies
nielse
Expert
Expert

Do a storage vmotion to thick eager zeroed and then storage vmotion it to thin again to regain the space :slightly_smiling_face:

@nielsengelen - http://foonet.be - VCP4/5
Reply
0 Kudos
dmsousa
Contributor
Contributor

Hi,

We are a small school so we have the free version of esxi and no shared storage between servers so no storage vmotion

With the best regards,

Message was edited by: a.p. - removed email footer

Reply
0 Kudos
a_p_
Leadership
Leadership

In case of low or almost no disk space on the host, one possible option would be to use VMware Converter to convert the VM to your desktop (as a VMware Workstation VM), run shrinking within the the guest OS and then use the Converter to convert the VM back to the ESXi host.

André

PS: When replying by email, make sure you remove the footer to not disclose your email address, ...

Reply
0 Kudos
dmsousa
Contributor
Contributor

Hi,

Can I do this to Vmware Fusion?

And shrinking the guest do you mean shrinking the partitions from within Windows or using a feature of the Workstation/Fusion?

With the best regards,

Message was edited by: a.p. - removed email footer

Reply
0 Kudos
a_p_
Leadership
Leadership

Shrinking is a process of freeing up unused disk space within the virtual machine. There will be no changes made to the partition sizes.

VMware Converter supports converting an ESXi VM to VMware Fusion (http://www.vmware.com/products/converter/faqs.html) and shrinking - since it is done from within the guest OS - should be the same for Fusion as it is for Workstation (I'm no Fusion user) For how shrinking works see e.g. http://kb.vmware.com/kb/1001934

Only one issue remains. VMware Converter is a Windows tool. However, you can run it from another Windows VM if you don't have a physical Windows system.

Please ensure you have a current backup in case something does not work as expected!

André

Reply
0 Kudos
DerekShaw
Enthusiast
Enthusiast

In case someone else finds this, or you haven't done it yet...

I have found NFS servers to be essential to running ESXi as you do (just the esxi box).   A $200 refurbished box with a new hard drive ($200 for a 3TB SATA here in Victoria) does nicely. Installing linux with an NFS server enabled takes me about 30 minutes (I install a lot of linuxes, and I have a working linux on a USB stick that I can rsync to another device, configure and boot in the 30-minute window).

I use ghettoVCB to back up my machines from the esxi box to the NFS server.

In doing this, you end up with a thin-provisioned vmdk that takes up only the space used by the data.

So, in your situation you can (without installing ghettoVCB),

set up an NFS server on your Mac

down your VM

ssh to the esxi box

use vmkfstools to clone the vmdk file to the NFS server (thereby making a backup)

delete the vmdk from the esxi datastore

use vmkfstools to clone the vmdk file from the NFS server to the esxi box (back in the same spot it came from)

your esxi datastore space is recovered.

You are now likely over-committed on the datastore, so be careful to monitor it.

If you have the tools, and assuming you are using some form of windows, you can experiment with resizing the windows partition by mounting it in a different windows VM (which can run off the NFS store), and when you get it right, you can repeat the process above (taking suitable precautions to make additional backups) and end up with a smaller windows partition that may prevent you from being over-committed on the data store.

Reply
0 Kudos
adelatorre
Contributor
Contributor

When vmotioning as you suggest, I do not see any option to alter the disk size.  Can you please elaborate and give more detail?

Thanks.

Reply
0 Kudos
sparrowangelste
Virtuoso
Virtuoso

the free version doesnt have storage vmotion

--------------------- Sparrowangelstechnology : Vmware lover http://sparrowangelstechnology.blogspot.com
Reply
0 Kudos
adelatorre
Contributor
Contributor

I'm using vsphere 5 enterprise.  Not a free version.

Reply
0 Kudos
sparrowangelste
Virtuoso
Virtuoso

if you do a svmotion, you can change the disk type , convert from thick to thin, but you cant make a disk go from 100gb to 20gb

--------------------- Sparrowangelstechnology : Vmware lover http://sparrowangelstechnology.blogspot.com
Reply
0 Kudos
peevs
VMware Employee
VMware Employee

Hi,

You can use VMware Standalone converter https://my.vmware.com/group/vmware/info?slug=infrastructure_operations_management/vmware_vcenter_con....

You can convert the VM with source and target one and the same ESX, but in the Options page of the converter machine wizard to select volumes to be shrinked.

If you haven't enough storage in the vsphere infrastructure, you can use some share to export the VM in the Workstation / Fusion format, then delete the source VM and import back to the ESX the resized Fussion VM.

HTH,

peevs

Reply
0 Kudos