How do I resize a VMware hard disk file?
I have a VMware virtual machine that I made quite large. I am not really using most of it, so I would like to reduce it by 50% or so.
Is there a tool to do this?
Solution 1:
Method 1: Using VMWare Converter:
- Turn off the virtual machine;
- Start the VMWare Converter application;
- Open the wizard;
- Select 'standalone virtual machine' as the source and destination system;
- Choose 'Select volumes and resize to save or add space';
- Enter a new size and voilá, you're done!
Some say that the expand process is slow and that VMWare Tools might need to be reinstalled.
Method 2: Using the VDiskManager:
- Turn off the virtual machine;
- Commit/remove all the snapshots first! (I forgot to mention this, thanks JimO)
- Open a Command Prompt and go to: C:\Program Files\VMWare\VMWare Server or C:\Program Files\VMware\VMware Workstation
- Run this command to expand the virtual disk:
vmware-vdiskmanager -x 12GB "My harddisk.vmdk"
-
Note: Because this only expands the disk and not the partition, you'll need to resize the partition table as well. This can be done by 3rd party tools like 'Partition Magic', but also with 'diskpart.exe', a tool of Windows. In my case, this disk is bootable, meaning that I can't run diskpart on the virtual machine itself. I used another virtual machine, running Windows XP. It also works with the Windows 7 beta 1, but it fails with Windows Server 2003.
Add the increased hard disk to a second virtual machine;
Power on this 2nd virtual machine;
Open a Command Prompt and type:
diskpart
Type:
list volume
Remember the volume number (#) of your volume!Type:
select volume <volume number>
(the number from step 8)Type:
extend
Turn off this 2nd virtual machine and remove the hard disk from the virtual machine configuration. This won't delete the hard disk from disk;
Finished! (Windows automatically recognizes the new and correct disk and volume size)
Thanks for Leon Meijer.
Solution 2:
As of the latest version of VMWare Workstations and Player (VMWare 7), you can resize disks from within the application.
You have to access the settings menu of the Virtual Machine, select the drive and click "Utilities". There you can choose to expand or to compact it.
A note: apparently you can't expand the disk if you have snapshots made to it. You'll have to delete them and retry before compacting it.
Solution 3:
Before you begin, create a backup copy of the virtual disk so that you can restore it in case of failures. Extending a virtual disk can be a complex operations for several reasons, e.g.,:
1) The virtual disk that is full happens to contain the boot/primary partition for Windows
2) There are snapshots
3) There is insufficient disk space available on the physical drive to permit growth
4) It is a multi step process and involves use of different tools and commands in a specific sequence. Creative individuals have devised workarounds to extend the primary partition for Windows by using Linux boot disks and disk partitioning tools such as GParted, and you have to get this right.
You’ll find several posts regarding this topic on Google. Essentially, they are all variations of the posts summarized in
http://blog.sharevm.com/2010/01/11/survey-extend-expand-vmware-virtual-disk/
Solution 4:
There is an easy way! You should download and try fatVM http://www.gudgud.com/fatvm
fatVM is a reliable, robust, and safe, 1-click solution for extending the C drive of your VMware Fusion or Workstation virtual disk that is becoming full. a) It provides a simple, intuitive, interface and a reliable process that hides the technical complexity of extending a virtual disk. b) It is robust because it can extend virtual disks having snapshots and clones. c) It is safe because it preserves your original disk, which remains available to you for when the need ever arises.