Page 1 of 2
(Resolved) Disk Size Discrepencies
Posted: 26. May 2014, 19:06
by loukingjr
Running 4.3.12 on OSX 10.9.3
I had a Windows 7 guest which I updated to Windows 8.1. It runs fine.
My question is, the original Windows 7 guest was created with a 40GB dynamic .vdi. The updated guest still has 40GB listed in VirtualBox. Inside the guest it's listed as a 39.8GB HD with 24.4GB free. In the Mac finder the .vdi is listed as 41.73GB. I'm wondering how a dynamic drive grew to be larger than what it was set to be and why it grew so much even though 2/3rds of it is still free space?
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:18
by mpack
Define 1GB ?
Are all your sources of information using that definition?
"Current free space" has little to do with the file size of a dynamic VDI, which is essentially a high water mark.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:26
by dlharper
The .vdi file contains more than just the disk contents. There is a file header section as well, which can be quite large.
How it has reached this size I cannot say, but once it has grown it will not shrink again, even if a lot of data is deleted from it.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:30
by loukingjr
mpack wrote:Define 1GB ?
Are all your sources of information using that definition?
"Current free space" has little to do with the file size of a dynamic VDI, which is essentially a high water mark.
I couldn't say what definition VirtualBox uses or Windows for that matter. Apple's is 1GB=1,073,741,824 Bytes.
and that doesn't explain why when there is only 14GBs in the guest the .vdi grew to at least 40GB.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:37
by mpack
VirtualBox uses the only rational (IMHO) drive size system, whereby 1GB == 1024MB (== 1K^3). By rational I mean that it's the same units used for RAM. So when you see RAM and disk capacities in various VBox dialogs you know that the units are compatible.
Drive manufacturers, and sometimes others too, often use 1GB = 1,000,000,000 bytes for drive size measures as this can fool the unwary into believing the capacity is higher: 1 decimal GB is smaller than 1 binary GB, so more of the former fit into any given capacity.
That said, I haven't worked out a way for 40GB to read as 41.73GB - in any units. It may be worth examining the VDI header using CloneVDI, making sure that blocksAllocated <= blocksTotal, since anything else indicates the old VBoxManage resize bug.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:41
by loukingjr
this .vdi hs never been resized but I'll check.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:44
by mpack
It's possible that 41.73GB represents the allocated space and not the file size. Windows hosts report allocated space and file size as two separate numbers.
| Edit: The number may also include metadata space, e.g. including i-blocks used to map data, other (forked) data associated with the file etc. I'm not up on OS X filesystems. |
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:47
by loukingjr
mpack wrote:It's possible that 41.73GB represents the allocated space and not the file size. Windows hosts report allocated space and file size as two separate numbers.
I'm using a Mac host so I don't think that's too relevant. Can I run CloneVDI inside the guest?
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:50
by loukingjr
mpack wrote:It's possible that 41.73GB represents the allocated space and not the file size. Windows hosts report allocated space and file size as two separate numbers.
| Edit: The number may also include metadata space, e.g. including i-blocks used to map data, other (forked) data associated with the file etc. I'm not up on OS X filesystems. |
I thought the point of using a dynamic drive was it only takes up the amount of space actually used. The Windows 7 guest .vdi I cloned is reported as 29.41GBs which makes sense because I installed more programs into it and probably had some restore points added.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:52
by mpack
loukingjr wrote:I'm using a Mac host so I don't think that's too relevant. Can I run CloneVDI inside the guest?
It must be relevant. No operating system allocates file space to the nearest byte, it always gets rounded up to allocation units. In Windows that means a multiple of 4K, but like I said I'm not familiar with OS X filesystems.
No, CloneVDI needs to see the VDI header, it must be run on the host.
There's possibly an equivalent VBoxManage command you an run, but I always use CloneVDI as it's so much faster to use.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:53
by mpack
loukingjr wrote:I thought the point of using a dynamic drive was it only takes up the amount of space actually used.
That's correct. But, define "used"?
Hint: define it without reference to guest filesystems which VBox doesn't understand.
Re: Disk Size Discrepencies
Posted: 26. May 2014, 19:56
by loukingjr
loukingjr wrote:
I thought the point of using a dynamic drive was it only takes up the amount of space actually used. The Windows 7 guest .vdi I cloned is reported as 29.41GBs which makes sense because I installed more programs into it and probably had some restore points added.
I just realized what may have happened. The Windows 7 guest I cloned was nearly 30GBs. It wouldn't be surprising if updating it to 8.1 used up an additional 10GB. I think the download itself was nearly 3GB. Then it would have to move things etc. expanding the .vdi to 40GB. Then it wrote over all the programs that were in the clone, plus deleting the 8.1 update files giving me more free space than it started with. The rest I can chalk up to the different ways VB, Windows and OSX report memory.
Re: (Resolved) Disk Size Discrepencies
Posted: 27. May 2014, 01:31
by mpack
I would still check the VDI header.
Re: (Resolved) Disk Size Discrepencies
Posted: 27. May 2014, 02:18
by loukingjr
mpack wrote:I would still check the VDI header.
The only way I can see doing that is to install clonevdi in my W7 guest, attach the 8.1 .vdi to the W7 guest as a secondary drive and look at it that way. Unless you know of a tool I can use in the 8.1 guest itself.
Re: (Resolved) Disk Size Discrepencies
Posted: 27. May 2014, 09:49
by dlharper
loukingjr wrote:mpack wrote:I would still check the VDI header.
The only way I can see doing that is to install clonevdi in my W7 guest, attach the 8.1 .vdi to the W7 guest as a secondary drive and look at it that way. Unless you know of a tool I can use in the 8.1 guest itself.
All you need is a binary file viewer in the host. Use it to look at the whole .vdi file. Scan it through by eye until you find what looks like an MBR, and everything before this is the header.