Page 1 of 1

Size of Windows 7 Guest Mysteriously Expanding

Posted: 2. Oct 2018, 14:23
by bedun7
Last February I started getting the Your Startup Disc is Almost Full or is Full message (Mac error message) when starting the Mavericks host running Windows 7 through Virtualbox. Researching the forums, I learned how to shrink the VDI image by deleting files on Windows 7, using SDelete to fill the free space with 0s, and then on the Mac side using the modifymedium command. That worked and everything was fine for awhile. Fast forwarding, yesterday I got the Your Startup Disc is Full message without any previous warning that it was almost full. There was so little space available Windows 7 was repeatedly crashing as I tried to delete files, etc. I hardly have anything on the Mac side, but I scrounged around and found some things to delete to free up space. After that, I managed to delete Windows 7 files, 0 out, and modifymedium resulting in about 7 gigs of free space on the Mac side. Within an hour or so somehow I got the Mac error message again and, when I checked the available space in About This Mac, sure enough the free space was down to less than 50 megabytes. !!!?

So I scrounge around some more, found some more files to delete and free up space, deleted Windows 7 files, etc., to the point I was showing 17 gigs of free space on the Mac side of a 250 gig hard drive. Surely I'm in the clear. I also started defragmenting Windows 7 for good measure. Once again, after a short time Windows crashes and when I check free space on the Mac side it shows less than 20 megabytes free.

Does anyone have any insight on what could suddenly be causing the size of the guest VDI image to increase 17 gigabytes without my adding ANY additional files to the Windows 7 guest? This is a work laptop and all this is happening at a very bad time. Any help would be much appreciated.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 2. Oct 2018, 15:10
by mpack
Usually this is because of background disk processes, such as indexing and defragmentation. Any process which involves writing to previously unused sectors will cause the VDI to grow, whether or not the guest file is permanent. I hope you understand that the size of a VDI is a reflection of the number of sectors which have been written to, not the space currently occupied by guest files.

Compaction is good when you have a single unexpected or one-off event which causes the VDI to balloon. It is not a practical tool to use when the underlying cause has not been corrected.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 2. Oct 2018, 15:31
by bedun7
Thank you! I'll see if I can free up enough Macbook space to delete more files in Windows 7 then compact again -- this time not running the deframentation tool afterward.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 2. Oct 2018, 16:07
by bedun7
Well, I'm having trouble finding additional files to delete on the Mac and currently have only 9 mgs of free space. I did find a folder named VirtualBox VMs that contains 3 folders named "Windows 7 Professional," "Windows 7 Professional 32-bit," and "Windows 7 Professional 32bit." Would anyone know if it's safe to delete any of the folders or any contents in any of the folders? Thanks.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 2. Oct 2018, 16:43
by mpack
Do not delete any files or folders from "VirtualBox VMs" or its child folders if they are still referenced.

Each folder in "VirtualBox VMs" corresponds to a VM. If you have three subfolders in "VirtualBox VMs" then you should have 3 VMs in the VirtualBox manager. You can use the manager to delete any VMs that you no longer require (answering Yes to the "Delete physical files?" question). If those VMs are not referenced by the manager then someone has been messing with your Mac (or did not answer Yes to aforesaid question), and while it's possible that you could simply delete any unreferenced VMs (be absolutely sure of the spelling before you determine that!), it's not my data do I can't offer you blanket assurances that it's not needed.

A mistake sometimes made by newbies is to reference the same disk from more than one VM (and I'm looking at those two instances of Win7 32bit). You need to be very sure that isn't the case before you start deleting VMs.

Best practice would be to back up the entire "VirtualBox VMs" folder branch to secondary storage before deleting anything. At least that way you can always go back.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 2. Oct 2018, 17:47
by bedun7
Thanks again for your prompt and helpful reply. I was able to find other safe Macbook files to delete and to get 67 gigs of free space on Mac. Definitely won't defragment the c drive!

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 31. Oct 2018, 16:11
by bedun7
Unfortunately I'm still having the issue of the size of my Windows 7 Guest (as seen by my Macbook) mysteriously expanding (as much as 30-50 gigabytes even more) despite my adding very few files in Windows. The problem's been forcing me to repeatedly remove a bunch of files from Windows, zero out the free space, and then compress on the Macbook side to free up space on Macbook (because I'm getting the Startup Disk is Full message). Since mpack alerted me to the effect on the VDI of background processes writing to free space, I haven't defragmented Windows and I've disabled Windows indexing.

Would any one know what other processes might be writing to free space and drastically expanding the VDI or otherwise know what the underlying cause of this problem may be and how to fix it? Any help would be greatly appreciated.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 31. Oct 2018, 16:24
by bedun7
In case it's helpful, Disc Inventory X on the Macbook host shows VDI taking up 194.2 gigabytes of space (3 files) and of that Windows 7 Professional.vdi taking up 184.2 gigabytes. On the Windows 7 side, on opening Winderstat it initially shows the C drive has 202.1 gigabytes of space of which 19.7 gigabytes are free (suggesting 182.4 gigabytes are used). After I run Winderstat, however, it reports the C drive is using 79.7 gigabytes.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 31. Oct 2018, 17:16
by mpack
No, I'm afraid that doesn't really help. As previously mentioned, VDI size on the host reflects the number of guest sectors which have been written to, not the number of sectors which are currently mapped to guest files. I.e. VirtualBox simulates the surface of a hard disk, it knows nothing about the reasons for writes to that surface.

One tip: check how many partitions the drive contains. The "C drive" will only cover part of the drive surface. Also I'm not a WinDirStat user, so I can't say if it intentionally omits certain files as as the swap files, hibernation files etc.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 31. Oct 2018, 17:38
by bedun7
Windows 7 is only showing 2 partitions: The C drive and System Reserve (which has a capacity of only 100 MB). Don't know if it's significant, but Window's Resource Monitor is showing "System" constantly writing 50,000 bytes per second (or more). Would you know if that's normal or if whatever it is writing is accumulating the C drive free space (or does that involve the System Reserve drive)? Any other ideas what might be causing this problem and how I might fix it?

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 31. Oct 2018, 17:51
by mpack
No, that 50K/second doesn't sound normal. It sounds like there's a background task that you missed.

"System" is a container for a bunch of tasks implemented in DLLs. You need to pinpoint which DLL is the source of the problem. The following link discusses a related problem and how to diagnose it. https://social.technet.microsoft.com/Fo ... 7itproperf

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 31. Oct 2018, 18:04
by socratis
@bedun7
Let me "sort of" draw the process. Warning: Oversimplification.

In the following:
  • the letters are occupied sectors.
  • the spaces " " are empty/unallocated sectors, never used/addressed.
  • the dashes "-" are sectors that were allocated at some point, but not anymore
VDI contains data (randomly located), free, and previously used sectors:
  • +-----------------------------------------------------------------+
    | l d --- od--- skkjs    gsosgg   ds    dl  k  sl   ks f  po ss-- |
    | j s     k l---j--sd  v   k sd j  s dl kj s d  sd g jk ls d  js  |
    | d  l---s j  o  ;   s d j lk-s---j-sl---a-s al sd  sd hk l as  5 |
    | has   d h ig----w  2 4       pu t g  df b j; af s j--as-l-as--b |
    +-----------------------------------------------------------------+
Windows (or any VM) is reporting the space that's occupied by the letters only. The space that the VDI takes on the host, occupies everything that's not blank. Because once a sector has been written, it occupies space in the VDI, no matter if it's erased afterwards or not from the guest.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 1. Nov 2018, 22:34
by bedun7
Thanks for the responses. As has happened repeatedly before, a day or two after the issue a message pops in Windows 7 from CCleaner that it can free up a ginormous amount space (I think it was about 90 G this time). So I ran it, zeroed out with SDelete, then compressed on the Mac side. Now Mac is showing the VDI vastly shrunken and 90+ G of free space. It's crazy.

If I'm understanding even your oversimplification correctly, socratis, this is an illusion, which may explain why in the past in similar situations I've been working along thinking I have skads of free space and I inexplicably get a warning from Macbook that my startup disc is full or almost full. So, once space on the Windows side has been written to, it can never truly be freed up in the eyes of the VDI? That surprised me, because the reason I've been zeroing out and then compressing is because of other discussions in the forum saying (as I recall) that zeroing out free space on the guest then compressing the VDI in Mac DOES reduce the image size (compresses away the 0s) thereby freeing up space in the Mac host.

Again, if this is wrong and simply a temporary illusion, what's the solution? To backup and start up with a fresh VDI? Thanks.

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 6. Nov 2018, 14:10
by socratis
bedun7 wrote:So, once space on the Windows side has been written to, it can never truly be freed up in the eyes of the VDI?
Absolutely correct! Unless it's been zerofreed and compacted.
bedun7 wrote:zeroing out free space on the guest then compressing the VDI in Mac DOES reduce the image size
If you *do* perform these steps, then the space *is* freed in "the eyes of the VDI".

But your problem wasn't that you didn't use "zerofree" followed by "modifymedium --compact". Your problem was that the space was actually occupied in the VM! In the form of temporary/discardable files (90+GB) that once you actually deleted, then the VDI could actually be shrunk. You might want to add that "clean up" routine in the menu, as an Hors-d'œuvre... ;)

Re: Size of Windows 7 Guest Mysteriously Expanding

Posted: 9. Nov 2018, 15:29
by bedun7
Thanks Socaratis. That really clarifies your earlier post.