VirtualBox Snapshot - How to stop them to grow and take more and more space?
Solution 1:
Virtual disks
When you create a VM, you create a virtual disk as well. This disk can be of fixed size or dynamically expanding. In the first case, the file will not grow, in the latter case, the file has a small size at startup and will grow as needed by the VM to the maximum size of the virtual disk. The dinamically expanding disk can be compacted using Lukas's answer steps.
Snapshots
When you take a snapshot, VBox create a new file in which all changes will be writed instead of the original virtual disk file. This new file will grow as needed to the maximum size of the virtual disk. If you take another snapshot at some point, this file will stop growing, VBox will create another file which will grow at its turn.
Deleting snapshots
If you don't need snapshots, then you can delete them, the data will be commited in the original virtual disk file (or original snapshot file in case of consecutive snapshots.) Just stop the VM, select the snapshot you want to delete, use the button with the red cross in the snapshots tab. It can take a long time, depending of the amount of data in the snapshot.
Restoring snapshots
The icon with the up arrow is to restore a snapshot (and forget all data changed since the shapshot date).
Solution 2:
You can use my script to backup and restore the snapshot and then compact its HDD with:
- Defragment the disk on guest
- Run
sdelete -c C
on guest (download sdelete from http:// technet.microsoft.com/en-us/sysinternals/bb897443.aspx) which zeroes free space. I don't know Linux equivalent (maybe dd?). - Run
VBoxManage modifyhd winxp.vdi --compact
on host