How is the virtual disk overwritten?

This is for discussing general topics about how to use VirtualBox.
Post Reply
asiga
Posts: 10
Joined: 20. Apr 2011, 09:54
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: XP

How is the virtual disk overwritten?

Post by asiga »

Hi,

What does it happen when some file(s) in the guest operating system change? Does the whole virtual disk file need to be overwritten, or just the affected blocks are overwritten? I'm asking this question because I'm using VirtualBox on a SSD, and I'd to know if everytime I run it the whole disk file is written.

TIA!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How is the virtual disk overwritten?

Post by mpack »

Does it seem to you like it takes long enough that it could be overwriting the whole thing? And how much do you think VirtualBox knows about guest filesystems anyway? VDI updates happen on a sector by sector basis like the physical disk it emulates, though because it's actually emulated using a host file, normal host filesystem caching may apply.
asiga
Posts: 10
Joined: 20. Apr 2011, 09:54
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: XP

Re: How is the virtual disk overwritten?

Post by asiga »

Well, my virtual disk file is about 2GB and my hard disk is SSD, so I'm not sure if I would notice a huge delay if it overwrites the whole disk image everytime.

Btw, I don't think the guest filesystem has anything to do with this... I believe it's a matter of how Virtualbox overwrites the virtual disk, and that's a matter of the policy it uses to access the host filesystem. Any info on how it overwrites virtual disks? Just the modified data is overwriten, or the whole disk is written again -perhaps in the background- ?

TIA
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How is the virtual disk overwritten?

Post by Perryg »

It's exactly what mpack said "sector by sector basis like the physical disk". It works exactly the same as a real hard drive.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How is the virtual disk overwritten?

Post by mpack »

asiga wrote:Well, my virtual disk file is about 2GB and my hard disk is SSD, so I'm not sure if I would notice a huge delay if it overwrites the whole disk image everytime.
Are SSDs considered particularly fast for writing? I thought they were based on NAND-flash, which I know is not particularly fast for writes. Actual performance would depend on the design details: individual flash chips may be slow, but if you could write lots of them in parallel then that could be made plenty fast. Of course that would be an expensive design, and you would have to use eSATA or something to get the benefit.

SSDs are not something I've given much attention to - I'm quite happy with mechanical drives when I need big, I use my 16GB USB thumb drive for everything else (and I dont expect great performance with it). With USB3 and eSATA either here already or coming down the pipe I expect the bandwidth issue will be addressed soon.
smartysmart34
Posts: 101
Joined: 21. Apr 2008, 20:56

Re: How is the virtual disk overwritten?

Post by smartysmart34 »

[quote="mpack"]Are SSDs considered particularly fast for writing?[/quote]

You are kidding, right?
A current SSD (Crucial M4, OCZ Vertex 3... in the size of about 256 GB) pushes out roughly 250 - 350 MB/sec (some even above 400 MB/sec) with sequential writes for uncompressible data.
When it comes to random 4k writes they still go as high as 50 - 90 MB/sec.

Try and find a hard-Disc that fast ;-)

Cheers,
Martin
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How is the virtual disk overwritten?

Post by mpack »

Well, I'd love to argue, but this isn't the place.
Post Reply