How to Shrink a VMware Guest in VMware Workstation/ VMware GSX Server/, VMware Server. And… VMware Server lets you do something new!
(At some point I hope to have some screen grabs, but some notes:)
Shrinking a VMware guest (.vmdk file)
The basic command:
To make the size of a VMware guest image smaller, use the vmware-vdiskmanager command, with the -k option:
>vmware-vdiskmanager.exe -k guest.vmdk
The prep work:
Less talked about, but equally important, is “preparing the guest for shrinking,” from inside the guest OS.
Before you run vmware-vdiskmanager, boot into your guest OS:
- open vmware-toolbox (both Windows and Linux VMware guests will have this)
- click the “shrink” tab
- make sure all relevant drives are selected
- run “Prepare to Shrink.”
OS Gotchas:
Note: most existing documentation suggests that the shrink option of vmware-vidskmanager will only work on a Windows host. The VMware docs say you can shrink any kind of guest, but only from Windows hosts. This is somewhat true.
The Linux versions of VMware Workstation 5.5 and VMware GSX Server 3.x versions of the vmware-vdiskmanager tool do not even have a “-k” flag.
(This is officially documented for VMware Workstation 5.x, and VMware GSX Server 3.x: http://www.vmware.com/support/ws55/doc/ws_disk_manager_shrinking.html
http://www.vmware.com/support/gsx3/doc/disks_vdiskmanager_eg_gsx.html)
Special undocumented present from VMware:
But the new GSX replacement product, VMware server, seems to let you do shrink with the vmware-vdiskmanager, from a Linux host! As of February 24, 2006, there’s still no official documentation for VMware server, but the vmware-vdiskmanager tool included with it on the Linux version of VMware Server does support the -k (shrink) option! Very cool!
TECHNORATI TAGS: vmdk, VMware, virtualization, sysadmin, VMware Server, free, VMware Workstation
September 7th, 2007 at 7:39 am
Thanks for this information. I’m sure it’s in “the manual” somewhere, but I was having a bad time finding any good information (quickly) outside of your article.
Your prerequisite section is what did it for me. In VMware WS 6.0, I performed the preparation phase, and was then prompted as to whether or not I wanted to shrink the disk right then and there.
I didn’t have to use the vmware-vdiskmanager.exe program outside of this process.
Worked like a champ.
Thanks!
Charles R. Whealton
Charles Whealton @ pleasedontspam.com
April 8th, 2008 at 11:20 pm
Hi,
I downloaded the last version of vmware server (VMware-server-1.0.5-80187.tar.gz) but vmware-vdiskmanager doesn’t have “-k” option.
Is there a later release? I’m desperate looking for the way of shrinking my vmdk files in my linux host.
Thank you very much!
October 2nd, 2008 at 1:58 pm
I “shrunk” a vdisk as described; however, it appears that it created a snapshot. There is a new smaller vdisk file but it is linked to the original file.
I prepared the vdisk by mounting the disk and calling the vmware-vdiskmanager -p option. Then I unmounted the vdisk and called the -k option. There were two files. When I moved the original file. I got an error about not finding the parent file.
What did I miss?