Table of Contents
Have you ever logged into your server or checked your WordPress site health only to realize that your disk space is running dangerously low? That was exactly what happened to me recently. As a blog grows, uploaded media, database entries, log files, and plugin updates slowly eat away at the storage space. If the disk hits 100% capacity, your entire website can crash or throw fatal database errors.
When I realized my GCP (Google Cloud Platform) instance was reaching its storage limit, I faced a dilemma. Upgrading a server disk sounds intimidating if you are not a full-time system administrator. One wrong command in the terminal could potentially break the boot sequence or corrupt files.
However, expanding disk space on GCP is surprisingly straightforward if you understand the two separate phases required to get it done: increasing the physical disk size in the GCP Console, and then telling the Linux operating system to recognize that newly added space. Here is how I solved this problem step-by-step.
Step 1: Upgrading the Disk in GCP Console
First, you need to grant your instance more storage from Google Cloud’s management side.
- Go to the GCP Console and navigate to Compute Engine > Disks.
- Find and click on the disk attached to your WordPress VM instance.
- Click EDIT at the top bar.
- Locate the Size field and change it to your desired storage size (for example, increasing from 10 GB to 20 GB or 30 GB).
- Click Save.
Note: GCP allows you to increase disk size dynamically while the instance is running. However, keep in mind that you can only increase disk space—GCP does not allow you to downsize a disk later without creating a completely new volume.
Step 2: Making Linux Recognize the New Disk Size
Changing the size in the GCP Console increases the physical disk volume, but the Linux filesystem inside your VM still thinks it only has the old partition size. To fix this, you need to resize the partition and the filesystem via SSH terminal.
- Connect to your server using SSH.
- Run
df -hto check your current filesystem space. You will likely see that the root directory (/) still shows the old limit. - Run
lsblkto list block devices. You should see that the main disk (e.g.,sdaornvme0n1) reflects the new larger capacity you set in the console, but the partition underneath it (e.g.,sda1) is still small. - Expand the partition using
growpart. For standard Debian/Ubuntu setups, type:sudo growpart /dev/sda 1(Replace/dev/sdaand1with your actual device and partition number found fromlsblk). - Finally, expand the filesystem itself:
- If using ext4 (most common):
sudo resize2fs /dev/sda1 - If using XFS:
sudo xfs_growfs /
- If using ext4 (most common):
Run df -h once more, and you will see the root partition instantly update to reflect the newly expanded storage space—all done without rebooting or experiencing any downtime.
Key Takeaways from My Experience
- Always Take a Backup First: Before touching terminal partitions or modifying disk properties, create a manual snapshot of your VM instance just in case.
- No Downtime Required: GCP allows live disk expansion, which means your blog readers will not experience any site outages during this procedure.
- Monitor Regularly: Don’t wait until your disk reaches 99% usage. Setting up a disk threshold alert or checking disk space monthly saves you from unexpected emergency crashes.