By grantbrown73
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”,“started_at”:“2017-09-26T18:31:17Z”,“completed_at”:null,“resource_id”:63894287,“resource_type”:“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”:[“private_networking”,“backups”,“ipv6”,“metadata”,“install_agent”],“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
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.