How to Resize Droplets

Resizing a server, also known as vertical scaling, increases your server’s capacity by allowing it more memory (RAM), CPU, and disk storage. This is useful in a variety of situations, such as when your concurrent user base increases or you need to store more data.

There are two resizing options for Droplets: CPU and RAM only, and Disk, CPU, and RAM.

Type of Resize Reversible Increases CPU Increases RAM Increases Disk Storage Estimated Downtime (Approximate)
CPU and RAM only Yes Yes Yes No 1 minute per GB of storage in use
Disk, CPU and RAM No Yes Yes Yes 1 minute per GB of storage in use

CPU and RAM only resizes can be reversed if you want to return to using a smaller Droplet. Disk, CPU, and RAM resizes cannot be reversed because decreasing the size of the disk poses data integrity issues, but an alternative is to create a new Droplet of the desired size and migrate your data. Any time you resize a Droplet, be sure to test that all your services are running as expected.

Choosing a Resize Type: Disk or No Disk

The CPU and RAM only resize option adjusts the amount of CPU and RAM available to a Droplet, but does not affect its disk storage. Because the disk is not resized, this option can be used to scale the Droplet’s RAM and CPU up and then back down as your resource requirements change.

The Disk, CPU, and RAM resize option permanently increases the size of a Droplet’s SSD disk. Regardless of how much disk is actually in use, decreasing the disk size poses data integrity issues. Consequently, once the Droplet has been upgraded to the new disk size, you cannot return to a plan with less disk space.

Here are some general guidelines for Droplet resizing:

  • Choose a CPU and RAM only resize if you need more CPU and RAM and you want the ability to roll back to a less expensive Droplet size in the future.
  • If you need more of everything (CPU, RAM, and disk storage) and don’t intend to roll back to a smaller Droplet in the future, use the Disk, CPU, and RAM resize.
  • For flexible control of all three resources, combine a CPU and RAM only resize with DigitalOcean Block Storage.

Estimated Downtime

When resizing, the downtime varies depending on how much space is in use. This is true even when resizing CPU and RAM only because a resize may move the Droplet to a new hypervisor, which will transfer disk data over the network. Allow one minute per GB of storage in use. You can check how much disk storage your filesystem is using with the df command. Here, we check the file system root (/) and display the output in human-readable terms (-h).

df / -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1        20G   15G  4.4G  78% /

The output shows that this 20 GB Droplet is using 15 GB of space, so a disk resize can take up to 15 minutes, although the actual time required is typically shorter.

Droplets must be powered down in order to perform either kind of resize. You will need to power down your Droplet manually if you resize using the control panel. If you resize using the API, the Droplet will be automatically powered off as part of the resize API request.

Resizing via the Control Panel

From the DigitalOcean Control Panel on the Droplets page, click on the name of the Droplet you want to resize.

Next, click the Resize option in the Droplet-specific menu:

Resize page

The current Droplet size will be highlighted. Choose CPU and RAM only or Disk, CPU, and RAM resizing, then select the new Droplet size.

Note that you won’t be able to use the Resize button unless the server is shut off. If you use the On/Off switch to power down, you’ll encounter the following reminder:

Turn off Droplet warning - You should power off from the command line, not from the UI.

To power down from the command line, connect to the Droplet with SSH and issue the shutdown command:

sudo shutdown -h now

Whether you use the Turn off button or the shutdown command, once the server is shut down, you can select Resize, and a progress bar will display as the resize takes place.

When the resize event is finished, the Droplet needs to be powered back on. Click the On/Off button to start it:

Power On

The new size will be visible below the Droplet name. Once the Droplet is booted, you can begin verifying that the your services are working as expected.

Resizing via the DigitalOcean API

If you prefer to resize your Droplets via the DigitalOcean API, you will need:

  • The ID of the Droplet you want to resize.

    The ID is shown on a Droplet’s detail page when you’ve clicked its name (e.g. the 12345678 in https://cloud.digitalocean.com/droplets/12345678/...), or you can use the API to look it up.

  • A DigitalOcean API token with read and write access.

    If you don’t have one, you can create a new API token. by visiting the control panel’s API page and using the Generate New Token button in the Personal access token section.

Once you have the Droplet ID, you will use it with the Droplet actions API endpoint.

For example, the curl command below performs a CPU and RAM only resize to a 4GB Droplet, including automatically powering down the Droplet. Substitute your own API token, Droplet ID, and desired size below.

curl -X POST -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer EXAMPLE947b217efb6f3ec3bdEXAMPLE' \
     -d '{"type":"resize","size":"s-2vcpu-4gb"}' \
    "https://api.digitalocean.com/v2/droplets/droplet_id/actions"

If you want to perform a Disk, CPU, and RAM resize with the same options as the previous example, set the disk attribute to true. Make sure the target size has more disk than your original Droplet.

curl -X POST -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer EXAMPLE947b217efb6f3ec3bdEXAMPLE' \
    -d '{"type":"resize","size": s-2vcpu-4gb","disk":true}'  \
    "https://api.digitalocean.com/v2/droplets/droplet_id/actions"

Then, for either kind of resize, power on the Droplet when it’s complete.

curl -X POST -H 'Content-Type: application/json'
    -H 'Authorization: Bearer EXAMPLE947b217efb6f3ec3bdEXAMPLE' \
    -d '{"type":"power_on"}' \
    "https://api.digitalocean.com/v2/droplets/droplet_id/actions"

More details are available in the DigitalOcean API documentation on resizing.

Verify the Disk Resize

In certain cases, a disk resize will fail to resize the Droplet’s partition or filesystem. When you rerun df -h after a disk resize and the output is unchanged, this usually indicates a problem. Use the gdisk command to get more information:

gdisk -l /dev/vda

The output will look like something like this:

GPT fdisk (gdisk) version 1.0.3
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present
Found valid GPT with protective MBR; using GPT.
Disk /dev/vda: 104857600 sectors, 50.0 GiB
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): C1E73477-225B-4585-8BB5-C9291E473CE4
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 52428766
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)
Number  Start (sector)    End (sector)  Size       Code  Name
   1          227328        52428766   24.9 GiB    8300

In this case, the partition is still 25GB even though the disk is 50GB. To resize the partition, use the growpart command.

growpart /dev/vda 1

Please note the space between dev/vda and 1 in the above command.

To resize the filesystem, use resize2fs.

resize2fs /dev/vda1

If there is more than one partition on the disk, you may have to modify the above commands to more closely match the Droplet’s partition table. Partitions are numbered, so if you want to grow a specific partition, use it’s number in the growpart /dev/vda command, i.e. growpart /dev/vda 2 will grow the second partition.