Shrinking a virtual disk reclaims unused space in the virtual disk and reduces the amount of space that the virtual disk occupies on the host.
About this task
Shrinking disks is not allowed under the following circumstances:
The virtual machine is hosted on an ESX/ESXi host. ESX/ESXi can shrink the size of a virtual disk only when a virtual machine is exported. The space occupied by the virtual disk on the server, however, does not change.
The virtual machine has a Mac OS X guest operating system.
You preallocated all the disk space to the virtual disk when you created it.
The virtual machine contains a snapshot.
The exception is if the virtual machine is used in VMware Fusion 4 and has a Windows guest operating system. In this case, you can use the Clean Up Virtual Machine feature in Fusion to shrink disks.
The virtual machine is a linked clone or the parent of a linked clone.
The virtual disk is an independent disk in nonpersistent mode.
The file system is a journaling file system, such as an ext4, xfs, or jfs file system.
Shrinking a disk is a two-step process. In the preparation step, VMware Tools reclaims all unused portions of disk partitions, such as deleted files, and prepares them for shrinking. This phase takes place in the guest operating system. During this phase, you can still interact with the virtual machine.
In the shrink step, the VMware application reduces the size of the disk based on the disk space reclaimed during the preparation step. If the disk has empty space, this process reduces the amount of space the virtual disk occupies on the host drive. The shrink step takes place outside the virtual machine and takes considerable time, depending on the size of the disk. The virtual machine stops responding while VMware Tools shrinks the disks.
Newer versions of some VMware products might include a button or menu item that performs the same function as the shrink-disk command. For example, Workstation includes a Compact menu item that you can use when the virtual machine is powered off. VMware Fusion 4 includes a Clean Up Virtual Machine button that can shrink disks even if you have snapshots.
Under some conditions, the ability to use a shrink-disk command might be considered a security risk. To configure a setting that disables the ability to shrink disk, see Threats Associated with Unprivileged User Accounts.
On Linux, Solaris, and FreeBSD guest operating systems, log in as root. If you shrink the virtual disk as a nonroot user, you cannot prepare to shrink the parts of the virtual disk that require root-level permissions.
On Windows guests, log in as an administrator.
Verify that the host has free disk space equal to the size of the virtual disk that you plan to shrink.
- Open a command prompt or terminal in the guest operating system.
- Change to the VMware Tools installation directory.
C:\Program Files\VMware\VMware Tools
Linux and Solaris
Mac OS X
/Library/Application Support/VMware Tools
- Type the command to list available mount points.
utility-name disk list
For utility-name use the guest-specific program name.
Linux, Solaris, and FreeBSD
- Type the command to shrink the disk at a specified mount point.
utility-name disk shrink mount-point
For mount-point, use one of the mount points displayed when you used the list subcommand.