Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My Dynamic VDI has occupied 56.2 GB space on the NTFS partition with Windows 7 Host. I am running a Ubuntu Server on the machine and it only occuipies 4.1 GB

Command: df -h Shows

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1             2.0T  4.1G  1.9T   1% /
none                  4.0K     0  4.0K   0% /sys/fs/cgroup
udev                  235M  4.0K  235M   1% /dev
tmpfs                  50M  512K   49M   2% /run
none                  5.0M     0  5.0M   0% /run/lock
none                  246M  4.0K  246M   1% /run/shm
none                  100M     0  100M   0% /run/user
/dev/sdb1             2.0T   11G  1.9T   1% /var/dev
/home/starx/.Private  2.0T  4.1G  1.9T   1% /home/starx

How to shrink this 56.2 GB to 4.1 GB which is the real size?

share|improve this question

The trick is to fill the unused space with zeros, then ask VB to shrink the disk.

Eg: as root in Linux: dd if=/dev/zero bs=1024k of=/bigfile; rm -f /bigfile

Then shut the machine down and run: VBoxManage modifyhd diskfile.vdi --compact

With most of the disk zero-filled it should shrink down to something close to 4GB.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .