I want to understand how the IO is sent to hard disk blocks from a virtual machine.
Does having a XFS or ext3 or ext4 etc. really matters inside a virtual machine, or it is just depended on the file system of the host machine?
What's the impact on IO when compared to Virtual machine and a physical machine?
The following are just my assumptions based on what I know. Please correct me if I'm wrong:
Let's say I am using a RAW image!
Example 1: Preallocation=full
(Virtual Size = Disk Size)
- If I understood correctly, the disk blocks that would be used for Virtual machine are pre-allocated in this mode, and filled with Zeroes for unused data.
- And once a Guest OS is installed on that Raw disk, all these physical disk blocks are mapped to a virtual disk blocks (hard coded maps?).
- And any IO request made inside a virtual machine, the Guest OS kernel first processes it and sends a request to the virtual disk and that request is taken care by some kind of virtual abstraction service (I am guessing libvirtd) and is sent to hard disk controller. But what I don't get here is if the physical disk blocks are preallocted, the IO request should contain all the block addresses or the block maps so that the data is written only in one of those disk blocks. But how does such kind of an IO request is made to the hard disk controller and it seems really a major performance issue.
In this example, I completely excluded the filesystem of the host machine. I couldn't find a way to relate it.
Again all of this above is my giant assumption. I feel I am really wrong about the above idea. But I am hoping someone will correct me.
Example 2: preallocation=off
(Disk Size = Actual usage)
- The disk blocks for Virtual Machine are not pre-allocated and are only allocated on actual disk usage.
- The same steps in example 1 applies here until the IO request is made to Hard disk controller, but here no need to request for specific blocks to be overwritten, as no preallocation is done here.
So, going back to my actual question. It seems the filesytem on virtual machine will do have an impact, as all the calls to IO are initiated from Guest OS kernel and later.
Huhhh confused!!!! :(