Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

My Ubuntu image VMware disk has grown to 5GB physical file size. It's a dynamically growing disk with the maximum capacity of 8GB. I cleaned some stuff inside Linux distro and now inside it occupies 3GB. Obviously the physical file size didn't shrink back automatically. Is there a way (if possible free of charge) to shrink this disk back to ~3GB?

I need this to fit the image on the DVD.

share|improve this question

3 Answers 3

up vote 9 down vote accepted

I've found the solution – you have to compact your hard drive:

Virtual Machine - Settings - General - Clean Up Virtual Machine

share|improve this answer
    
Wow. Finally I found this answer. But... why compacting the virtual disk doesn't actually reclaim the free space? –  Lorenzo Feb 12 at 16:19
    
You need to do this from within the guest Ubuntu OS (assuming you have VMware Tools installed): "vmware-toolbox-cmd disk shrink /" which should do the job. –  DH4 Jun 12 at 17:06

Open VMware Toolbox in the guest (as root) and shrink the disk. (Documentation)


If you don't have VMware Tools, you can shrink the disk manually in two steps. First, clear the free space on the virtual disk using a tool like zerofree. Zerofree is available in Ubuntu, but since it requires the guest OS filesystem to be mounted read-only you may want to run it off a live CD. Parted Magic reportedly includes zerofree.

After zeroing the free space, open Virtual Machine Settings and compact the virtual disk.

share|improve this answer
2  
The vmware toolbox UI is no more, but you can still use: "vmware-toolbox-cmd disk shrink /" which should do the job. –  DH4 Jun 12 at 16:52

VMWare harddisk resizing:

Expanding the dynamic virtual harddisk in VMWare is easy and does no longer require the command line tool vmware-vdiskmanager.exe located by default in C:\Program Files\VMware\VMware Workstation\ .

For resizing use the following command (Open a command prompt by pressing WIN+R and enter cmd): "C:\Program Files\VMware\VMware Workstation\vmware-vdiskmanager.exe" -x NEWSIZE "diskname.vmdk"

Procedure:

The following steps are:

  • Download here
  • Install
  • Open
  • Choose the partition, Click Resize/Move, Drag the handle to its full width
  • Click Apply
  • Agree to reboot
  • During startup, do not press any key whatsoever
  • Let the boot-up module perform its task
  • Check that your Windows system partition size increased.

For a visual rundown of the steps and additional info, see here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.