Virtualization affords the ability to easily make changes to virtual hardware. You can easily add or remove CPUs,...
memory disk and network interface cards (NICs) at any time by shutting the virtual machines (VMs) down and changing their settings. But how do you increase or decrease an existing disk's size? In this article we will cover several methods for re-sizing your virtual hard disks.
VMware Converter: It's like a partition do-over
Discovering that the virtual disk file that you originally created for your VM is no longer large enough is a common problem. More disk space can be always be achieved by adding an additional virtual hard disk, but then you will end up with a second disk partition and drive letter which may not be desirable. You may also find that the disk file that you created for your VM is far too large. Thus, you will want to shrink it to reclaim space on your host server for other VMs to use.
One of the simplest methods to either increase or decrease the size of an existing virtual disk is to use the free VMware Converter utility. When you run the utility it gives you the option to re-size the existing disks so they are either larger or smaller than the original disks. Converter doesn't modify the original disk files; rather it creates a new VM with virtual disks that are the size you specified and copies the data from the original VM to the newly created VM. After you verify that the new VM is working, you can delete the original VM.
Follow these steps to use VMware Converter to re-size your disks:
- Download and install Converter on the VM you wish to re-size. Also, you can run Converter remotely if you have the Enterprise version.
- Select your Source Type, either "Physical machine," if you are running it directly on the VM or "ESX Server or VirtualCenter virtual machine," if you are running it remotely.
- On the Source Login screen select either "This local machine" if you are running it directly on the VM, or your ESX/VC server login if you are running it remotely. In addition select the source VM if you are running it remotely.
- When the Source Data screen appears it will display all the disks that the VM has assigned to it. Here is where you can resize your disks, choose to select volumes and re-size and then select one of the options, (i.e. 'Type Size in GB') and enter a new size. If you are decreasing the size of the disk you must enter a value larger then the total amount of disk space that is currently in use on the disk. For example if you had 8GB of data on a 24GB disk on your original server, you must enter a value greater then 8GB for the new size.
- Next, select a Destination ESX host which will typically be the same host as the source the VM is on. Then assign a name for the VM (name must be different from the source, you can rename it afterwards once you delete the source server), then select a data store to put the VM on, a network for the VM and finally click Finish to begin the process.
- The time it takes to complete will vary based on how much data is stored on the source server. Once it completes you can power off your source VM, power on the newly created VM and verify that it is working correctly. Afterwards you can delete the original source VM and rename the new VM to match the original name.
Changing disk size with vmkfstool
The next method, which is to only increases disk size, involves using a command line utility called vmkfstools. If you are running ESX 3.5, however, you can now also use the VI Client. Older versions of ESX 2.x allowed you to use the vmkfstools command to reduce the size of a disk file, but the ability to do this was removed from it in ESX 3.x.
Increasing the size using vmkfstools:
- Power off the VM.
- Log in to the ESX Service Console.
- Switch to the VM's working directory where the disk file is located.
- Type "vmkfstools, followed by the virtual disk filename, then –X, and finally place the new disk size you want to implement followed by a G. (ie. "vmkfstools myvm1.vmdk –X 12G"). You can also specify the new disk size in kilobytes or megabytes by using "K" or "M" instead of "G."
Increasing the size using the 3.5 VI Client:
- Power off the VM.
- Edit the settings of the VM with the VI Client.
- Select the hard disk that you want to increase and under Capacity enter a new size.
- Click OK.
Once you have increased the size of your disk power on the VM, go into the disk management utility and ensure that the new disk space is visible to the operating system (OS). The additional space will show up as separate unallocated space on your existing virtual disk.
Now that we've successfully increased the size of your virtual disk it's time to change the existing partition's size to include the extra space. Part two of this article will cover how to extend your operating system partition to include the newly added unallocated space to it. We will cover two different methods for accomplishing this.
ABOUT THE AUTHOR: Eric Siebert is a 25-year IT veteran with experience in programming, networking, telecom and systems administration. He is a guru-status moderator on the VMware community VMTN forums and maintains VMware-land.com, a VI3 information site.