Finding total disk size in multi-disk virtual machine

erbeyberkant

New Member
Jun 30, 2022
1
0
1
Hello there
I have to get total disk size in VM which have multiple disk. How to do that from api?
In documentation
/cluster/resources

disk -> Used disk space in bytes(for storage), used root image space (for VM)
totaldisk -> Storage size in bytes(for storage), root image size (for VM)
 
I have no practical experience handling json, so I am always happy to see a useful example which I can play with. Thanks!

Unfortunately summing up "|.size" does work for me but ".used" does not. There is no ".used" available for me:

Code:
~# pvesh get /nodes/pved/storage/ssd1/content --output-format json |jq '[.[]|select(.vmid == 236)]'
[
  {
    "content": "images",
    "format": "raw",
    "name": "vm-236-disk-0",
    "parent": null,
    "size": 23622320128,
    "vmid": 236,
    "volid": "ssd1:vm-236-disk-0"
  }
]

Where did you get the ".used" from?

Best regards
 
Where did you get the ".used" from?
I guess it depends on the storage, some perhaps are not reporting it. Ours does.

Code:
  {
    "content": "images",
    "ctime": 1645722022,
    "format": "raw",
    "size": 117440512,
    "used": 47185920,
    "vmid": 2100,
    "volid": "blockbridge:vm-2100-disk-0"
  }


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
I guess it depends on the storage, some perhaps are not reporting it. Ours does.
Okay, interesting. Thanks for the answer.