Compacting guest OS Ubuntu running on Hyper-V

Submitted by Jochus on Sat, 20/02/2016 - 16:22 | Posted in: Windows

  • Power down your Ubuntu virtual machine
  • Download SystemRescueCd from
  • Attach the .iso to the Ubuntu virtual machine
  • Start the Ubuntu virtual machine and make sure you boot from CD/DVD
  • Root into your system. Once logged in, execute the command zerofree on your partition (this can take several minutes!). E.g.:
    $ zerofree /dev/sda1
  • Stop the Ubuntu virtual machine
  • Compact the Ubuntu virtual machine in your host Windows OS. Edit disk > Compact

Add new comment

The content of this field is kept private and will not be shown publicly.


  • Lines and paragraphs break automatically.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.
  • Web page addresses and email addresses turn into links automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <cpp>, <css>, <html5>, <java>, <javascript>, <php>, <sql>, <xml>. The supported tag styles are: <foo>, [foo].
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.