---
title: 'Shrinking a Linux Virtual Machine Disk with VMware'
url: 'https://www.kb.hills-family.uk/blog/shrinking-a-linux-virtual-machine-disk-with-vmware'
markdown: 'https://www.kb.hills-family.uk/blog/shrinking-a-linux-virtual-machine-disk-with-vmware.md'
date: '2021-05-17'
description: 'If you’ve used a Windows virtual machine under VMware (Workstation or Fusion, depending on your host OS), then you’d have probably noticed that the host virtualisation software cleans up the virtual machine disk once the virtual machine is shutdown. The clean up activity detects any unused space and reduces the sizes of the virtual machine disk within the host OS without affecting the guest OS. I have a number of Linux VMs but noticed that there was an increasing discrepency between the size of the used space form within the guest OS (via df -h) and the space consumed by the virtual machine disk. The reason? VMware doesn’t automatically run the clean up task once a virtual machine is shut down. If you’re running a Linux'
taxonomy:
  tag:
    - Linux
    - 'Virtual Machines'
    - VMware
---

# Shrinking a Linux Virtual Machine Disk with VMware

[ Home ](https://www.kb.hills-family.uk/)     [ Blog ](https://www.kb.hills-family.uk/blog)      Shrinking a Linux Virtual Machine Disk with VMware    

   17 *May*   
#### [Shrinking a Linux Virtual Machine Disk with VMware](https://www.kb.hills-family.uk/blog/shrinking-a-linux-virtual-machine-disk-with-vmware)

  [Linux](https://www.kb.hills-family.uk/blog/tag:Linux) [Virtual Machines](https://www.kb.hills-family.uk/blog/tag:Virtual%20Machines) [VMware](https://www.kb.hills-family.uk/blog/tag:VMware)  

If you’ve used a Windows virtual machine under VMware (Workstation or Fusion, depending on your host OS), then you’d have probably noticed that the host virtualisation software cleans up the virtual machine disk once the virtual machine is shutdown. The clean up activity detects any unused space and reduces the sizes of the virtual machine disk within the host OS without affecting the guest OS.

I have a number of Linux VMs but noticed that there was an increasing discrepency between the size of the used space form within the guest OS (via `df -h`) and the space consumed by the virtual machine disk. The reason? VMware doesn’t automatically run the clean up task once a virtual machine is shut down.

If you’re running a Linux virtual machine machine, the fix is straight forward: install `open-vm-tools` within your *guest OS* via `apt` or `yum` — whichever is your applicable to your Linux distribution — and then open the Terminal and run:

```bash
vmware-toolbox-cmd disk shrink /
```

You’ll see the virtual machine begin a clean up operation which is then handled by the host OS. The size of the virtual machine disk should now be of a similar size to that reported by the guest OS.

Thanks to [Jake Jarvis](https://jarv.is/notes/how-to-shrink-linux-virtual-disk-vmware/) for writing the original article from which this is based.

**Note:** If a virtual machine (either Windows or Linux) uses snapshots, then VMware is unable to shrink the disk. VMware recommends that snapshots are deleted (see [VMware support](https://docs.vmware.com/en/VMware-vSphere/6.0/com.vmware.vsphere.vm_admin.doc/GUID-A42FA14C-7D67-44A7-823B-854AA9F5FD3E.html))

 [ Next Post](https://www.kb.hills-family.uk/blog/overcoming-d365-f-and-o-fixed-width-character-file-limitations) [Previous Post ](https://www.kb.hills-family.uk/blog/duplicate-label-names-in-microsoft-dynamics-ax)

#### Knowledge Base

Tips, tricks and how-to guides on various topics.

#### Popular Tags

  [Linux](https://www.kb.hills-family.uk/blog/tag:Linux) [Dynamics AX](https://www.kb.hills-family.uk/blog/tag:Dynamics%20AX) [D365 Finance and Operations](https://www.kb.hills-family.uk/blog/tag:D365%20Finance%20and%20Operations) [Network](https://www.kb.hills-family.uk/blog/tag:Network) [Data Management Framework](https://www.kb.hills-family.uk/blog/tag:Data%20Management%20Framework) [Logic Apps](https://www.kb.hills-family.uk/blog/tag:Logic%20Apps) [JavaScript](https://www.kb.hills-family.uk/blog/tag:JavaScript) [netcat](https://www.kb.hills-family.uk/blog/tag:netcat) [SSH](https://www.kb.hills-family.uk/blog/tag:SSH) [PowerShell](https://www.kb.hills-family.uk/blog/tag:PowerShell) [Virtual Machines](https://www.kb.hills-family.uk/blog/tag:Virtual%20Machines) [VMware](https://www.kb.hills-family.uk/blog/tag:VMware) [SQL Server](https://www.kb.hills-family.uk/blog/tag:SQL%20Server) [Wireshark](https://www.kb.hills-family.uk/blog/tag:Wireshark) [Python](https://www.kb.hills-family.uk/blog/tag:Python) [Licensing](https://www.kb.hills-family.uk/blog/tag:Licensing) [Ubuntu](https://www.kb.hills-family.uk/blog/tag:Ubuntu)

---

## Navigation

- Parent: [Blog](https://www.kb.hills-family.uk/blog.md)
- Previous: [Overcoming D365 F&O fixed width/character file limitations](https://www.kb.hills-family.uk/blog/overcoming-d365-f-and-o-fixed-width-character-file-limitations.md)
- Next: [Duplicate label names in Microsoft Dynamics AX](https://www.kb.hills-family.uk/blog/duplicate-label-names-in-microsoft-dynamics-ax.md)
