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.
- 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
- Automatically mount an NVMe EBS volume in an EC2 Linux instance using fstab - Mon, Feb 21 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.