Question

Why aren't my droplets having their disks resized? (API)

Posted September 26, 2017 1.2k views
APIUbuntu 16.04

I’m running an application which needs to be able to spin up droplets of different sizes, and I’m a bit puzzled about why my disk sizes appear not to be updating.

The script involved waits until the droplet is powered off, then triggers the resize API query like the following curl example:

curl -X POST -H ‘Content-Type: application/json’ -H “AUthorization: Bearer <token>” -d ’{“type”:“resize”, “size”:“8gb”}’ “https://api.digitalocean.com/v2/droplets/<dropletID>/actions”

I get responses like the following:

{“action”:{“id”:296405318,“status”:“in-progress”,“type”:“resize”,“startedat”:“2017-09-26T18:31:17Z”,“completedat”:null,“resourceid”:63894287,“resourcetype”:“droplet”,“region”:{“name”:“New York 3”,“slug”:“nyc3”,“sizes”:[“512mb”,“1gb”,“2gb”,“c-2”,“4gb”,“c-4”,“8gb”,“c-8”,“16gb”,“m-16gb”,“c-16”,“32gb”,“m-32gb”,“48gb”,“c-32”,“m-64gb”,“64gb”,“m-128gb”,“m-224gb”],“features”:[“privatenetworking”,“backups”,“ipv6”,“metadata”,“installagent”],“available”:true},“region_slug”:“nyc3”}}

The resize succeeds, and I get an 8GB node with 4 cores and 8 GB of ram, but I’m still getting 20GB of hard disk space. The size list documentation (linked below) seems to indicate that I should be getting 80 GB.

What’s up?

Thanks,
-Grant

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
2 answers

There are two types of resizes - CPU and RAM only, which is used by default and CPU, Disk and RAM.
To get the second one with API, you’ll need also to pass disk: true argument in the request, such as:

  • curl -X POST -H 'Content-Type: application/json' -H "AUthorization: Bearer <token>" -d '{"type":"resize", "size":"8gb","disk": true}' "https://api.digitalocean.com/v2/droplets/<dropletID>/actions"

(didn’t tested, so I’m not 100% sure it’s working, maybe you’ll need quotes around true)

More about this in the API docs.

Gotcha, not sure how I missed that in the API - thanks!

-Grant

Submit an Answer