X
Popular Searches

How to Resize a DigitalOcean Droplet

DigitalOcean logo

Droplets are the fundamental computing unit on DigitalOcean. A droplet is a virtual machine with one or more vCPUs. They have a fixed amount of RAM and a dedicated portion of SSD storage.

Over 60 different droplet configurations are available. The configurations are categorized into five different tiers. These are Basic, General Purpose, CPU-Optimized, Memory-Optimized, and Storage-Optimized.

You can resize droplets if you need to expand your hardware resources. You’re able to upgrade, downgrade, and switch between droplet tiers.

Limitations

DigitalOcean offers good flexibility when resizing, but there are a couple of limitations to be aware of.

You can’t reduce the size of a droplet’s disk—you can resize upwards, but the change will be permanent. This is because data may not be sequentially written to the disk, so reducing its size could cause filesystem corruption.

Advertisement

If you need to add storage on a temporary basis, you should attach a block storage volume instead. Volumes are storage units with a customizable capacity that can be freely added and removed.

The other resizing limitation concerns CPU architectures. DigitalOcean now offers Intel and AMD CPUs on some droplet plans. Once you’ve selected an architecture, that droplet must stick with it throughout its life.

Before You Resize

Droplets must be shut down before you can resize them. You’ll need to plan for an outage using your own maintenance procedures.

DigitalOcean advises a typical downtime period of one minute per GB of used disk space on your droplet. Even when you’re not resizing the SSD, droplet resizes involve disk data transfers within the DigitalOcean data center. In addition to the resize time, you should also factor in the time needed for the droplet to restart, and your workloads to get running.

You should always aim to back up your droplet prior to initiating a resize. Resizes are generally safe operations, but any problem could cause data loss that might be unrecoverable. Create a snapshot before you resize to mitigate this risk.

Once you’re ready to proceed, SSH into your droplet and issue a shutdown command:

sudo shutdown now
Advertisement

Do not use the power off toggle button in the control panel. This is equivalent to pulling the plug out of the wall, which could be destructive.

Resizing Using the Control Panel

You can resize droplets from within the DigitalOcean Control Panel. This lets you browse the available configurations before choosing a plan to switch to.

Log in to the control panel and click the droplet that you’d like to resize. On the droplet details page, click the “Resize” link in the left sidebar (red arrow).

Choose a new plan for the droplet. You can use the tabs above the table (blue arrow) to switch between droplet classes. To increase the droplet’s storage capacity, click the “Disk, CPU and RAM” toggle button at the top of the page (green arrow). Remember that storage changes are irreversible.

Click the green “Resize” button at the bottom when you’re happy with your choice. The resize process will now begin. A progress bar will be displayed while the operation completes. After the resize finishes, click the power button toggle in the top right (purple arrow) to boot up the droplet.

Resizing Using Doctl

You don’t have to use the web UI to resize droplets. DigitalOcean’s terminal client, Doctl, can handle resizes with a single command. This can be much more convenient when you need to resize multiple droplets. You can also use Doctl when programmatically upgrading your infrastructure.

Advertisement

Make sure that you’re authenticated to Doctl before continuing—you can follow our guide if you need to get set up.

Begin by getting the list of your droplets:

doctl compute droplet list

A table of output will be returned. Find the droplet that you want to resize and note down its ID.

Next, get the list of available droplet configuration plans:

doctl compute size list

The table includes each configuration’s unique slug (e.g. s-2vcpu-2gb) as well as details of its hardware resources (2 vCPUs and 2GB RAM in this case). Note down the slug of the plan that you want to use.

You’re now ready to issue the resize command. Make sure that your droplet has been powered off first.

doctl compute droplet-action resize droplet-id --size s-2vcpu-2gb

Replace droplet-id with your droplet’s ID. Substitute the value passed to the --size flag with the slug of the size you’ve chosen.

The action will occur asynchronously. If you’d rather the command waits for the action to finish, add the --wait flag.

Advertisement

Doctl will not resize the droplet’s disk by default. You can expand your droplet’s SSD to match the new plan’s capacity by including the --resize-disk flag. Your new plan must have a larger SSD capacity than your droplet’s existing spec.

Resizing without Downtime

Droplets don’t support downtime-less resizes. If you must resize a mission-critical server, you’ll be best off creating a new droplet and devising a strategy to move essential resources over.

You might need a period of parallel running. You could use a floating IP address or load balancer to switch network traffic between the two droplets. Once you’re ready to complete the transition, remove the old droplet to have all traffic divert to the new one. This approach mitigates the impact of your new droplet having a different IP, as external services could continue referencing the same floating or load balancer IP.

Conclusion

Droplet resizes let you scale your servers to meet changes in your workloads. The actual resize process is straightforward. The complexity comes in planning your resize strategy and the accompanying downtime.

When resizing a production droplet, you should make sure that you’ve got a comprehensive recovery plan in case anything goes wrong. Schedule a maintenance window, allowing at least one minute of downtime for each GB of storage on your droplet’s disk.

James Walker James Walker
James Walker is a CloudSavvy IT contributor. He is the founder of Heron Web, a UK-based digital agency providing bespoke software development services to SMEs. He has experience managing complete end-to-end web development workflows with DevOps, CI/CD, Docker, and Kubernetes. Read Full Bio »

The above article may contain affiliate links, which help support CloudSavvy IT.