Shrinking a virtual disk reclaims unused space in the virtual disk and reduces the amount of space the virtual disk occupies on the host.
- 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 button 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 step 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.
Under some conditions, the ability to invoke 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.
Operating System Default Path Windows C:\Program Files\VMware\VMware Tools Linux and Solaris /usr/sbin FreeBSD /usr/local/sbin Mac OS X /Library/Application Support/VMware Tools
- Enter the command to list available mount points.
utility-name disk list
For utility-name use the guest-specific program name.
Operating System Utility Name Windows VMwareToolboxCmd.exe Linux, Solaris, and FreeBSD vmware-toolbox-cmd
- Enter the command to shrink the disk at a specified mount point.
utility-name disk mount-point
For mount-point, use one of the mount points displayed when you used the list subcommand.