virtualbox snapshot size
I've started using Windows 7 under VirtualBox on an Ubuntu 10.10 host. I took about 6 snapshots over the course of setting up the VM from the Windows restore image that came with the computer. My installations were more or less limited to windows updates, antivirus, and the VB Guest Additions. I uninstalled much more than I installed. The VM was running for about 24 hours total.
The snapshots increased in size at a worrisome rate, even when the machine was idle: the snapshot .vdi file for the period between 11:22 PM and 9:02 AM is 6 gigs in size; during that time very little happened. The other .vdi files are between 0.5 and 3 GB, most between 1 and 2 GB. The corresponding .sav files are between 0.5 and 1 GB.
The Internet connection where I was doing this is limited to 30KB/s download, which, constantly saturated, works out to less than 3 GB per 24 hour period.
Is this normal? Is there something that can be done to make snapshots more practical?
update
On starting up the VM again, I've noticed that mscorsvw
is using significant processing time. Apparently this process precompiles .NET assemblies. This may have been going on during the period when I was taking snapshots, which might explain some of the snapshot size increase. I would be somewhat surprised to learn that this could be responsible for over 10 GB of additional disk usage, or that it would run for roughly 24 hours. Is this possible?
update part deux
As related in the comments thread, I started the virtual machine up again yesterday, about 24 hours ago (at noon on 2011-02-27).
I took another snapshot after it had finished some initial installs. That snapshot's files are ~500 MB for the .vdi and ~920 MB for the .sav.
An hour and a half later, I took another snapshot. .vdi: ~477 MB; .sav: ~923 MB
I attempted to leave it running overnight; I didn't use the computer after about midnight. However, when I checked it this morning, VirtualBox says that its state is "aborted". The current snapshot .vdi file is timestamped 2011-02-28 01:05. It is ~1.5 GB in size.
So, given that I was getting 6 GB .vdi file growth over an 9 hour period earlier, it does seem like the changeset is stabilizing at least somewhat over time after installation or updates. Olli has suggested that much of the change may be coming from swap usage. As mentioned in the comments, I'm not really sure how to check the amount of virtual memory that Windows 7 uses. The size of the swap file was at about 1.5GB when I checked it, but I don't know for sure how to find out how much of that is actually being used. The Performance Monitor graph indicates that Paging File Usage has peaked and stabilized at just under 20. But 20 what?
So if changes to the paging file contents are in fact responsible for a significant portion of the snapshot size increases, then it may be possible to reduce snapshot sizes by telling Windows to do less indexing or whatever else it uses swap for when it's got a gig of free RAM.
Solution 1:
Do you have any scheduled defragmentation? As with disk imaging software, defragging a drive makes so many changes to file locations that even recording just the changes can make the resultant file nearly as large as a full backup. If you have not turned it off, Windows 7 has a scheduled defrag by default.