Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Adding space to an ESX host virtual disk

Solution

Notes: Before you begin, see Restarting the Management agent on an ESX or ESXi Server (1003490) for important information on restarting the mgmt-vmware service.

The command-line utility
vmkfstoolsallows you to extend or expand the size of an ESX host virtual disk.
Refer to Using vmkfstools in these documents:
The following vmkfstools command can be used to extend a virtual disk file to the new specified length:

vmkfstools [-X | --extendfile] #[gGmMkK]

For ESX/ESXi 4.1 and 5.0:

vmkfstools [-X | --extendvirtualdisk] #[gGnMkK]

Caution:
This operation makes fundamental, irreversible changes to the virtual machine's disk. VMware strongly recommends making a complete backup of this virtual machine before attempting this operation.
 
Warning: In current versions of ESX/ESXi 2.5, 3.x, 4.x, and ESXi 5.x, do not extend a disk that has snapshots. Commit or discard snapshots before increasing the size of the virtual disk. Extending the size of a virtual disk that has snapshots invalidates the snapshots. Sometimes the Snapshot Manager reports inaccurate information about the existence of snapshots; the best way to know if the virtual machine is using snapshots is to check what the .vmx is pointing to. For more information, see Determining if a virtual machine is using snapshots (1004343). If the base disk has already been extended underneath a snapshot tree, see A virtual machine cannot boot after extending a base virtual disk that is part of a snapshot hierarchy (1646892).
 
Use the vmkfstools command to extend the size of a disk allocated to a virtual machine, after you have created the virtual machine. The virtual machine that uses this disk file must be powered off when you enter this command. Also, the guest operating system must be able to recognize and use the new size of the disk, for example, by updating the file system on the disk to take advantage of the extra space.

You specify the size in kilobytes, megabytes, or gigabytes by adding a suffix of k(kilobytes), m(megabytes) or g(gigabytes), respectively.

For example, to increase the size of an existing Windows 2000 virtual disk on ESX Server 2.x, execute the following command:
[root@esxhost]# vmkfstools -X 8000m vms:win2000.vmdk
This example expands the virtual disk file named win2000.vmdk that is stored on a VMFS2 volume named vms to a size of 8GB.
 
Note: You must specify the size you want like to Extend To and not how much you want like to Extend By. Otherwise, the disk shrinks to the new smaller size and data inside the VMDK file might get corrupted. This is not the case with ESX 3.5.0 where vmkfstools -X allows only growing the disk but not shrinking.
 
This is an example from ESX 3.5.0 showing a failed attempt to extend disk to smaller size than the current vmdk size:
-rw------- 1 root root 392 Apr 16 14:17 slax.vmdk
-rw------- 1 root root 2.0G Apr 16 13:47 slax-flat.vmdk
[root@localhost slax]# vmkfstools -X 800M slax.vmdk
Failed to extend disk : One of the parameters supplied is invalid (1).
[root@localhost slax]#
Note: ESX 2 virtual disks may optionally use .dsk extensions.
 
For ESX 3.x, you must specify the location of the .vmdk file or issue the command while in the directory containing the file. Always specify the virtual disk descriptor file with the vmkfstools command. For example:
[root@esxhost]# vmkfstools -X 8000m /vmfs/volumes/storage1/win2000/win2000.vmdk
After expanding the disk file, you must run a partition manipulation tool such as PartitionMagic, Volume Manager or ServerMagic in the virtual machine to expand the partition seen by the virtual machine guest operating system into the newly created space on the virtual disk.
 
For examples of third party utilities that can be used as an alternative to diskpart, see Increasing the size of a disk partition (1004071).
 
Notes:
  • You may need to restart the management services for the changes to be visible in VirtualCenter and the Virtual Infrastructure Client (mgmt-vmware). If this fails, check the size of the .vmdk file. If the file has been extended and the change is not reflected, try removing and re-adding the .vmdkfile to the virtual machine.
  • Some older ESX 2.x files might have a .dskfile extension instead of a .vmdkfile extension.
  • ESX 3.5.0 does have this disk extending feature already in GUI accessible in Virtual Machine Properties.
  • In the GUI of ESX 3.5.0, when extending the size on a virtual machine with snapshots, the task Reconfigure Virtual Machine does finish as Completed but the disk is not extended. This prevents corruption of the snapshots.
  • Growing virtual disks larger than 1TB using the GUI interface in ESX 3.5 can fail. Growing virtual disks with the command line works without issue. This issue was resolved in ESX 4. For more information, see Cannot extend a vmdk over 1TB (1008528).
  • If growing a virtual disk fails using the GUI please verify the disk has no snapshots, bus sharing in the virtual machine is set to None and that there is sufficient disk space on the datastore.

Update History

02/01/2012 - Added links for vmkfstools ESX/ESXi 4.1/5.0 02/01/2012 - Added syntax for vmkfstools ESX/ESXi 4.1/5.0 02/16/2012 - Updated Products section

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback


Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
Actions
KB: