socratis wrote:james.wilde wrote:A dynamic disk in my understanding means that, if I have used 5 GB, it takes 5 GB
No, it doesn't. Read mpack's initial response.
This is what mpack said:
Code: Select all
The size of a dynamic VDI is dictated by how many sectors have been written to. The contents of the guest filesystem are not important - that's a software matter, wherease VirtualBox is working at a (simulated) sector level. Deleting a file does not unwrite the data from the sector.
This is my understanding of the term 'dynamic', too. If I write, say, 20000 sectors of half a MB each I have written 10 GB to my virtual disk, and I expect those 10 GB to be on consecutive sectors and take up 10 GB plus administrative space on my host hard disk. It's not as if I have written 25 GB to my guest and erased 15 GB and expect the whole to have returned to 10 GB. I do expect the host to write sectors sequentially, and that means I expect the host to show 10 GB of used space (note, not the VB control panel, but the host file system).
socratis wrote:- First of all, if you can't "afford" 25 GB, you should not have allocated 25 GB.
- Second, If you want to "shrink" your guest to its actual used size, try the following; run the "sdelete" tool (in your Win7 VM) from Microsoft's SysInternals. Then shut down your VM. Then run "VBoxManage modifyhd --compact <YourVM>.vdi".
It's not that I can't afford 25 GB. It's just that I don't want to be adding virtual disks every time I run out of space, so I set the max size to what seems like a reasonable level with reference to the planned use of the guest, and rely on VB not to take that max until I have used that amount.
Here's another interesting fact. The comments above refer to a Windows 7 guest on a Mac. I'm now writing from one of my linux boxes where I have six guests, two solaris, one ubuntu and three Windows 7. Here are the figures for these guests:
Code: Select all
Max size Size on disk Size in guest
Solaris 10 16 GB 4.8 GB
Solaris 11 16 GB 2.7 GB
Ubuntu 20 GB 6.1 GB
Windows 7 25 GB 13.6 GB 13.6 GB (Template for the other two W7 guests)
Windows 7 25 GB 20.8 GB 20.8 GB
Windows 7 25 GB 15.0 GB 15.0 GB
(The alignment in the above table is not perfect, but I think it is nonetheless readable)
It is apparent here that the virtual disks are, in fact, dynamic, including the Windows 7 disks. Why the template instance of Windows 7 should have a Windows directory 4 GB larger than the 8 GB one on my Mac is a bit of a mystery, but that being the case, the other two, which are clones, also have a 12 GB Windows directory, plus an insignificant extra in Users and Program Files for the one, and about 5 GB extra for the other. The size on disk is the size reported by the host file manager.
So it seems that VB on a Mac does not produce a dynamic disk at all, or else the Mac file manager reports incorrectly the amount of disk used by guests.
I assume, socratis, that the commands you gave me would reduce the size of the disk to the actual used size taken up by the guest, so that any extra programs or data would require a new virtual disk to be created. I think I'll try and go another way. I'll create a new guest with a smaller sized dynamic disk, and transfer all I have on the current one as best I can to the new, then destroy the current one.
I have just remembered that the Mac has a second guest running ubuntu. On checking this, I find that the VB directory for the ubuntu instance is 4.3 GB although the maximum size is 20 GB so I think it is clear that there is something wrong with the Windows 7 guest. Whether it is a VB problem or a Mac file manager problem, I cannot at the moment say, but creating a new instance should clear up the matter.