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
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