Monday, December 15, 2008

Resize a hard disk within VMware Server

If you use VMware at all, and are like me and try too hard to save disk space, you've probably run into this before. You create a virtual machine with a small hard drive, and sooner than later you realize that you need more space available. It's a good thing that there is a pretty simple fix to that problem using some command line utilities that come with VMware server.

1. Stop your virtual machine. It can't be running while you do this.
2. Commit or remove any snapshots you may have
3.  Open a Windows command prompt
4. Use the command cd "C:\Program Files\VMWare\VMWare Server" and press Enter
5. Use the command vmware-vdiskmanager -x 12GB "My harddisk.vmdk"

That will expand the disk to however many GB you specify. Also, be sure to replace "My harddisk.vmdk" with the full path and name of your virtual disk.

Now that your disk is extended you'll have to use something like Partition Magic, or just diskpart.exe that comes with Windows. However, to use diskpart, you'll have to mount your newly expanded drive in a second virtual machine since it won't allow you to extend a boot volume directly. For more info on how to use diskpart.exe, see my earlier post here.

The original post that I found that contained most of this info can be found here

Update: If you're using VMWare Infrastructure Client and ESXi, there's a different method for resizing. The trick is to make sure your disk is set to Independent mode, with the Persistent option selected. Then you can the Shrink tab in your VMWare tools within your VM to resize the disk. One thing to note is that you can not use this method if there are any snapshots saved. You'll have to delete them before shrinking the disk, but that's all detailed in the VMWare article.

No comments: