virtualbox snapshot size

11

4

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.

intuited

Posted 2011-02-27T04:09:59.543

Reputation: 2 861

Do you have swap? And is swap included in snapshots? – Olli – 2011-02-27T09:16:12.667

@Olli: Although I didn't explicitly check for swap usage, I gave the VM 1.6MB of RAM and didn't do more than one thing at a time. Currently it's got 992MB of standby memory while sitting idle (as seen in Windows Resource Manager). – intuited – 2011-02-27T15:28:43.287

@intuited: my point was that if you have large swap partition, and Windows is swapping (that happens even if you have plenty of memory, for various reasons), that might grow your snapshot size remarkably. – Olli – 2011-02-27T18:03:59.533

@Olli: Hmm.. I thought I had addressed your point, but I was assuming that having lots of standby memory would imply that it wasn't using a significant amount of swap. I've stumbled through the performance monitor menus and have gotten it to display Paging File Usage on its graph. It's steady at about 17 .. um, percent? System Properties shows 1606 MB as the "total paging file size for all drives". So . . . that means about 300 MB is in swap? Does that sound plausible? – intuited – 2011-02-27T18:32:47.143

I've also taken another couple of snapshots; one was taken while the machine was shut down. On startup, it installed some updates. When the updates completed, I took another snapshot; the .vdi for the previous snapshot ended up being about 500 MB in size. —————— After a couple of hours the .vdi file seemed to top out at a bit under 500MB and I took another snapshot. 15 minutes later, the new .vdi is about 100 MB in size. Throughout all of this the system has been sitting mostly idle with just Resource Monitor, and more recently Performance Monitor, running. – intuited – 2011-02-27T18:36:36.143

One thing to keep in mind here is that Windows uses swap in a different way than linux. Linux uses swap as the memory of last resort; a large swap file is typically a red flag. Windows likes to always have all it's used physical memory backed by swap, and so a large swap file is common and normal. – Joel Coehoorn – 2011-02-28T15:36:29.907

The big snapshot sizes are mostly due to file system changes. You can drastically reduce the filesize (mine usually reduce by 2/3) by compressing the snapshots (7zip or TAR should work fine). – Breakthrough – 2011-02-28T15:57:16.683

I'm going with the indexing service touching all the files and vbox determining the "change" based on MACE values instead of file contents. – RobotHumans – 2011-03-08T06:37:52.337

Answers

3

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.

Abraxas

Posted 2011-02-27T04:09:59.543

Reputation: 1 269