Clone, template, pools : how does it uses disk space ?

Hi, I would like to know what happens to storage when using the different method of cloning or generating VMs using templates / pools. I'd like to know also in what case VM and virtual disks are totally independent and in what case they are not. Sadly the RHEV documentation doesn't really provide these informations and I don't find any explicit informations about it. For example, when making a VM from template, using pre-allocated disk option, for a 50GB Virtual disk, it only uses 3GB on the physical disk. Another example, when making a pool of 10 VMs, based on a VM with a 50 GB virtual disk, only 2GB more space is used on the physical disk. What is exactly done when this happens ? Here are the case I would like to have informations about (physical storage, and independence of VMs) : - using simple "clone function" - making VM from template with "clone" mode - making VM from template with "thin" mode - making VM in pools Is there modes calculating only the difference from the original VM, and other modes copying totally the informations from the virtual disk from the original VM ?

For example, when making a VM from template, using pre-allocated disk
Hi! Regarding your examples, I cannot say exactly because of lack of some details. What storage type are you using? How do you measure the space used on the physical disk? option, for a 50GB Virtual disk, it only uses 3GB on the physical disk. 3GB is the VM's disk? What about the disk of the template? Generally, 50GB pre-allocated disk will take 50GB of physical space. A 50GB sparse disk will take as many 1GB chunks as needed to store all the information that was written to it, maximum 50GB. When you create a VM by cloning another VM or create a VM from a template in "clone" mode, a copy of the source disk will be created. The new disk will take as much space as the source disk did. When you create a VM from a template in "thin provision" mode or creating a VM in a pool, the new disk will be initially only a reference to the source disk. Reading from it will read the source disk. Writing to it will write to the new disk, not touching the source. Thus, all disk fragments that were overwritten after disk creation will be physically stored in the new disk and read from it, those that were not overwritten, will be read from the source disk. Also note that pool VMs are stateless, so the information that was written to their disks when VM was used by user is erased after the VM is returned back to the pool. Shmuel On Mon, May 23, 2016 at 12:50 PM, Alexis HAUSER < alexis.hauser@telecom-bretagne.eu> wrote:
Hi,
I would like to know what happens to storage when using the different method of cloning or generating VMs using templates / pools. I'd like to know also in what case VM and virtual disks are totally independent and in what case they are not. Sadly the RHEV documentation doesn't really provide these informations and I don't find any explicit informations about it.
For example, when making a VM from template, using pre-allocated disk option, for a 50GB Virtual disk, it only uses 3GB on the physical disk. Another example, when making a pool of 10 VMs, based on a VM with a 50 GB virtual disk, only 2GB more space is used on the physical disk. What is exactly done when this happens ?
Here are the case I would like to have informations about (physical storage, and independence of VMs) : - using simple "clone function" - making VM from template with "clone" mode - making VM from template with "thin" mode - making VM in pools
Is there modes calculating only the difference from the original VM, and other modes copying totally the informations from the virtual disk from the original VM ?
_______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users

Regarding your examples, I cannot say exactly because of lack of some details. What storage type are you using? How do you measure the space used on the physical disk?
simply df -h on the PC sharing the NFS storage.
For example, when making a VM from template, using pre-allocated disk option, for a 50GB Virtual disk, it only uses 3GB on the physical disk.
3GB is the VM's disk? What about the disk of the template?
3GB is the difference using df -h betweem before making the template, and after making it and running the VM.
Generally, 50GB pre-allocated disk will take 50GB of physical space. A 50GB sparse disk will take as many 1GB chunks as needed to store all the information that was written to it, maximum 50GB.
so "pre-allocated" doesn't use pre-allocation but sparse instead ? I don't really get it, sorry.
When you create a VM by cloning another VM or create a VM from a template in "clone" mode, a copy of the source disk will be created. The new disk will take as much space as the source disk did.
What happens if you clone a source VM which is using "thin" ?
When you create a VM from a template in "thin provision" mode or creating a VM in a pool, the new disk will be initially only a reference to the source disk. Reading from it will read the source disk. Writing to it will write to the new disk, not touching the source. Thus, all disk fragments that were overwritten after disk creation will be physically stored in the new disk and read from it, those that were not overwritten, will be read from the source disk.
Interesting. Is there a way to "merge" the changes ? (I mean to change it from being "thin provision" after its creation and make it an independent VM) When you create a template for the first time, it seems you can't choose between clone and thin, which one is used ?

Hi, NFS will be sparse. Preallocate is relevant for block storage. There is a fix to change the UI to display the format (RAW/QCOW2) of the disk instead of the type (Sparse/Preallocated) [1]. When creating a VM from a template, If you choose thin provisioning the disk format will be alway QCOW2, keeping the disk from the template as is read-only and creating a disk only for the diffs. If you choose Clone, then the whole disk will be copied and you will have a new copy of template disk in whatever format you want (Raw or QCOW2).
What happens if you clone a source VM which is using "thin" ? The VM cloned from a thin templated base VM will be created with a full copy of the disk (as in "Clone" when creating from template)
Interesting. Is there a way to "merge" the changes ? (I mean to change it from being "thin provision" after its creation and make it an independent VM) No, a VM created as thin will remain like that. You can clone a new VM from it and them you will have an "independent VM"
When you create a template for the first time, it seems you can't choose between clone and thin, which one is used ? When you create a template you make a read-only copy of the VM disks (Clone) . You can choose the format of the disks (RAW/QCOW2)
[1] https://gerrit.ovirt.org/#/c/57190/ On Mon, May 23, 2016 at 3:50 PM, Alexis HAUSER < alexis.hauser@telecom-bretagne.eu> wrote:
Regarding your examples, I cannot say exactly because of lack of some details. What storage type are you using? How do you measure the space used on the physical disk?
simply df -h on the PC sharing the NFS storage.
For example, when making a VM from template, using pre-allocated disk option, for a 50GB Virtual disk, it only uses 3GB on the physical disk.
3GB is the VM's disk? What about the disk of the template?
3GB is the difference using df -h betweem before making the template, and after making it and running the VM.
Generally, 50GB pre-allocated disk will take 50GB of physical space. A 50GB sparse disk will take as many 1GB chunks as needed to store all the information that was written to it, maximum 50GB.
so "pre-allocated" doesn't use pre-allocation but sparse instead ? I don't really get it, sorry.
When you create a VM by cloning another VM or create a VM from a template in "clone" mode, a copy of the source disk will be created. The new disk will take as much space as the source disk did.
What happens if you clone a source VM which is using "thin" ?
When you create a VM from a template in "thin provision" mode or creating a VM in a pool, the new disk will be initially only a reference to the source disk. Reading from it will read the source disk. Writing to it will write to the new disk, not touching the source. Thus, all disk fragments that were overwritten after disk creation will be physically stored in the new disk and read from it, those that were not overwritten, will be read from the source disk.
Interesting. Is there a way to "merge" the changes ? (I mean to change it from being "thin provision" after its creation and make it an independent VM) When you create a template for the first time, it seems you can't choose between clone and thin, which one is used ? _______________________________________________ Users mailing list Users@ovirt.org http://lists.ovirt.org/mailman/listinfo/users
participants (3)
-
Alexis HAUSER
-
Fred Rolland
-
Shmuel Melamud