Page 2 of 3
Re: Disaster after running out of disk space!
Posted: 13. Dec 2009, 21:32
by Perryg
@Quaxo76,
I am sorry you are still having problems, but I need to ask. Have you changed the maximum allow size of the virtual hard drive to less then the amount of free space?
Do you have a second drive that has more free space that you can move the VDI file to and change the location in VBox?
The real problem here is the operating systems and not VirtualBox. I know everyone would love for it to be the other way around but the simple fact is that it isn't.
VirtualBox and all other hypervisors just provide the means for the operation of various OSes. The actual drive structure still resides with the OS.
When you create a dynamic HDD you are making a setting that tells the guest OS this is how big I am. Then it simply grows to fit the needs of the user. Once it reaches close to the end (Windows would warn you), but if it thinks you still have 5Gigs to go you are going to have this problem.
Re: Disaster after running out of disk space!
Posted: 13. Dec 2009, 22:01
by Quaxo76
Perryg wrote:@Quaxo76,
I am sorry you are still having problems, but I need to ask. Have you changed the maximum allow size of the virtual hard drive to less then the amount of free space?
Actually no, I thought about doing that but couldn't find a way to do so. I know a vdi can't be changed from dynamic to static, and I assumed its maximum size couldn't be changed either. How would I do that?
Perryg wrote:
Do you have a second drive that has more free space that you can move the VDI file to and change the location in VBox?
I don't at the moment, this is a laptop and none of the partitions on it have the needed 20GB free. But in a couple of days I'm getting an external HD and I'll use that for my next attempt to fix things.
Perryg wrote:
The real problem here is the operating systems and not VirtualBox. I know everyone would love for it to be the other way around but the simple fact is that it isn't.
VirtualBox and all other hypervisors just provide the means for the operation of various OSes. The actual drive structure still resides with the OS.
When you create a dynamic HDD you are making a setting that tells the guest OS this is how big I am. Then it simply grows to fit the needs of the user. Once it reaches close to the end (Windows would warn you), but if it thinks you still have 5Gigs to go you are going to have this problem.
I'm not sure I agree on this. Of course Windows would have no way to know that the HD is running out of space (concerning Windows, I was only complaining that it used so much disk space without me doing anything, thus triggering the whole "out of space" event).
Virtualbox, on the other hand, DOES know that a vdi is just a file; and it knows where it resides. When the guest OS (in this case Windows) needs more disk space, it allocates a new 1MB block, appending it to the existing vdi; it would be great if, before doing so, it could check if there's available space, and if there isn't (or if the space is running critically low) just pause the guest and warn the user.
Re: Disaster after running out of disk space!
Posted: 13. Dec 2009, 23:45
by skoehler
Quaxo76 wrote:Virtualbox, on the other hand, DOES know that a vdi is just a file; and it knows where it resides. When the guest OS (in this case Windows) needs more disk space, it allocates a new 1MB block, appending it to the existing vdi; it would be great if, before doing so, it could check if there's available space, and if there isn't (or if the space is running critically low) just pause the guest and warn the user.
Well, warn the user, pause the guest, make the disk read-only, or whatever ...
I haven't tested it, but my wild guess is, that VirtualBox allows the guest to continue to write do the disk. The guest-OS probably keeps writing and hence destroys the filesystem effectively. VirtualBox can keep the guest OS from doing so, but doesn't.
Anyway: Perryg doesn't seem to be interested in techniques to improve the situation. Instead he blames the guest OS.
BTW: I'm not blaming VirtualBox - i'm saying it could be improved, so that it protects the vdi from stupid behaviour of the guest OS.
Re: Disaster after running out of disk space!
Posted: 13. Dec 2009, 23:53
by skoehler
Quaxo76 wrote:Why oh why must Windows let its vdi grow so large for no reason whatsoever? Now Windows reports only 8GB used but the vdi size is almost 18GB!

