Ticket #709 (closed defect: fixed)

Opened 10 years ago

Last modified 7 years ago

I can't compact linux guest VDIs efficiently

Reported by: cmuller Owned by:
Priority: major Component: virtual disk
Version: VirtualBox 1.5.0 Keywords: compact linux ext2 ext3
Cc: Guest type: other
Host type: other


I'm wondering if I'm the only one having this problem (?). Using the VBoxManage modifyvdi name.vdi compact command, and after zeroing the disk, I am able to always recover space on FAT32 partitions (Windows guests) but I could never succeed doing that with Linux guests, either on ext2 or ext3 partitions. I have being also zeroing them with dd if=/dev/zero or with the zerofree method described in the forums but nothing seems to work. On FAT32 I have a vdi which is maybe 10% bigger of what Windows tells as size. On ext2 it can be as bad as a partition containing 250 MB (that's what du and df say) gives me a 2GB VDI!! (after compacting). It's a / partition of a Debian/Etch minimum install and I zeroed it using a rescue iso disk. I really can't see what I'm doing wrong! Thanks for your help.

Change History

comment:1 Changed 10 years ago by shvelmur

I am having similar issues. I have a variable size hdd, with ubuntu (ext3), and the used size is around 400 MB, but the vdi is >4GB. Help!!!

comment:2 Changed 10 years ago by nvivo

I use Linux host, XP Guest, and I have this VDI with 10Gb in size that only has ~2Gb of data, and even if I defrag before, there is no differenct after compact.

Any updates on this?

comment:3 Changed 9 years ago by markba

Tested with Ubuntu JeOS as guest (ext3) on VB 1.5.4 and is resulted is doubling the vdi, from 750 MB to 1,5GB.

I want to make virtual appliances based on VB and Ubuntu JeOS, so this is very important to me because those appliances should be downloadable from internet and therefore, size matters (that's why I choose JeOS anyway).

comment:4 Changed 9 years ago by frank

  • Component changed from other to virtual disk

comment:5 Changed 8 years ago by cmuller

Well.. two years after.. I tried again using the dd if=/dev/zero method and *again* it failed! :-) but, but, but, then I discovered in the best tutorial ever this paragraph:

advocating a read-only remount followed by the use of the zerofree tool. (on Debian/Ubuntu: apt-get install zerofree)

and it just works! It is not as efficient as using FAT32 though.. but with the dd method I could go from 4GB to 3GB (for 400MB real :-( ) whereas with zerofree, I can get a 600MB vdi. We are still loosing about one third but it might have to be with how ext2/ext3 is designed.. anyway, it's much much better than GBs!

You can close this bug if you wish, or re-cast it in optimization of compact for Linux FS..

Thanks a lot TerryE for the tutorial!



comment:6 Changed 7 years ago by klaus

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.
ContactPrivacy policyTerms of Use