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.

Avatar
Latest posts by Michael Pietroforte (see all)

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.

73 Comments
  1. Avatar
    Marina hot girl 18 years ago

    I never manged to resize them without problems.
    Resizing virtual Disks is a bit complicated. A back-up in such a case is a vry good Idea.

  2. Avatar
    Zaphod 18 years ago

    You can use DISKPART in Windoze in liue of Part. Mag.

  3. Avatar

    It seems that diskpart is not included anymore in the Windows Server 2003 Resource Kit. Was it replaced by another tool? The download link to diskpart on the Microsoft web site doesn’t work anymore. (Check this site for the Windows 2000 Resource Kit) So maybe, it is not advisable to use this tool with Windows Server 2003.

  4. Avatar
    Angelo 18 years ago

    Thanks for this valuable info. Saved me loads of time. Proves that these places realy do serve a purpose.

  5. Avatar
    Luke Plant 17 years ago

    You can also use the gparted LiveCD to resize partitions – just download the iso image and boot from it, you don’t need to actually create a CD. gparted works beautifully, and looks nice too.

  6. Avatar
    rolf 17 years ago

    Diskpart is now part of both w2k3 and wxp.

  7. Avatar
    Jim Nickel 17 years ago

    The other way I have done this is to simply add a 2nd disk and then let windows span the two partitions to make it look like one drive. In 2003 you can convert it to a dynamic disk no problem (2000 is a problem) and then let it span. Because it is not a physical drive, it doesn’t really matter and you can keep doing this as much as you like to get a bigger and bigger drive.

    Jim

  8. Avatar
    cozofdeath 17 years ago

    Thank you very much. I actually am in the same boat as you were then. Now I’m off to partition. Thanks!

  9. Avatar
    Sean Deasy 17 years ago

    Expanding a virtual VMWare disk is fair from straightforward especially if you are trying to expand the boot disk like me. I have put together a tutorial based on my experiences at http://www.seandeasy.com/expanding-a-drive-within-a-vmware-image/

  10. Avatar
    Jeff 17 years ago

    have read your article as recently I’ve had this problem myself. Here I found a good method to expand the disk without any third-party tools or additional OS: http://www.vmweekly.com/articles/expanding_the_virtual_disk_size_in_4_steps/1/

    Jeff

  11. Avatar
    Greg 17 years ago

    After using either vmksfstools or vdiskmanager, I use Gparted, a linux live boot CD. It’s free and works great.

    You can also use it the other way, if you need to shrink a VM. However, the only thing you’ll have to do in this scenario is to create a 2nd disk with the required space, and do a disk to disk copy.

    Cheers.

  12. Avatar
    fseal 17 years ago

    I have had success at resizing the boot disk in ESX 3.x as well. I found out the hard way, do not try this when you have already taken snapshots. The hosted server failed to boot. I had to delete the VM from inventory than point a “new” VM to the drive file. All changes after the first snapshot were lost.

    I bit the bullet that day.

  13. Avatar
    Rhodin 17 years ago

    1. Used the vmware-vdiskmanager -x 10GB myDisk.vmdk
    2. Booted the vm machine, with Hirens boot cd and launched Partion Magic and resized the partion and then rebooted the wmware machine.

    ETA 15 minutes.

    That was it for me 🙂

    Thank you.

  14. Avatar
    Rasmus 17 years ago

    1. Use vmware-vdiskmanager x
    2. Boot the VM with winPE iso image, run diskpart extend command
    3. boot VM and windows will tell you new HW has been installed. Reboot machine and you are ready to go.

    and its all using free tools 🙂

  15. Avatar
    Jeff Sepeta 16 years ago

    Using the VMWare graphical utility, I attempted to convert the vm image of my Win2k3 Domain Controller to an independent persistant file, but i’m not sure it worked quite as i had expected. I then went to the command prompt and attempted to use diskpart to extend by 1000mb but that was unsuccessful. any suggestions?

  16. Avatar
    Jim Eriksson 16 years ago

    I have used VMware Converter to convert the existing VM into one with bigger hard disk.

  17. Avatar
    James Cornell 16 years ago

    Jeff, that’s not the way to do it. Microsoft’s diskpart is for partitions, and NTFS does not resize with it. Vista finally includes NTFS resizing though, you’re supposed to use VMware Converter from inside the guest, using a remote mount (On the host is fine) and expanding it. Converter will let you expand “physical” machines even if they’re really just guests. I don’t use VMware Converter directly on .vmx/vmdk files, it doesn’t work right with Workstation 6.0. Physical to Virtual works every time.

  18. Avatar
    Arvi Saluste 16 years ago

    Vista “Disk Manager” allows to extend the volume, it took me 2 minutes to add 12GB of space 😀 (about 90% of it was vista shutdown and restart)

  19. Avatar
    frederik 16 years ago

    When running linux in a virtual machine, use the XFS filesystem if you expect resizing.

    XFS supports online resizing, even when the filesystem is “in use” or mounted, through the command xfs_growfs (device node). It actually took me under 5 minutes, including stopping and starting the virtual linux machine.

    Thank you for pointing out the commandline tool vmware-vdiskmanager.

  20. Avatar
    tuesday20102001 16 years ago

    I had a similar experience as you did. The article explains some thing, however there are some free or open source tools to help you partion or resize the disk and resizing the “virtual disk”. I used the following command to resize my disk in linux: sudo vmware-vdiskmanager -x 14Gb /vmware-distrib/share/Windows\ XP\ Professional/Windows\ XP\ Professional.vmdk

    after this completed, I change the boot options in vmware and changed it so that i was able to boot from live cd. I powered on the virtual machine with the disk I resized. Insert gparted live cd and choose boot. I change the basic boot option to select video card manually (I selected generic,which worked). Virtual disk is detected, resize the disk and apply. Done, now reboot the virtual machine and wait for windows to check the file system.

    Using these steps without research makes it a five minute or less process. Thanks for the article.

  21. Avatar
    theUtmost 16 years ago

    Folks as the author has pointed out, there is a much easier way to do this than the multistep procedure outlined above – using the vmware Converter tool.

    There is ALSO a way to do this using a standard vmware workstation v6 without any extra functions, addons or tools, or using any commandline tools. You do it all from the plain vanilla vmware GUI. I cannot vouch for earlier versions – you may need to use the vmware Converter tool.

    Use the VMware Import Wizard from the vmware GUI. Follow your nose through the wizard.

    Choose a “standalone virtual machine” as your source and point the wizard to your vm which has run out of space.

    The wizard will connect to the machine, and retrieve info like OS and disk info etc.

    The next step is the important one for your purposes here:
    Make sure to deselect the default option “import all disks and maintain size”. Instead you should choose to “select volumes and resize to save or add space”
    This will reveal an info panel showing the disks inside the old VM and their sizes and free space.
    Note the drop-down arrow in the “New Disk Space” column. Choose that, then select the option to “type size in GB” (or MB as your case may be) then type the required new size of the new VM disk to be created.
    It’s probably a good idea to leave the “ignore page file and hibernation file” setting selected.

    You then need to specify the destination machine type (ESX server/VirtualCenter VM or Standalone VM) then the target VM location and Virtual Machine name (yes, you must change these although the Windows machine name can stay identical). You also need to specify the destination VM format for compatibility purposes ie v6.x, v5.x or v4.5x.

    You can then choose whether the new VM disk will be pre-allocated (option to split into 2GB chunks) or allowed to grow.

    You then have an option to confirm VM network settings and finally can optionally customize all windows settings like Windows Hostname, and registered Owner/Organization , generate new SID (yes, it can run Sysprep!!), re-enter Windows Product ID, confirm Time Zone, change Workgroup or Join Domain.

    The wizard then provides a VERY brief overview of your settings (not enough to be useful really) with a Finish button at which point the Import/Conversion will start.

    This procedure worked fine for me with several different Virtual machines I had which had run out of space in a pre-allocated disk.

    There is no need to run vmware-diskmanager from command prompt, nor diskpart or another 3rd party partition manager tool at the end.
    Better yet, if you have multiple snapshots, you can keep whatever state you would like for the new VM, although the new VM will not be able to USE any of the snapshots in the old machine. However, you still have the original VM machine unaltered as a backup.

    Time taken seemed to be about what I would expect for a file copy of the total # GBs involved in my setup. I have not found any drawbacks at all, except for the obvious one of needing enough HDD space to store both sets of virtual disk images.

    If anyone from vmware support happens across this page, please note that all the people above would probably benefit from inclusion of a GUI tool inside vmware (more obvious than the Import routine I describe) to do just this sort of function.

    A tool similar to that provided by “RDPetruska” would be ideal if incorporated into vmware:
    http://petruska.stardock.net/software/VMware.html#DiskFactory

  22. Avatar

    @thUtmost That seems to be an interesting solution for this problem. I will try it when I have to enlarge a virtual disk the next time. Thanks a lot for your time.

  23. Avatar
    Denton Real Estate 16 years ago

    I tried Utmost’s solution and it worked fine. Fairly straight-forward, low risk and most importantly, free.

    It took me about 15 minutes to move a full 8GB VM into a 20GB VM. My Windows machine had to rediscover several devices which I thought was odd, but it all worked out alright in the end.

  24. Avatar
    wingnut 16 years ago

    GRRR anyidea I just does not seem to work on my machine, I’ve tried putting the whole C: ect in quotes as well but that does not work

    C:\Program Files\VMware\VMware Server>vmware-vdiskmanager -x 128GB C:\Virtual Ma
    chines\Windows Server 2003 Standard Edition-flat.vmdk
    Diskname or some other argument is missing.

  25. Avatar
    theUtmost 16 years ago

    @Denton Real Estate.
    Yes, that will happen, since the volume ID of the virtual disk used by your Virtual Machine will be changed by the process.
    This is similar to using Ghost to clone a windows installation from your original 8Gb HDD onto a 20Gb HDD. Windows knows the HDD has changed, so it will detect that change. So long as the HDD doesn’t require a different HAL driver you will be ok (eg IDE vs SATA RAID vs SCSI).

    Cautionary note here:
    Be aware that if you make too many changes in your hardware too quickly, and depending on your version, you may be required to re-activate Windows. The Windows activation is tied to serial numbers of several bits of hardware, one of which is the HDD.
    I have not actually had a problem with this, it’s just something I mention here so you’re aware of it.

    @wingnut
    If you’re having trouble with the vdiskmanager commandline, have you tried the method I outlined under comment #24?

Leave a reply

Please enclose code in pre tags

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account