Wednesday, February 20, 2008

Expanding a VMWare Virtual Disk

My primary OS is Linux but I have VMWare machines with Windows and other OSes, for testing of tools and softwares.

I keep a basic installation of the Windows OS (XP, Server, etc) in a VMWare machine and keep it updated and patched. Whenever I need to do a software evaluation, I simply use a copy of the basic installation. In this way, I don't spend time re-installing the basic OS for every test.



Today I was in the need to install various softwares which require several GB more than what I have pre-allocated in my basic installations. (I still does not understand what is with so many software coded for Windows the it requires to be installed on "C:". I have always found that so absurd!!! But that is not what I am talking about here.)

So, bottom line, I need to expand the Virtual Disk. After a short search I found that it is actually quite easy. Since I know I will be doing it again in the future I want to have it documented here:
  1. Stop the virtual machine
  2. Identify your virtual disk. Lets call it "mydisk.vmdk"
  3. VMWares have the Virtual Disk manager tool, so lets expand the disk to 20 GB. For that, you will have to do "vmware-vdiskmanager -x 20Gb mydisk.vmdk"
  4. You will see a progress indication showing you that it is doing what you ask.
  5. Once it finish you will need to make the host OS (in this case Windows) to recognize the new capacity of the Virtual Disk
  6. The easiest way to do this is to load the Virtual Disk as a secondary in another Windows VM
  7. Boot the Windows machine a run "diskpart" Windows utility
  8. Here, you can do "list disk" to see the actual disks assigned to your virtual machine
  9. Now identify your new volume "list volume" and select the proper one "select volume=#"
  10. Finally extend it executing the "extend" command
  11. Shutdown the VM and remove the disk.
  12. Boot the VM with the new extended hard disk.
  13. Done.
Following these simple steps you will be able to expand or decrease the size of a virtual hard disk of a VMWare Windows machine. A similar procedure is used with other OS except that you must identify the proper partition manager tool or third party tool.

A more detailed explanation is available here.

No comments:

Post a Comment