Search the VMware Knowledge Base (KB)
View by Article ID
Growing, thinning, and shrinking virtual disks for VMware ESX and ESXi (1002019)
This article provides information on resizing of virtual disk files. You may find yourself in a situation where you need to either:
- Expand a virtual disk to store more data
- Thin an existing large virtual disk so it consumes less datastore space, without actually shrinking the virtual disk
- Shrink a virtual disk, if it is too large
- Decrease the size of a virtual disk
Currently, three major operations are supported by VMware Converter - Expanding, Thinning, and Shrinking.
Note: Thinning and expanding of virtual disks can be also accomplished by vmkfstools.
Warning: An effective backup strategy should always be used before performing permanent changes to existing virtual disks.
- Cloning, importing, and converting virtual disks should leave the source files unmodified.
- In addition to the cloning, importing, and converting of a virtual disk, related source-disk snapshot files will be committed to the destination disk when cloning, importing, or converting. However, the original virtual disk and associated snapshots remains unmodified in the original directory.
- Do not alter the base disk in any way without committing all snapshots first or they will be invalidated.
- Changes cannot be made to a disk in use or locked.
- Use VMware Converter, as it streamlines and simplifies the process, further, eliminating some areas where user error can occur.
Note: When using the VMware Converter wizard, you can perform operations on running virtual machines by treating them as physical machines. For more information, see the VMware vCenter Converter Administration Guide for your VMware product version.
Expanding Virtual Disk
Virtual disks can be expanded using this ESXi/ESX command:
vmkfstools -X <new size> <virtual disk>.vmdk
For example, use this command to grow the virtual disk to 25GB in size:
vmkfstools -X 25g /vmfs/volumes/xxxx/vmname/vmname.vmdk
Changes are made to the disk and are almost instant.
Partitions residing within the virtual disks will not resize and there will be unallocated space at the end of the disk.Third-party partitioning tools are required at this point to resize the primary partition to take advantage of the additional space.
VMware Converter allows you to specify a new disk size in its conversion wizard. It will also take care of partition resizing for you.
For more information about VMware Converter, see the VMware vCenter Converter Administration Guide for your VMware product version.
Some virtual machine guest operating systems may require a reboot to detect changes to the size of the virtual disks.
Virtual disks can be thinned so they consume only as much space as there is data residing in the .vmdk.
Thinning is currently possible using VMware Converter and hosted products, such as VMware Workstation. For more information, see the VMware vCenter Converter Administration Guide for your VMware product version.
In the event that a thinned virtual disk continues to use more space than the operating system residing within it reports, old data in the volume still needs to be zeroed or removed.
Deletion of files in most file systems will not completely remove them; merely file tables will be altered. Use of freeware secure file deletion utilities are useful, such as Eraser or SDelete to zero out the space to 'zero' the free space on the volume, effectively clearing the free space of data. It is then, that the disk can be properly thinned. You can then use the vmkfstools -K command (ESXi/ESX 4.1 and later) to complete the block reclaim or use Storage vMotion to migrate the virtual machine to a datastore with different VMFS block size.
For process limitations and details, see Storage vMotion to thin disk does not reclaim null blocks (2004155).
Note: The preceding link was correct as of March 18, 2014. If you find the link is broken, provide feedback and a VMware employee will update the link.
- Virtual disk shrinking is supported when using VMware Converter converting source virtual machine as a machine source (not as virtual to virtual).
Note: You cannot shrink virtual disks using vmkfstools in ESXi as the hypervisor is not aware of the file system layout and cannot ensure a safe shrink operation.
- Migrate the data away from the end of the disk consume to ensure the data is not lost (because the disk area is effectively removed). For example, in Windows GuestOS use Disk Management tool.
- Shrink the partition residing within a disk before reducing the size of a virtual disk.
- Non operating system disks users can also add a new smaller VMDK to the virtual machine and copy the data between the larger and new smaller disk using tools within the guest such as Robocopy.
For translated versions of this article, see:
For translated versions of this article, see:
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.