Best way to Shrink VMDK file on ESXi datastore that is almost out of space
Posted on 2011-05-06
I am doing some testing of VMWare ESXi 4.1 and I created one VM on my test host that uses 450 GB of total space. My plans were that I would have more disk space by now but I have run into a problem on the VM and I haven't been able to add any additional disk space yet. The problem is that I have run out of disk space on the only partition on the ESXi host and this caused the VM to go down. I was able to temporarily fix this issue by decreasing the RAM allocated to the machine from 8GB to 4GB so as to lower the amount of swap file space taken up and give the host an additional 4GB of space on the disk partition to allow the VM to boot.
Now I am trying to find a way to shrink the VMDK file on the host from 450 GB to around 400GB as I just want this server to have enough room to function continuously and not go down because of disk space issues. I have been reading that you can use VMWare VCenter Converter which I have downloaded in its standalone version to shrink a VMDK during the coversion process doing a V2V conversion. This seems like the safest route but I am now wondering if I can get away with doing a V2V conversion to the same disk partition that I have run out of space on. It seems unlikely that I can do this since I would think the the conversion would write a vmdk file of the "new" disk to the same partition and I wouldn't have any space there for the necessary files to be written. Still I wanted to check. So is this method possible?
If not what are my other options? I would like to not have to rebuild this server if possible. I plan to order some more disk space for this server but I wasn't planning on making that order for another month or so. If I do get more hard drive space I was going to create a second datastore on the ESXi host and then just move the VM to that datastore which will be much larger. Is that as easy as just shutting down the VM and copying the VM folder on datastore1 to the new datastore2? I'm sure there are a couple of other tasks I might need to do for the transfer from one datastore to the other but I wanted to get a basic idea of how to do it anyways.
Thanks in advance for your advice or suggestions.