Tech Line

Virtual Disk Dead End

Expand the size of a VMware virtual hard disk file when it runs out of space

Chris: When I first read your column "Supersizing Virtual SCSI Drives," I was hoping that your solution would solve my problem of having some virtual hard disk files that have reached capacity. Instead, I was disappointed to see that the article only covered how to add more virtual SCSI disks to an existing VM's configuration. If I just want to expand the size of a virtual hard disk file, what are my options?
— Mohammad

Tech Help—Just An
E-Mail Away

Got a Windows, Exchange or virtualization question or need troubleshooting help? Or maybe you want a better explanation than provided in the manuals? Describe your dilemma in an e-mail to the MCPmag.com editors at mailto:[email protected]; the best questions get answered in this column and garner the questioner with a nifty MCPmag.com baseball-style cap.

When you send your questions, please include your full first and last name, location, certifications (if any) with your message. (If you prefer to remain anonymous, specify this in your message, but submit the requested information for verification purposes.)

Mohammad, I completely understand the confusion. With virtual disk files, there are literally dozens of management problems that administrators may have to deal with. Among the top problems are scalability and performance. While my last column dealt with how to add additional virtual disks to a VM's configuration, sometimes it's necessary to just increase the size of a virtual hard disk file.

The way administrators have dealt with increasing the size of a virtual hard disk file in the past was to create a new larger virtual hard disk file and then use a third-party imaging tool such as Symantec Ghost to clone the original disk to the new disk file.

If you're looking for an alternate method, another approach is to use the VMware command line tool vmware-vdiskmanager.exe to increase the size of the existing virtual hard disk. Here's the general syntax for using this command for this purpose:

vmware-vdiskmanager.exe -x <new size> <virtual disk file>

Here's an example, in which running this command increases the size of the virtual disk file "H:\VMs\W2K3\IDE00.vmdk" to 6 GB:

vmware-vdiskmanager.exe -x 6GB "H:\VMs\W2K3\IDE00.vmdk"

If the existing virtual disk file has several GB of data on it, you might as well get up and grab a Snickers bar — you won't be going anywhere for awhile. Once the process completes, you can then boot up the VM and the new space will show up as unpartitioned space on the original disk. At this point, you can go in several different directions:

  • Back up all data on the original disk, delete all partitions on the original disk, create a new larger partition on the original disk and then restore the original data from backup.
  • Configure the existing partition to use the new space on the disk by running diskpart.
  • Configure the existing partition to use the new space on the disk by using a third-party disk partitioning tool.

The back-up approach is the slowest, but definitely the safest.

Another way to add the newly added space to the disk to the existing partition is by extending the partition using the diskpart command-line tool. This tool is available with Windows XP and Windows Server 2003. Diskpart does have its limitations, including not being able to extend partitions for boot or system volumes. For more on diskpart's limitations, see KB article 325590, "How to use Diskpart.exe to extend a data volume in Windows Server 2003, in Windows XP, and in Windows 2000." To extend the partition using diskpart, follow these steps:

  1. After the disk has been resized using vmware-vdiskmanager.exe and the VM boots up, open Disk Management. Verify that the newly added space appears as unallocated space on the disk.
  2. Now access the command prompt and run diskpart.
  3. Next, type the command list volumes. This will let you see the volume number that's associated with the volume you wish to extend.
  4. Locate the volume number associated with the drive you wish to extend, then type the command select volume <volume number>. For example, if you wanted to extend the E drive, which is associated with volume 2, you would enter the command select volume 2.
  5. Finally, to extend the logical volume so that it uses all unallocated space, you would type extend.
  6. Type exit to quit the diskpart utility.

At this point, you would have extended the volume to the size that was specified earlier by the vmware-vdiskmanager.exe command and it would be ready to use the new space. If the volume you need to extend is a system drive, then you can either use the first method mentioned (back up, delete and re-create disk partitions, restore), or you can use a third-party tool such as Acronis Disk Director to extend the existing partition. Many administrators have been dealt serious pain by third-party partitioning tools, so I would strongly recommend that you make a back-up copy of any virtual hard disk file that you plan to repartition using a third-party tool. This way, if something does go wrong you can always revert back to your original file.

Being able to extend virtual hard disks using vmware-vdiskmanager.exe can save you a lot of time when a virtual disk file has run out of space. While products such as Enzyte may have gotten the ball rolling with being able to extend objects, I'm glad to see that other vendors such as VMware are following their lead.

About the Author

Chris Wolf is a Microsoft MVP for Windows --Virtual Machine and is a MCSE, MCT, and CCNA. He's a Senior Analyst for Burton Group who specializes in the areas of virtualization solutions, high availability, storage and enterprise management. Chris is the author of Virtualization: From the Desktop to the Enterprise (Apress), Troubleshooting Microsoft Technologies (Addison Wesley), and a contributor to the Windows Server 2003 Deployment Kit (Microsoft Press).learningstore-20/">Troubleshooting Microsoft Technologies (Addison Wesley) and a contributor to the Windows Server 2003 Deployment Kit (Microsoft Press).

comments powered by Disqus
Most   Popular