Specify Hard drive size using the API

Posted June 13, 2019 1.2k views

Greetings all, when using the API to resize a droplet, how can you specify the hard drive size you want? I do see in the documentation that you set disk to true, but don’t see you can specify the size of the disk. To give my scenario, we have some droplets still on the old standards of 512mb of memory and 20GB hard drives. If i set the slug size to s-1vcpu-1gb and disk to true, the memory is upgraded from the old basic standard of 512 but the hard drive remains at 20GB. Thanks in advance.

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.

Submit an Answer
1 answer

Hey there,

The hard drive size can’t be explicitly specified but you will gain 5Gb of disk space by moving to the new $5 plan. Should you not see the additional disk space after the API call completes it’s because the partition/filesystem of your Droplet hasn’t been resized, we have instructions on this here.

If you have any questions or need clarification on anything, just write back in and let me know.

Ethan Fox
Developer Support Engineer II - DigitalOcean

  • Thank you for the reply Ethan. I followed the link you gave me and below is what i get running gdisk -l /dev/vda.

    GPT fdisk (gdisk) version 0.8.10

    Partition table scan:
    MBR: protective
    BSD: not present
    APM: not present
    GPT: present

    Found valid GPT with protective MBR; using GPT.
    Disk /dev/vda: 41947136 sectors, 20.0 GiB
    Logical sector size: 512 bytes
    Disk identifier (GUID): 58345D9E-7A19-4CA6-83A8-1F32DAA63C94
    Partition table holds up to 128 entries
    First usable sector is 34, last usable sector is 41947102
    Partitions will be aligned on 2048-sector boundaries
    Total free space is 4029 sectors (2.0 MiB)

    Number Start (sector) End (sector) Size Code Name
    1 2048 41945087 20.0 GiB 8300 primary