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
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!