How to check the status of a disk resize with the API?

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.

  1. Shutdown Linode
  2. Resize Linode disk
  3. 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

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"

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct