How to Resize a DigitalOcean Volume
Quickly resize a DigitalOcean volume in the control panel and with one command. Expand your filesystem's capacity without downtime.
Parathan Thiyagalingam
When your DigitalOcean volume runs out of space, here’s the quickest way to expand it. In most cases, you only need one command after increasing the size in the control panel.
Quick Steps
- Increase volume size in DigitalOcean control panel
- Run one command on your server
- Done!
Step 1: Increase Volume Size in DigitalOcean Control Panel
- Go to Volumes in your DigitalOcean control panel
- Click on your volume
- Click Resize Volume
- Enter the new size and confirm
Step 2: Check Current Status (Optional)
# See your current disk usage
df -h
You’ll likely see something like:
/dev/sda 635G 635G 0 100% /mnt/volume_blr1_03
Step 3: Resize the Filesystem
This is the magic command that does everything:
sudo resize2fs /dev/sda
Replace /dev/sda with your actual device name (check with df -h to see yours).
Expected output:
resize2fs 1.42.13 (17-May-2015)
Filesystem at /dev/sda is mounted on /mnt/volume_blr1_03; on-line resizing required
old_desc_blocks = 40, new_desc_blocks = 44
The filesystem on /dev/sda is now 183500800 (4k) blocks long.
Step 4: Verify Success
df -h
Before:
/dev/sda 635G 635G 0 100% /mnt/volume_blr1_03
After:
/dev/sda 695G 635G 28G 96% /mnt/volume_blr1_03
Success! You now have additional free space available.
Why This Works
The magic: resize2fs performs an online resize, meaning it expands the filesystem while it’s still mounted and in use. No downtime required!
What If It Doesn’t Work?
In rare cases, you might need additional steps, but 90% of the time, the simple command above is all you need.
If you get errors, try:
# Check your device name first
df -h
# Then use the correct device name
sudo resize2fs /dev/your-device-name
Quick Automation Script
Save this for future resizes:
#!/bin/bash
echo "Before resize:"
df -h
echo "Resizing filesystem..."
sudo resize2fs /dev/sda
echo "After resize:"
df -h
echo "✅ Resize complete!"
That’s It!
No complex unmounting, no partition table editing, no reboots. Just:
- Resize in DigitalOcean panel
- Run
**sudo resize2fs /dev/sda** - Enjoy your extra space
The resize2fs command automatically detects the new volume size and expands the filesystem to use all available space. Simple and effective!