How to check the status of a disk resize with the API?
Linode
Linode Staff
I've been trying to auto-resize a Linode plan using the API. Up to now I've been doing it manually in three steps, one by one.
- Shutdown Linode
- Resize Linode disk
- Resize Linode plan
To automate these 3 steps under one single script, I need to add some wait time or some flag specifically between step 2 and 3, since the disk resize takes some time. Like, don't go to step 3 until step 2 is complete.
Is there a way I can check the status of a disk resize to see if it's complete or still in progress?
1 Reply
bthompson
Linode Staff
You can check the disk's state via the "status"
field.
Status while resize is in progress:
curl -sH "Authorization: Bearer $TOKEN" \
https://api.linode.com/v4/linode/instances/$linodeID/disks/$diskID/ | jq .status
"not ready"
Status when resize is complete:
curl -sH "Authorization: Bearer $TOKEN" \
https://api.linode.com/v4/linode/instances/$linodeID/disks/$diskID/ | jq .status
"ready"
Then for information on the progress of shutdown
and resize
jobs, check the status of the Linode instance.
#shutdown
curl -sH "Authorization: Bearer $TOKEN" \
https://api.linode.com/v4/linode/instances/$linodeID | jq .status
"shutting_down"
# resizing plan
curl -sH "Authorization: Bearer $TOKEN" \
https://api.linode.com/v4/linode/instances/$linodeID | jq .status
"resizing"