Adding space to an ESXi/ESX host virtual disk
search cancel

Adding space to an ESXi/ESX host virtual disk

book

Article ID: 344375

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

This article provides instructions on extending or expanding the size of an ESXi/ESX host virtual disk.


Environment

VMware ESX Server 2.1.x
VMware vSphere ESXi 5.0
VMware ESXi 4.0.x Installable
VMware ESX Server 3.0.x
VMware ESXi 4.1.x Installable
VMware ESX Server 2.5.x
VMware ESX Server 1.x
VMware ESX Server 1.5.x
VMware ESX 4.0.x
VMware ESX Server 3.5.x
VMware ESX 4.1.x
VMware ESX Server 2.0.x
VMware vSphere ESXi 5.1
VMware ESXi 4.1.x Embedded
VMware ESXi 3.5.x Embedded
VMware ESXi 4.0.x Embedded
VMware ESXi 3.5.x Installable
VMware vSphere ESXi 5.5

Resolution

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.
For more information on using vmkfstools, see Using vmkfstools in the following 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] # [gGmMkK]


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 resizing a base virtual machine disk (VMDK) that is part of a snapshot hierarchy (1646892)


Use thevmkfstoolscommand 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) org(gigabytes), respectively.
For example, to increase the size of an existing Windows 2000 virtual disk on ESX Server 2.x, execute this command:
[root@esxhost]# vmkfstools -X 8000m vms:win2000.vmdk

This example expands the virtual disk file namedwin2000.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 .dskextensions.


For ESX 3.x and later, you must specify the location of the.vmdkfile or issue the command while in the directory containing the file. Always specify the virtual disk descriptor file with thevmkfstoolscommand. For example:
[root@esxhost]# vmkfstools -X 8000m /vmfs/volumes/storage1/win2000/win2000.vmdk


To extend a virtual disk that was initially created with EagerZeroedThick format, run this command:

vmkfstools -X #[gGmMkK] -d eagerzeroedthick /vmfs/volumes/datastore/file.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.vmdkfile. 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 may 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.

    Note: If a cluster node virtual machine powers off due to a growing disk, messages similar to the following may be reported in vmware.log. This can also occur when growing a non-shared disk. If any bus is shared in the virtual machine, then you cannot grow any disk in the virtual machine while it is running.

    2012-08-09T09:18:48.650Z| vcpu-0| [msg.disk.notCheckpointed3] Resuming virtual disk scsi1:1 failed. The disk has been modified since a snapshot was taken or the virtual machine was suspended.
    2012-08-09T09:18:48.650Z| vcpu-0| [msg.checkpoint.continuesync.fail] An error occurred while restarting virtual machine after taking a snapshot. The virtual machine will be powered off.


Additional Information

For translated versions of this article, see: