Here is a professional SOP for resolving disk expansion issues on DigitalOcean.
SOP: Resolving "No Space Left on Device" After Droplet Resize
Issue: WordPress/Database fails with errno: 28 or Disk Full error. The Droplet was resized in the dashboard, but the OS does not recognize the new space, and the disk remains at 100% usage.
Phase 1: Verification
Before making changes, confirm that the partition is the bottleneck.
Access the Server: Log in via SSH or the DigitalOcean Console.
Check Disk Usage: Run
df -h.Indicator: If
/dev/vda1shows 100% Use, the partition needs manual expansion.
Check Physical Disk: Run
lsblk.Indicator: If
vda(the disk) is larger thanvda1(the partition), you have unallocated space.
Phase 2: Manual Expansion (Online Method)
In most cases, you can do this while the server is running.
Expand the Partition:
sudo growpart /dev/vda 1(Note: This tells the partition table to take up the rest of the disk.)
Resize the Filesystem:
sudo resize2fs /dev/vda1(Note: This grows the actual data layer to fill the new partition size.)
Confirm: Run
df -hagain to verify "Avail" space has increased.
Phase 3: Emergency Recovery (If Login Fails)
If the disk is so full that you cannot log in (session creation fails), use the Recovery ISO.
Mount Recovery ISO: Go to Droplet > Recovery > Mount Recovery ISO.
Power Cycle: Turn the Droplet OFF and then ON.
Launch Console:
Select Option 1 (Mount your Disk Image).
Select Option 6 (Interactive Shell).
Repair via Shell:
growpart /dev/vda 1resize2fs /dev/vda1
Clean Temporary Files:
rm -rf /mnt/tmp/*Revert and Reboot:
Go to Recovery > Boot from Hard Drive.
Power cycle (OFF/ON) the Droplet.
Phase 4: Maintenance & Prevention
To prevent a total site crash in the future:
Monitor Inodes: Occasionally run
df -i. If you have millions of tiny files (cache/sessions), the disk will "fill up" even if GBs are free.Log Rotation: Ensure your logs aren't growing indefinitely. Check
/var/log.Set Up Alerts: In DigitalOcean, go to Monitoring > Create Alert Policy and set an alert for Disk Utilization > 85%. This gives you time to resize before the site crashes.
Database Hygiene: Periodically clear the
wp_optionstable of expired transients using a plugin like WP-Optimize.
Final Result: Disk increased from 80GB to 160GB (50% utilization). Site restored.