VMware Communities
dontbyte
Contributor
Contributor
Jump to solution

Thinning virtual machine with Ubuntu 64 bit

Hi there,

according to Ubuntus "Disk Usage Analyzer" (baobab) 20,7GB of 76GB are in use at the moment (see attachments) but the VMware directory somehow is around 79 GB.

I already tried the disk utilities "Defragment" and "Compact" but sadly with no success.

Any ideas how to shrink the used disk space of the VM?

Setup:

VMware Workstation 12 Player V12.1.0 buid-3272444

Ubuntu 16.04 LTS 64-bit with 76 GB disk space

Thanks in advance!

Reply
0 Kudos
1 Solution

Accepted Solutions
wila
Immortal
Immortal
Jump to solution

Hi,

There are several ways to do this.

The more elaborate way is to zero out the virtual disk and then run vmware-vdiskmanager to reclaim the wiped out space.

As explained here:

Shrink guest on hosted platform - VI-Toolkit

If you have vmware tools installed however then there's another way.

run

$ sudo vmware-toolbox-cmd disk shrink /

The "/" should point to the partition that you want to shrink.

Note that you should not have any snapshots open or it will not work.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva

View solution in original post

7 Replies
dontbyte
Contributor
Contributor
Jump to solution

One more info: I also tried to wipe free disk space inside Ubuntu with BleachBit.

Reply
0 Kudos
wila
Immortal
Immortal
Jump to solution

Hi,

There are several ways to do this.

The more elaborate way is to zero out the virtual disk and then run vmware-vdiskmanager to reclaim the wiped out space.

As explained here:

Shrink guest on hosted platform - VI-Toolkit

If you have vmware tools installed however then there's another way.

run

$ sudo vmware-toolbox-cmd disk shrink /

The "/" should point to the partition that you want to shrink.

Note that you should not have any snapshots open or it will not work.

--

Wil

| Author of Vimalin. The virtual machine Backup app for VMware Fusion, VMware Workstation and Player |
| More info at vimalin.com | Twitter @wilva
dontbyte
Contributor
Contributor
Jump to solution

That worked perfectly:

$ cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill

  1. $ sudo vmware-toolbox-cmd disk shrink / 

THANK YOU!

Reply
0 Kudos
setuid
Contributor
Contributor
Jump to solution

Just a quick heads-up that using the following construct, hasn't been valid for the last few years, as `open-vm-tools` does not include the functionality of this command, and VMware has deprecated the use of VMware Tools in VMs for everything except Windows for just as long.

$ sudo vmware-toolbox-cmd disk shrink /
Reply
0 Kudos
RaSystemlord
Expert
Expert
Jump to solution

That's a pity if such a tool is missing from Player Linux-versions.

If you really need to do this, you could use evaluation version of VMware Workstation to achieve this. A slightly ugly way of doing this, but possible. You could also do this with Windows and then continue with Linux. Unfortunately, you cannot do this using directly an USB-disk, because since Ubuntu 18.04 (if we talk about LTS versions), VMware does not work with NTFS on Linux (another, long thread for this - obviously a longer story). But anyway, copies work.

Reply
0 Kudos
scott28tt
VMware Employee
VMware Employee
Jump to solution

You could try accessing the VMware Tools files in the repository to see what exists for your guest OS: https://packages.vmware.com/tools/releases/latest/

 


-------------------------------------------------------------------------------------------------------------------------------------------------------------

Although I am a VMware employee I contribute to VMware Communities voluntarily (ie. not in any official capacity)
VMware Training & Certification blog
Reply
0 Kudos
RaSystemlord
Expert
Expert
Jump to solution

Only ancient ones are available there. Ubuntu 12.04, original release data 2012 is the latest.

For Ubuntu Long Term Support (LTS) versions, 5 years is the life of them. Nobody wants to use older, because there is no reason (this is or used to be different with Windows), only security risks are involved.

Reply
0 Kudos