Because VirtualBox doesn't know, which sectors are still used, and which are not. (I wonder, whether that is going to change! Flash-disks have the demand of knowing which sectors of the disk are in use, and which are not. And the set of ATA commands has been extended for this purpose. VirtualBox could benefit from that.)
I don't know, whether you did that already, but you should zero free disk space, and then compact the vdi file to gain additional space.
(well, that is itself a risky operation, I think)
To zero the free parts of your vdi harddisk, there is the the tool sdelete. Run that inside the windows guest. Then use VBoxManage to compact the harddisk.
Well, another issue may be fragmentation. But defragmentation inside the guest will make the vdi grow again.
Re: Disaster after running out of disk space!
Posted: 14. Dec 2009, 03:49
by MarkCranness
There was a recent post where someone reported a graceful recovery from a host disk out-of-space condition. IIRC, they reported that the VM was saved and stopped and a message displayed asking to move the VDI. When they moved the VDI and patched up the xml, it started again where it left off with no issue.
HOWEVER, of course for that to happen, there has to be disk space in the VM snapshot folder to create a *.SAV machine save state file, but if that folder is on the same drive as the VDI then that can't happen. YMDV.
BTW, CloneVDI is usually a better alternative to sdelete followed by VBoxManage clonehd --compact.
Re: Disaster after running out of disk space!
Posted: 14. Dec 2009, 11:46
by mpack
Quaxo76 wrote:Why oh why must Windows let its vdi grow so large for no reason whatsoever?
"No reason whatsoever" is of course nonsense, there is a reason why the VDI grows and it would obviously be worth you while to find out what that reason is. My guess is that you have lots of background services running: disk indexing, defragmenter etc. I always disable these. I also would not install antivirus in the guest - in fact I wouldn't install it in the host either, but that's another story.
Once you get the VM booting again, I suggest you look at the Processes tab in the guests task manager, go through the entire list checking online for what this process is and why it needs to be there. The SysInternals Process Explorer tool as also pretty good for this. Eliminate everything that isn't vital to keep the PC running.
Re: Disaster after running out of disk space!
Posted: 28. Apr 2011, 19:36
by scotty79
Same thing happened to me. I had autogrowing vdi and after I ran out of space on the host, partition table of that disk got damaged so guest system (which is kubuntu) no longer works.
Why vbox massacres partition table of virtual disk when host runs out of space?
Re: Disaster after running out of disk space!
Posted: 29. Apr 2011, 09:50
by BillG
What can VirtualBox do about it? If an HDD runs out of disk space the OS crashes and the file system is in a mess. VirtualBox is just another application which is running under the host OS. The suggestion about a warning that disk space is low (or a forced hibernation) makes sense, but I am not sure how the guest OS would know that the host was low on disk space! Even if it knew, would it know in time to do anything useful before the host OS crashed?
Re: Disaster after running out of disk space!
Posted: 29. Apr 2011, 10:42
by Quaxo76
I don't think it's the guest OS that should do something. I think VirtualBox should, when trying to increase the size of the vdi file, check if there is room enough; if there is not, instead of allowing the disaster to strike, it should freeze the emulation, or at least pause it and warn the user prompting him to free up some space. I think this is basic failsafe technique...
Cristian
Re: Disaster after running out of disk space!
Posted: 29. Apr 2011, 18:03
by mpack
VirtualBox returns an accurate disk error to the guest, which is correct behaviour. It is not for VBox to decide to stop what might be an important service, any more than it is for your physical PC hardware to do that in similar circumstances. If you don't like this behaviour then ensure you have enough host disk space, or used a fixed size guest drive.
Re: Disaster after running out of disk space!
Posted: 29. Apr 2011, 19:37
by Quaxo76
mpack wrote:If you don't like this behaviour then ensure you have enough host disk space, or used a fixed size guest drive.
Yes, that's exactly what I did - right after loosing my guest system, I created a 20GB fixed image and use that. It wastes space, but it's better than the alternative!
Cristian
Re: Disaster after running out of disk space!
Posted: 30. Apr 2011, 08:39
by mpack
The error being discussed can't make you lose a guest system. It causes a disk write to return an error, period. You presumbly lose that write, and the guest process in question should abort if its written competently. You do not lose the previously written contents of the disk, and you can't lose the guest. This could of course prevent a guest OS from being installed... but you would have to be a bit of a dummy, don't you think, to begin installation of an OS on a drive that had no space left whatsoever.
Re: Disaster after running out of disk space!
Posted: 30. Apr 2011, 12:25
by Quaxo76
mpack wrote:You presumbly lose that write, and the guest process in question should abort if its written competently.
Well, I agree with you on this, so that should mean that Windows isn't written competently (not that I needed convincing

) because I actually DID loose my whole system. Some important files or settings must have been destroyed somewhere, because even after freeing up space - so that there was room to make the vdi grow, so Virtualbox didn't return write errors anymore to Windows - the system was still unusable. And this didn't happen only to me, but to other people as well...
Cristian
Re: Disaster after running out of disk space!
Posted: 30. Apr 2011, 14:32
by mpack
Quaxo76 wrote:that should mean that Windows isn't written competently (not that I needed convincing

) because I actually DID loose my whole system
That isn't at all what I said. I said that the guest process should abort after the first write error, if it's written competently. If it's written
incompetently, i.e. if it doesn't test for write errors, then it would carry on, failing to write a whole lot more data. This is a waste of your time and its own, but it still will not cause the guest filesystem to be corrupted.
Re: Disaster after running out of disk space!
Posted: 30. Apr 2011, 14:46
by Quaxo76
Hmmm... I'm not sure I get your point, then.
A whole OS installation gets corrupted because of low free disk space (on the host) that results in a disk write error (on the guest). I think this means that somewhere, someone messed up the "fail-safe" principles.
If Windows is not to blame, and Virtualbox is not to blame, then, who is? I don't want to actually place the blame, but finding who is behaving "wrongly", where the problem is, would help with possibly avoiding that this happens again to others. All IMO of course.
Cristian