Compacting VirtualBox Disk Images - Linux Guests
- Start the Linux virtual machine;
-
Clean the free space on the disk of the Linux virtual machine;
dd if=/dev/zero of=zerofillfile bs=1M
- if= specifies the input file;
- /dev/zero indicates a bit-stream of zeros
- of= specifies the output file
- zerofillfile name of the file containing the bit-stream of zeros
- bs= indicates the block size
- 1M indicates that the block size will be 1 megabyte
rm zerofillfile
- Shutdown the Linux virtual machine;
- Use the VirtualBox VBoxManage utility to compact the Linux guest image.
Ref: Compacting VirtualBox Disk Images - Linux Guests