Determining free disk space on Windows VMs

phpmaven

New Member
Jan 3, 2024
3
5
3
I'm posting this as it may be helpful to others.
This assumes that you have the guest agent installed on the vm and that you have installed jq, which is a command line JSON processor.
apt-get install jq

Now you can run the following from your shell:
qm agent <VM_ID> get-fsinfo | jq '[.[] | select(.["total-bytes"]) | {total_gb: ((.["total-bytes"] / (1024 * 1024 * 1024)) | round), used_gb: ((.["used-bytes"] / (1024 * 1024 * 1024)) | round), free_gb: (((.["total-bytes"] - .["used-bytes"]) / (1024 * 1024 * 1024)) | round)}]'

This will output something like this:
[
{
"total_gb": 59,
"used_gb": 44,
"free_gb": 15
}
]

Mark
 

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!