Contents

Previous Next

Defragmenting and Shrinking Virtual Disks
If you have a virtual disk that grows as data is added, you can defragment and shrink it as described in this section. If you allocated all the space for your virtual disk at the time you created it, you cannot defragment and shrink it.
Defragmenting Virtual Disks
Defragmenting disks rearranges files, programs and unused space on the virtual disk so that programs run faster and files open more quickly. Defragmenting does not reclaim unused space on a virtual disk; to reclaim unused space, shrink the disk.
For best disk performance, you can take the following three actions, in the order listed:
1. Run a disk defragmentation utility inside the virtual machine.
2. Power off the virtual machine, then defragment its virtual disks from the virtual machine settings editor (VM > Settings). Select the virtual disk you want to defragment, then click Defragment.
Note: This capability works only with virtual disks, not with raw or plain disks (plain disks are a feature of older VMware products).
3. Run a disk defragmentation utility on the host computer.
Defragmenting disks may take considerable time.
Note: The defragmentation process requires free working space on the host computer's disk. If your virtual disk is contained in a single file, for example, you need free space equal to the size of the virtual disk file. Other virtual disk configurations require less free space.
Shrinking Virtual Disks
Shrinking a virtual disk reclaims unused space in the virtual disk. If there is empty space in the disk, this process reduces the amount of space the virtual disk occupies on the host drive. You cannot shrink preallocated virtual disks or physical disks.
Shrinking virtual disks is a convenient way to convert a virtual disk to the format supported by GSX Server 3. Virtual disks created in the new format cannot be recognized by earlier VMware products except for VMware Workstation 3.0 and higher.
The virtual disks to be shrunk must not be booted as independent disks. You can change the mode of a virtual disk before the virtual machine is powered on. See Independent Disks.
Shrinking requires free disk space on the host equal to the size of the virtual disk being shrunk.
Shrinking a disk is a two-step process: in the first step, called wiping, VMware Tools reclaims all unused portions of disk partitions (such as deleted files) and prepares them for shrinking. This allows for the maximum shrink possible. Wiping takes place in the guest operating system.
The shrink process itself is the second step, and it takes place outside the virtual machine. GSX Server reduces the size of the disk based on the disk space reclaimed by the wipe process. This step occurs after the wipe finishes preparing the disk for shrinking.
When a virtual machine is powered on, you shrink its virtual disks from the VMware Tools control panel. You cannot shrink virtual disks if a snapshot exists. To remove an existing snapshot, choose Snapshot > Remove Snapshot.
In a Linux or FreeBSD guest operating system, to prepare virtual disks for shrinking, you should run VMware Tools as the root user. This way, you ensure the whole virtual disk is shrunk. If you shrink disks as a non-root user, you cannot wipe the parts of the virtual disk that require root-level permissions.
1. To launch the control panel in a Windows guest, double-click the VMware Tools icon in the system tray or choose Start > Settings > Control Panel, then double-click VMware Tools.
To launch the control panel in a Linux or FreeBSD guest, become root (su -), then run vmware-toolbox.
2. Click the Shrink tab.
3. Select the virtual disks you want to shrink, then click Prepare to Shrink.
Note: If you deselect some of the partitions to wipe, the whole disk is still shrunk. However, those partitions are not prepared for shrinking, and the shrink process does not reduce the size of the virtual disk as much as it could otherwise.
4. When VMware Tools finishes wiping the selected disk partitions, you are prompted to begin shrinking the disks.
Shrinking disks may take considerable time.
In some configurations, it is not possible to shrink virtual disks. If your virtual machine uses such a configuration, the Shrink tab displays information explaining why you cannot shrink your virtual disks. For example, you cannot shrink a virtual disk if:
  • You preallocated disk space when you created the disk, which is the default option for both typical and custom virtual machine creation paths.
  • The virtual machine has a snapshot.
  • The virtual machine contains physical (raw) disks.
  • The virtual disk is not an independent disk in persistent mode. For more information, see Independent Disks.
  • The virtual disk is stored on a CD-ROM.

  • Previous Next