I have just created a VHD on windows server 2012 fixed space of 1GB but I am really confused to how it gets the space? Where does the 1GB come from? If I were to move the VHD to another virtual machine how does it know to take all the files in the VHD, don't understand..
3 Answers
What you asked is a little confusing, but, I think I understand that you want to know how a file can exist of a size without actually containing any data...
VHD is basically (but not exactly) a container file (similar to ZIP/rar/others)... When you create a 1GB VHD file, it basically creates a blank file that is the size you want on the hard drive.
Files do not actually have to contain anything - a file is basically a mixture of a record describing the file (meta data/allocation table) and the data itself - so, the record may state that a file is of x size along with the location of the data - but, the data itself is simply blank.
- 116,736
-
Think you may have just made it all click. Sorry for being confusing but that's is exactly what I meant. So the VHD is really just file which can be used as a hard disk. Thank you so much – topcat Mar 29 '13 at 15:51
When you create a VHD you are allocating space on your physical hard drive for the virtual drive. So if you have a 20GB drive, and you create a 10GB VHD, you now have a 10GB VHD, but have limited your physical drive to 10GB as well.
The VHD will store all of your files as a normal hard drive would, but it is just logical...not physical. SO it will operate in the same fashion.
- 466
In short, the VHD is an actual file that can be either fixed where it is immediately created with the full size of your virtual hard drive, or dynamic where the file will grow as empty space is filled. The VHD file itself behaves similarly to a physical disk drive. If the guest OS writes data to sectors 100-120 (for example), the virtual hypervisor takes those instructions and instead of writing them to a physical disk... it writes data into the VHD file instead.
- 10,702
dynamicorfixed. The file can be moved in either case. – Ramhound Mar 29 '13 at 15:36