Update: There is a much easier way now to resize a virtual disk: Expand a virtual VMware disk with VMware Converter. Also check out this article about my first impressions of VMware Converter 3.0 final.
- Poll: How reliable are ChatGPT and Bing Chat? - Tue, May 23 2023
- Pip install Boto3 - Thu, Mar 24 2022
- Install Boto3 (AWS SDK for Python) in Visual Studio Code (VS Code) on Windows - Wed, Feb 23 2022
Today, my Windows XP test system running in a virtual machine under VMware Workstation 5.5 complained that there is not enough space anymore on the system partition. I thought it can't be too complicated to resize a virtual disk. After all, it is only virtual. I hoped to solve this problem within 5 minutes or so. Well, here's how it went:
I was disappointed the first time when I realized that one can't change the size of a virtual disk with the VMware user interface. So I googled this problem, hoping to find an easy-to-use tool. What I found out was that the virtual disk can be resized on the command line using the VMware Virtual Disk Manager Utility. The documentation about this feature on the web is for VMware Workstation 4.5, but it also works with version 5.5 and also for VMware GSX Server.
The command to expand a virtual disk looks like this:
vmware-vdiskmanager -x 10GB myDisk.vmdk
The new size of the virtual Disk will be 10 GB in this example. myDisk.vmdk is the file of the virtual disk on the host system. Usually this file won't be located in the same folder as vmware.exe. Thus, you have to specify the full path to the vmdk file. Don't forget to enclose the path in quotation marks, if the folder names contain spaces. You can find vmware.exe in the VMware installation folder.
My second disappointment was that one can't expand a virtual disk if it contains snapshots. With a heavy heart, I deleted all my snapshots of this virtual machine. I was surprised how much time VMware needed for this. The size of the disk was 4 GB and I had three snapshots. I didn't measure the time, but it must have taken at least 15 minutes. This is amazing considering that it only takes a few seconds to create a snapshot.
Finally, I was able to expand the virtual disk. The virtual disk manager needed several minutes to enlarge the virtual disk to a size of 10 GB. Of course, you can only do this after you shut down the virtual machine. It is recommended that you backup the vmdk file first, just in case something goes wrong.
I was disappointed the third time when the Virtual Disk Management Utility eventually finished its task. Expanding the virtual disk was successful, but the tool suggested using a third-party tool to resize the partitions within the virtual disk. So basically I was back to where I started. I, now, had a bigger virtual disk, but the system partition of my virtual machine still remained the same size.
Luckily, I remembered that I have an old version of Partition Magic. Since my virtual disk was full, I had to create a second virtual disk on this virtual machine first to get some free space for Partition Magic. I suppose, you know that one can add a new virtual disk by changing the virtual machine settings. Partition Magic 7.0 had no problems enlarging the system partition on my VMware virtual disk.
Subscribe to 4sysops newsletter!
All in all, it took me about an hour to resize my virtual disk, including the search for a solution for my problem and the time to find my old Partition Magic. I guess I was a bit too optimistic with my five minutes estimation. I hope that future versions of VMware will offer more comfort here.
Read the latest IT news and community updates!
Join our IT community and read articles without ads!
Do you want to write for 4sysops? We are looking for new authors.
@wingnut
Even though the -flat file is the larger file, you want to point to the diskname.vmdk file.
This will tell the -flat file to expand.
It should go something like this:
Run the vmware-vdiskmanager utility:
Start>Run>type “cmd”
In the command window:
C:\Program Files\VMware\vmware-vdiskmanager –x 10Gb MyDisk.vmdk(vmware-diskmanager is normally under \Program Files\VMware)
you will see something like this:
C:\Program Files\VMware\VMware Workstation>vmware-vdiskmanager.exe -x 10GB G:\MS_VMs\winxp_pro_sp2\MyDisk.vmdk
Using log file C:\DOCUME~1\YourMama\LOCALS~1\Temp\vmware-YourMama\vdiskmanager.log
Grow: 100% done.
The old geometry C/H/S of the disk is: 8322/16/63
The new geometry C/H/S of the disk is: 16383/16/63
Disk expansion completed successfully.
To resize the VMDK you will need unbuntu desktop 6.04 iso image – just google for it…
follow the instructions below to resize
**i recommend creating a new one from your small one you want to expand just in case**
C:\Program Files\VMware\VMware Workstation>vmware-vdiskmanager.exe -r “PATH\yoursmalldisk.vmdk” -t 1 “PATH\yournewlargedisk.vmdk”
** you can specify the new size here **
C:\Program Files\VMware\VMware Workstation>vmware-vdiskmanager.exe -x 12Gb “PATH\yournewlargedisk.vmdk”
in VMWARE:
mount new sized hard disk as hd1
boot up using UNBUNTU live cd 6.04 desktop – just load the iso into the cd drive using vmware settings on the virtual machine
when it boots up, you may need to specify using the cd drive as the boot device by pressing F2 first.
after unbuntu starts,
Go to SYSTEM > Administration > GNOME Partition Editor
From the Partition menu, select RESIZE/MOVE after selecting the partition you want to grow
drag it to consume the new space you want to use
click RESIZE
Click APPLY checkmark
it will ask you if you are sure, say YES
click close
shutdown
remove the unbuntu live cd from your iso
reboot, windows will run CHKDSK – this is GOOD
windows starts, your space is available!!
thats it!!
The command to expand a virtual disk looks like this:
vmware-vdiskmanager -x 10GB “Path to Disk.vmdk”
f. ex.: “C:\VMachines\Windows XP Professional.vmdk”
The double quotes are required for the system to find the path to the virtual disk!
greetz
Thanks a lot very usefully tips! I had exactly the same problem…
Great tip:
“Don’t forget to enclose the path in quotation marks, if the folder names contain spaces.”
Of course I forgot about it and it did not work :-)…
Best Regards,
Djordje
Hi,
Creating a snapshot does take quite a short time because all VMWare does is to say that from now on everything written goes to a new snapshot.
Removing the previous snapshot takes some time because it has to merge the old snapshot with the state now. It’s copy-on-write.
I’d like to see this same tutorial expand the guest OS disk running linux.
1. Used the vmware-vdiskmanager -x 10GB myDisk.vmdk
2. Create a 2nd HDD the correct size you need.
3. Boot from CD, run Ghost to copy original HDD to new just created HDD, making it the correct size.
4. Ghost again back from the 2nd disk to the 1st disk making the partition the correct size.
5. remove created HDD.
6. Done, have a nice cup of tea.
Thanks for the info, I use it to expand my Ubuntu guest virtual disk.
Thanks! Worked great with WinXP as host and Vista as guest. Saved me lots of time!
Thank you, Michael! I was struggling more than a week to find the right tool for the last step of virtual disk resizing. Your hint to use partition magic saved me from desparation and is sooo easy in the end.
Used bullet point #24 posted by the theUtmost – worked like a charm! Upgraded my 10GB virtual disk to 25GB in less than 10 min. Who would have thought that Vista all by itself (with updates) could blast through 10GB???? Don’t answer that! Much thanks to theUtmost…………
Dear VMWare users,
I wanted to expand a virtual disk as well;
I had a 10GB virtual disk and I was out of diskspace. I tried to use the vmware-vdiskmanager, but I experienced a lot of problems.
But, I have the solution: Use VMWareConverter! With this tool you can choose for Convert Machine, and with the source type you choose ‘Other’. Than you browse to your virtual machine and click next. In the source data screen you choose the ‘Select volumes and resize to save or add space’ option. In the dropdown field below ‘New disk space’ you choose ”. Just follow the steps, wait till your virtual machine has completed its converting state and there you go! Your virtual disk has been expanded!
It works fine at my place without problems, but just in case I recommend you make a backup of your virtual machine first! Goodluck!
Jennifer, I did this, and although it appeared to work it didn’t really. Yes, VMware reports the disk to be the new size but Windows does not. Opening “My Computer” shows Drive C still to be the original size. Going into Disk Management is bizarre, because the bottom panel lists Disk0 as having the larger size but the top panel shows Drive C with the old capacity. There seems no way to increase Drive C to use the new space.
Peter (comment #42) — you need to use ntfsresize to enlarge the filesystem, as explained in http://weblogs.asp.net/kdente/archive/2006/01/07/434789.aspx, I think.
Not sure how you would use a Linux utility to resize a Windows VMware virtual disk.
Well it’s just an NTFS filesystem, it doesn’t matter which OS runs the tool that resizes it 🙂
Linux’s ntfsresize works fine on Windows NTFS partitions.
But I was wrong. With VMWare Converter 3.0.3 I was able to resize a VM without any trouble, the NTFS filesystem was automatically resized by the converter.
The easiest way that lets you resize is stated several times in this list.
The new 3.5 of ESX lets you increase the disk from inside the Virtual Center GUI. Or use the vmkfstools as this article suggests. Then just boot off the gparted iso and resize the disk. You need to remember to pick the right disk inside the gparted to resize and make sure you click the Apply button.
It does it’s thing and forces a chkdsk which you should let happen.
Voila…your virtual NTFS disk is bigger.
Jim
Guys,
Please follow suggestion#24. It is so easy, and it worked for me on VM Wkstn 6.5.0.
Basically what it does is it makes a copy of your virtual machine to a new one by giving you the option to change the size of the virtual disk throughout the process.
Just make sure you **DESELECT the default option “import all disks and maintain size” and select “select volumes and resize to save or add space” option.
The rest is a piece of cake just logical stuff you can’t go wrong.
Even if you did, you would have backed up your virtual machine anyway.
The wizard is available from the File menu of the VMware wkstn.
Best of luck,
Marcellin_NG
Hello,
For VMware, the extend may be done in different ways. The easiest scenario is when we want to expend non OS drive; for windows the diskpart do it smootly after extending the vmdk; for OS drives, I always use gparted without any problem.
to extend the vmdk, I use vmware-vdiskmanager.exe for workstation version, and vmkfstools for ESX; note that the path must not contain spaces (c:\toto\my vmdk file.vmdk) in this case don’t forget the double quotes “.
I wrote an post about that (sorry but in French) with a video demo if you want to see (http://www.ntsysv.com/index.php/tutoriel-video-extension-du-disque-systeme-machine-virtuelle-windows-2003)
I found that theUtmost’s instructions were spot-on. However, I wanted the simplest method possible which would allow me to retain my snapshots. In summary, I cloned the latest snapshot then imported the resulting VM.
Needless to say, EVERYTHING was copied somewhere safe first (to another disk, in my case), including the clone after it was created – I’m paranoid, what can I say?
Hey there.
Looks like there are a lot of people fasing same problems with disk sizes in VMWare.
Here are my simple few steps for resizing the bootable disk in a virtual machine running win 2003.:
My server info:
HP DL 360 running VMWare ESX Server 3i
HP MSA StorageWorks 2012i containing all system and data volumes.
Here is it:
1. Make sure you have enough free disk space to add later to the VM.
2. Shut Down the virtual machine.
3. Delete all snapshots of it.
4. Using VM Infrastructure Client right click the VM you want to edit and click Edit Settings.
5. Click on Hard Disk 1 and in the right pane increase the size of the disk.
6. Hit OK and Power ON the VM.
7. Now use a partition manager of your choise to add the unallocated disk space to your disk.
8. Enjoy 🙂
Excellent. Saved me 45 minutes!
Ran command: vmware-vdiskmanager -x 10GB myDisk.vmdk and then in Vista used the disk manager to extend to use newly allocated space and it all worked!
Hi! help me. I’ve a ESX sever 3.5 and few virtual station with Windows server 2003. I want to expand size hard disk on VM, but I can’t. This is what I’m doing in VMware Infrastructure Client:
– Select a VM
– Click on Edit Settings under Commands
– On the Hardware tab, select Hard Disk [x]. Observe the text box next to New Size: and that it is possible to enlarge this size. Add a few GB and select OK.
– I get an error like the following:
—————————-
Error
—————————
A general system error occurred: Internal error
—————————
OK
—————————
At other times it will look like the disk has been resized, but going back into the Edit Settings dialogue simply shows the original size again.
Any ideas?
P.S.
But in the other VM I can change size!
I solve problem. I remove all snapshots!