Find the size of a Snapshot

Proxmox India

Member
Oct 16, 2017
46
4
13
51
Bangalore
Hi,

Wanted to know how we could get the size of a snapshot of a perticular VM using the API

we want to be able to show the list of snapshots and their sizes occupied on the disk in a custom dashboard that we want to create.

Thanks
 
not possible (also, every storage counts this differently, so even if it were it would not be very meaningful..)
 
Dear Fabian,

I did not understand!

How would every storage count this differently. - if 2 GB Space is consumed by a snapshot then its going to be 2GB regardless of the storage type. I dont quite get it.
 
Dear Fabian,

I did not understand!

How would every storage count this differently. - if 2 GB Space is consumed by a snapshot then its going to be 2GB regardless of the storage type. I dont quite get it.

what is the "space consumed by a snapshot"? the size of all the data referenced in that snapshot? just the size of the data referenced only in that snapshot, but in no other snapshots? are snapshots which are used as base for linked clones somehow different or not?
 
Hi Fabian,

It would be the size of data used and not refrenced in the snapshot. the way to pull this info will depend on the type of the backing storage being used.

for eg if we use a ZFS based storage we would give the command

root@vm-host01:~# zfs list -t snapshot | grep vm-134 | grep G
ssd/vm-134-disk-1@snap1 2.25G - 32.1G -

here 2.25G is the space used by the snapshot and the actual size of the disk is 32.1G

similarly different commands would be used to parse the info based on the type of storage.

I can get you a list of commands if you plan on exposing these via a API or some other method
 
Hi Fabian,

It would be the size of data used and not refrenced in the snapshot. the way to pull this info will depend on the type of the backing storage being used.

for eg if we use a ZFS based storage we would give the command

root@vm-host01:~# zfs list -t snapshot | grep vm-134 | grep G
ssd/vm-134-disk-1@snap1 2.25G - 32.1G -

here 2.25G is the space used by the snapshot and the actual size of the disk is 32.1G

no, 2.25G is the space allocated to the data only referenced in that snapshot. now compare this with e.g. LVM thin, and you see what the problem is. displaying something as "used space" where the semantics is vastly different for different storages is worthless.