DigitalOcean Droplets are Linux-based virtual machines (VMs) that run on top of virtualized hardware. Each Droplet you create is a new server you can use, either standalone or as part of a larger, cloud-based infrastructure.
Resizing a Droplet changes the resources (CPU, RAM, and disk) that the Droplet has. There are two resizing options for Droplets:
CPU and RAM only. This option increases or decreases the amount of CPU and RAM available to a Droplet.
Disk, CPU, and RAM. This option increases or decreases the amount of CPU and RAM available to a Droplet and permanently increases the size of a Droplet’s disk.
Increasing a Droplet’s memory and CPU improves its performance. Increasing the size of its disk increases the amount of data you can store.
You can resize to any Droplet plan that has an equal or greater amount of disk space as the original Droplet.
Allow for about one minute of downtime per GB of used disk space, though the actual time necessary is typically shorter. You can check the disk storage on the filesystem with df / -h
.
Estimated downtime depends on disk usage even for resizes that don’t change the amount of disk space. This is because the Droplet may move to a new hypervisor, which transfers disk data over the network.
We strongly recommend taking a snapshot of the Droplet before resizing.
Droplets may change hypervisors during a resize, and any changes to a filesystem can lead to data loss if something goes wrong. We strongly recommend backing up the Droplet’s data before resizing. If you use snapshots, you can delete the snapshot after confirming that the resize was successful.
You cannot decrease the size of a Droplet’s disk.
Data is not always sequentially written in memory, so reducing the available space would risk data loss and filesystem corruption. For more flexibility, you can use volumes for additional data storage, which lets you detach or delete the volume if you no longer need the space.
You can resize Droplets from the control panel, using the DigitalOcean API, or using doctl
, the DigitalOcean CLI.
Before you can resize a Droplet in the control panel, you need to power it off. We recommend you do this from the command line to avoid data corruption, so SSH to your Droplet and issue the shutdown command:
Next, go to the DigitalOcean Control Panel. On the Droplets page, click the name of the Droplet you want to resize, then click the Resize option in the Droplet-specific menu.
Alternatively, you can click the Upgrade button next to the Droplet name or at the top of the Droplet detail page, if it is available.
The current Droplet size is highlighted. Choose CPU and RAM only or Disk, CPU, and RAM resizing, then select the new Droplet size. If a plan is unavailable for resizing, the control panel displays the reason.
Once the Droplet is powered down and you’ve chosen its new plan, click Resize. A progress bar displays as the resize takes place.
When the resize event is finished, click the On/Off button to power the Droplet back on.
The new size is visible below the Droplet name. Once the Droplet is booted, you can begin verifying that your services are working as expected. If you took a snapshot of the Droplet before doing the resize, you can now delete the snapshot to avoid further billing for it.
When resizing a Droplet via API, you need to specify the resize
action type and specify a slug for size
. To view a list of slugs, you can use the /v2/size
API endpoint or the Droplet pricing page.
Resizing via API automatically powers down the Droplet first.
After the resize is complete, power on the Droplet.
When resizing a Droplet via the CLI, you need to provide a slug to pass to the --size
flag. To view a list of slugs, you can use doctl compute size list
or the Droplet pricing page to view a list of valid slugs.
You also need to power off the Droplet by calling doctl compute droplet-action power-off
before resizing.
After the resize is complete, power on the Droplet.
In certain cases, a disk resize fails to resize the Droplet’s partition or filesystem. If you rerun df -h
after a disk resize and the output is unchanged, this usually indicates a problem. Use gdisk
to get more information:
The output looks like this:
Some operating systems, like CentOS, don’t come with gdisk
by default. You can either install gdisk
using the package manager (for example, sudo yum install gdisk
) or use fdisk
:
The output looks like this:
In both of the above cases, the partition is still 25 GB even though the disk is 50 GB. To resize the partition, use the growpart
command. In this command, /dev/vda
is the name of the disk, separated by a space, and followed by the number of the partition to resize, 1
.
The command to resize the filesystem depends on the filesystem type. If you don’t know what filesystem you’re using, check with df
:
You can see the filesystem type in the second column of the output. The following example output shows the filesystem type is ext4
.
For ext3/4 filesystems, use resize2fs
to resize the filesystem.
For XFS, use xfs_growfs
to resize the filesystem.
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 its number in the growpart /dev/vda
command. For example, growpart /dev/vda 2
grows the second partition.