How much space does a snapshot consume ?
Are there any way to see, or rule of thumb for how much space each VM snapshot consumes?
Does it get pre-allocated? thinly? Grow over time?
Responses
There is no one word answer for this. It all depends on how much data you write after creating a snapshot and when the snapshot was created.
Let us take an example of a vm with 10GB of preallocated disk.
Initially a 10GB lv will be created. Let us assume you have written 1GB of data to it.
You created a snapshot at this time. It will make the 10G disk readonly and write another 1GB lv where new data will be written, the new lv will be expanded like a thin provisioned disk while new data is written.
Now let us assume you have written 3GB of data after creating the above snapshot. Now the guest has 10GB lv + 3G lv with the guest occupying 4Gb of actual data (1GB written to 10G disk and then 3G).
Now if you create another snapshot it will make the earlier 3G lv as readonly and create another 1G disk and keep writing new data to it and will expand it depending upon writing data. After this snapshot you didn't create any other snapshot and filled up the disk by writing 6GB of data. If you write 6GB of data, then the disk will be 100%. Ie 1G+4G+6G.
Though the disk is 10G in size, due to snapshots you ended up having three lvs for this disk. 10G + 3G + 6G which uses around 19GB of disk space when the disk was full after the last snapshot was created.
Let us take another scenario:
You created a 10GB disk. Written 9GB of data to it. Then created first snapshot. Your 10G disk will be readonly and another 1Gb COW disk will be created. You end up occupying 11G of storage. Now you can write another 1G of data to disk for it to become full. Now you write 1GB of data and the disk became full. Now the storage space used is 11G in total due to snapshot. 10G + 1G.
Based on the two use cases above, you can understand the total disk space overhead due to snapshot creation depends based on when it's created (after how much data is written) and how much data is getting written to disk after a snapshot is created.
On the other hand if you had created a thin provisioned disk initially (10GB thin provisioned disk as per the above example), there will not be much overhead due to snapshot creation.
If you go to Storage -> Virtual Machine and Expand disks of virtual machine, you can see Virtual Size and Actual Size. Actual size will show you the overhead due to snapshot creation.
Hope this clarifies.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
