Shrinking Disk Vmware Tools

Shrinking Virtual Disks with VMware Virtual Disk Manager If the virtual disk is located on a Windows host, you can use the virtual disk manager to prepare and shrink virtual disks. You cannot use the virtual disk manager to prepare or shrink virtual disks located on a Linux host. Step 2: Use VMware Tools to Defragment and Shrink Although VMware Workstation has options for mounting and shrinking a virtual disk via the Utilities button in the Virtual Machine Settings window, these options rarely have a significant effect on the virtual disk size. Vmware-toolbox Note: In Workstation 9.x (Windows) and later, shrinking is automatically done while cleaning up the disk. Therefore, this option is removed from VMware Tools Panel. Go to VM > Manage > Clean up Disks. This is not available in Linux version of VMware Workstation 9.x and later. Click the Shrink tab. Select the drive you want to shrink. The open-source version of VMware Tools for Linux, open-vm-tools, has added a simple command to automate the above steps in the latest version. Make sure you have the latest update through either apt or yum, and then run the following command in the guest terminal: vmware-toolbox-cmd disk shrink / Thank you to commenter Susanna for pointing. Shrinking Virtual Disks with VMware Virtual Disk Manager If the virtual disk is located on a Windows host, you can use the virtual disk manager to prepare and shrink virtual disks. You cannot use the virtual disk manager to prepare or shrink virtual disks located on a Linux host.

  1. Vmware Vsphere Shrink Disk
  2. What Are Vmware Tools
  3. Windows 7 Disc Vmware
  4. Vmware Tools Shrink

Vmware Vsphere Shrink Disk

After a year of provisioning Linux VMs with a new template, we have recently found that our default provisioned disk size is overkill, and the guests only need a fraction of the space we allotted. The VMs are thin-provisioned, but a year of I/O has caused the VMDKs to expand on the datastore... so a 50GB VM may be only using 10GB of space now, but the datastore footprint is still ~40GB.
The boilerplate answer is to shrink the VMDK... but these Linux VMs use an ext4 filesystem, which VMware does not support shrinking with their conventional tools (i.e. vmware-toolbox).
The Linux VMs are using LVM for partitioning, and I know the ways you can reduce a root filesystem in LVM... but from there I am fuzzy on the best way to get VMware to reclaim the unused space and resize the VMDK (or at least perform a shrink operation to reclaim datastore space).
I have found a number of possible workarounds online, but they all seem pretty ugly:
Shrink with gparted live CD, hack the .vmdk file and use vmkfstools: http://www.bonusbits.com/wiki/HowTo:Shr ... VMKFSTOOLS
Using VMware Converter to clone into smaller disks: http://www.techrepublic.com/blog/data-c ... converter/
Filling the free space with 0's and then using vmkfstools: http://www.virten.net/2014/11/howto-shr ... disk-vmdk/
Does anyone have experience using one of the above methods, or have an opinion on which is the most reliable? Our environment is vSphere 5.1.

Shrinking a virtual disk reclaims unused space in the virtual disk and reduces the amount of space the virtual disk occupies on the host.

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 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.

For your convenience, some newer versions of some VMware products include a button or menu command that performs the same function as the shrink-disk command. For example, Workstation includes a Compact menu command 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.

Vsphere

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.

Prerequisites

What Are Vmware Tools

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.

Windows 7 Disc Vmware

Procedure
Shrinking Disk Vmware Tools

Vmware Tools Shrink

Open a command prompt or terminal in the guest operating system.

2

Change to the VMware Tools installation directory.

Default Path

Windows

C:Program FilesVMwareVMware Tools

Linux and Solaris

/usr/sbin

FreeBSD

/usr/local/sbin

Enter the command to list available mount points.

For utility-name use the guest-specific program name.

Operating System

Windows

VMwareToolboxCmd.exe

Linux, Solaris, and FreeBSD

vmware-toolbox-cmd

4

Enter the command to shrink the disk at a specified mount point.

For mount-point, use one of the mount points displayed when you used the list subcommand.