Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a thick virtual disk (vmdk) file that is purely just a file-store. I currently have it configured to take up 2TB, however, there is only one 900GB partition on it. I read somewhere that the following command will force it to shrink, however, the poster said that this way is "fraught with danger":

vmkfstools -X 910G /vmfs/src_file.vmdk --force

Will this render my data innaccessible? I am only downsizing the vmdk file to free up the unpartitioned space in the ESXi datastore. Using the VMWare Tools shrink utility does not shrink the disk, it prepares it and then immediatelyn says the operation completed successfully.

share|improve this question
    
What guest OS are you running and what version of ESXi do you have? –  Chopper3 Mar 26 '11 at 18:08
add comment

2 Answers

up vote 3 down vote accepted

You can always create a new virtual disk, mount both on your guest, copy the files over, mount the new smaller disk in place of the old larger disk. Once you are happy everything is right, delete the old larger disk.

share|improve this answer
add comment

If you're running any recent version of esx(i) you can do a storage vmotion and convert it from thick to thin as it goes.

If you're on 4.x this is built in to the gui, if it's a previous version it either involves getting a plug-in or using powershell.

You will need two datastores with the second at least large enough to store the entire vmdk plus associated files (swap, nvram, etc). But you could move it right back after you're done.

This is a completely supported way of doing things and is safe.

share|improve this answer
    
Please note that you should be able to do it even without Storage vMotion if you first shut down the VM. Also note that at least in ESX(i) 4.1 if using VMFS3 (not NFS) you must move the .vmdk between datastores formatted with different block sizes; if you move the VM between two datastores formatted with the same blocksize, the disk will not be shrunk. –  Mihai Limbăşan Dec 8 '11 at 0:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.