How to Safely Shrink a Plesk Storage Drive on Google Cloud

Managing cloud resources effectively means only paying for what you need. If you're running a Plesk server on Google Cloud with an oversized secondary drive for your vhosts
and backups, you might be looking for a way to reduce its size and save on costs. However, you've likely discovered a common challenge: Google Cloud doesn't allow you to directly shrink a persistent disk.
Don't worry. There's a standard, safe procedure to downsize your storage volume without data loss. This guide will walk you through the proven method of creating a new, smaller disk, migrating your Plesk data, and safely swapping it with your old drive.
This tutorial is for users whose Plesk installation uses a secondary drive mounted at a location like /mnt/disks/plesk-storage
for websites and backup files.
The Strategy: Migrate and Swap
Since we can't shrink the existing disk, our solution is to:
- Create a new, smaller persistent disk (e.g., 20 GB).
- Attach it to our Google Cloud VM.
- Copy all files from the old drive to the new one.
- Update the system's
fstab
file to mount the new drive in the old drive's place. - Detach and delete the oversized old drive.
This method ensures a seamless transition with zero data loss and minimal downtime.
Step 1: Create and Attach the New Disk in Google Cloud
First, we need to provision our new, smaller disk within the Google Cloud Console.
- Navigate to Disks: In the Google Cloud Console, go to Compute Engine > Disks.
- Create the New Disk:
- Click CREATE DISK.
- Name: Give it a clear name (e.g.,
plesk-storage-new
). - Size: Set your desired smaller size (e.g.,
20
GB). - Zone: Crucially, ensure it's in the same zone as your Plesk VM instance.
- Click Create.
- Attach the Disk to your VM:
- Navigate to VM instances.
- Click on your Plesk VM's name to open its details page.
- Click the EDIT button at the top.
- Scroll down to Additional disks and click + Attach existing disk.
- From the dropdown, select the
plesk-storage-new
disk you just created. - Click Done and then Save the VM configuration.
Your VM now has access to the new, smaller drive.
Step 2: Format and Temporarily Mount the New Drive
Next, SSH into your server to prepare the new disk for use.
Mount the new disk: Bash
sudo mount /dev/sdc /mnt/temp-new-storage
Create a temporary mount point: This is where we will temporarily access the new drive to copy files to it.Bash
sudo mkdir /mnt/temp-new-storage
Format the disk: We'll format it with the standard ext4
filesystem.Bash
sudo mkfs.ext4 -m 0 -E lazy_itable_init=0,lazy_journal_init=0,discard /dev/sdc
Identify the new disk: Use the lsblk
command to list all block devices. Your new, unformatted 20 GB disk will likely be the last one in the list, such as /dev/sdc
.Bash
lsblk
Step 3: Copy Your Plesk Data
To avoid data corruption, it's essential to stop Plesk services before copying files. We'll use rsync
because it perfectly preserves all file permissions and ownership, which is critical for Plesk.
a
: Archive mode, which preserves permissions, ownership, and more.v
: Verbose, to see the progress.h
: Human-readable format for file sizes.- Verify the copy: Do a quick check to ensure the directories and files in
/mnt/temp-new-storage
mirror what's in/mnt/disks/plesk-storage
.
Copy Files with rsync: This command copies everything from your current storage drive to the new one.Bash
sudo rsync -avh /mnt/disks/plesk-storage/ /mnt/temp-new-storage/
Stop Plesk Services:Bash
sudo plesk sbin pci_manage --stop
Step 4: Swap the Drives in /etc/fstab
This is the most critical part of the process. We will tell the operating system to mount the new disk in the official Plesk storage location on the next boot.
- Verify the Final Mount: Use
df -h
to confirm that the mount point/mnt/disks/plesk-storage
is now your 20 GB drive.
Mount the New Drive: The command mount -a
reads the updated /etc/fstab
file and mounts all listed filesystems. This will mount your new drive at the permanent /mnt/disks/plesk-storage
location.Bash
sudo mount -a
Unmount Both Drives: Unmount the current Plesk storage and the temporary mount point.Bash
sudo umount /mnt/disks/plesk-storage
sudo umount /mnt/temp-new-storage
Update the Mount Entry: Look for the line that mounts /mnt/disks/plesk-storage
. It will contain the UUID of your old 60 GB disk. Carefully replace that old UUID with the new UUID you just copied. The line should look similar to this:Code snippet
# Old entry (example)
# UUID=OLD_60GB_DISK_UUID /mnt/disks/plesk-storage ext4 defaults,discard 0 2
# New entry (paste your new UUID here)
UUID=NEW_20GB_DISK_UUID /mnt/disks/plesk-storage ext4 defaults,discard 0 2
Edit the Filesystem Table (fstab
): Open the fstab
file using a text editor like nano
.Bash
sudo nano /etc/fstab
Get the UUID of the New Disk: Every disk has a unique identifier. We need the UUID of our new 20 GB drive.Bash
sudo blkid /dev/sdc
This will output a string containing the UUID
. Copy this value.
Step 5: Finalize and Clean Up
Your new drive is now in place. Let's restart Plesk and clean up the old resources.
- Detach the Old Disk from the VM:
- Return to the Google Cloud Console and EDIT your VM instance again.
- Under Additional disks, find the old 60 GB drive and click the
X
to detach it. - Save your VM configuration.
- Delete the Old Disk: Once you are confident that your server is stable (it's wise to wait 24-48 hours), you can permanently delete the old 60 GB disk to stop being billed for it. Navigate to Compute Engine > Disks, select the old disk, and click DELETE.
Restart Plesk Services: Bash
sudo plesk sbin pci_manage --start
At this point, log in to your Plesk panel and check a few hosted websites to confirm that everything is working as expected.
You have successfully resized your Plesk storage drive on Google Cloud, optimizing your resource usage and lowering your monthly bill.