Resizing Block Storage Volumes
This guide explains how to resize block storage volumes in Thalassa Cloud and expand the filesystem on your virtual machine. Resizing allows you to increase storage capacity without creating new volumes or migrating data.
Prerequisites
- A block storage volume attached to a virtual machine in Thalassa Cloud
- SSH access to the VM with root or sudo privileges
- The volume must be attached and mounted on the VM
- For ext4 filesystems:
cloud-guest-utilsorgrowpartpackage installed - For xfs filesystems:
xfsprogspackage installed
Note
You can only increase volume size, not decrease it. If you need to reduce storage, you’ll need to create a new smaller volume and migrate data.
Overview
The resize process involves three main steps:
- Resize the volume in Thalassa Cloud (via console, CLI, or API)
- Expand the partition on the VM using
growpart - Resize the filesystem using
resize2fs(ext4) orxfs_growfs(xfs)
Step 1: Resize the Volume in Thalassa Cloud
First, increase the size of the block storage volume through the Thalassa Cloud console, CLI, or API.
Option A: Using the Console
- Navigate to IaaS → Storage → Volumes
- Select the volume you want to resize
- Click Resize or Edit
- Enter the new size (must be larger than the current size)
- Confirm the resize operation
Option B: Using the CLI
If you have the tcloud CLI installed, you can resize volumes using the API. Check the API Reference for the exact endpoint and parameters.
Verify Volume Resize
After resizing, verify the new volume size in the console or using the CLI:
tcloud storage volumes listThe volume should show the updated size. Note that the VM’s filesystem won’t reflect this change until you complete the steps below.
Step 2: Verify Current Block Device Status
SSH into your virtual machine and check the current state of block devices.
List Block Devices
Use lsblk to see all block devices and their current sizes:
lsblkExample output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
loop0 7:0 0 63.8M 1 loop /snap/core20/2682
loop1 7:1 0 91.4M 1 loop /snap/lxd/36918
loop2 7:2 0 50.9M 1 loop /snap/snapd/25577
loop3 7:3 0 63.8M 1 loop /snap/core20/2686
loop4 7:4 0 48.1M 1 loop /snap/snapd/25935
sda 8:0 0 120G 0 disk
├─sda1 8:1 0 34.9G 0 part /
├─sda14 8:14 0 4M 0 part
└─sda15 8:15 0 106M 0 part /boot/efiIn this example, sda is the disk (120GB), and sda1 is the partition mounted at / (34.9GB). After resizing the volume in Thalassa Cloud, you’ll notice that the disk size (sda) has increased, but the partition size (sda1) hasn’t changed yet.
Check Filesystem Type
Determine the filesystem type to use the correct resize command:
df -T /Or for a specific device:
sudo file -sL /dev/sda1Common filesystem types:
- ext4: Use
resize2fs - xfs: Use
xfs_growfs
Step 3: Expand the Partition
After the volume is resized in Thalassa Cloud, the partition table needs to be updated to use the new space. Use growpart to expand the partition.
Install growpart (if needed)
On Ubuntu/Debian:
sudo apt-get update
sudo apt-get install cloud-guest-utilsOn RHEL/CentOS/Fedora:
sudo yum install cloud-utils-growpart
# or for newer versions:
sudo dnf install cloud-utils-growpartExpand the Partition
Use growpart to expand the partition to fill the available space on the disk:
sudo growpart /dev/sda 1Replace:
/dev/sdawith your disk device (e.g.,/dev/vdb,/dev/nvme0n1)1with your partition number
Example output:
CHANGED: partition=1 start=227328 old: size=73172959 end=73400287 new: size=251430879 end=251658207This shows that the partition has been expanded from the old size to the new size.
Warning
Always specify the partition number correctly. Expanding the wrong partition can cause data loss. Double-check with lsblk before running growpart.
Verify Partition Expansion
Check that the partition has been expanded:
lsblkThe partition size should now match the disk size (minus any other partitions).
Step 4: Resize the Filesystem
After expanding the partition, resize the filesystem to use the newly available space.
For ext4 Filesystems
Use resize2fs to expand the ext4 filesystem:
sudo resize2fs /dev/sda1Replace /dev/sda1 with your partition device.
Example output:
resize2fs 1.46.5 (30-Dec-2021)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
old_desc_blocks = 5, new_desc_blocks = 15
The filesystem on /dev/sda1 is now 31428859 (4k) blocks long.Note
resize2fs can resize mounted filesystems online without unmounting. No downtime is required.
For xfs Filesystems
For xfs filesystems, use xfs_growfs:
sudo xfs_growfs /Or specify the mount point directly:
sudo xfs_growfs /mnt/dataNote
xfs_growfs requires the mount point, not the device path. It can also resize mounted filesystems online.
Step 5: Verify the Resize
After completing all steps, verify that the filesystem has been successfully resized.
Check Filesystem Size
Use df to check the filesystem size and available space:
df -h /Or for a specific mount point:
df -h /mnt/dataThe output should show the new, larger size:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 120G 15G 100G 13% /Compare with Block Device
Compare the filesystem size with the block device size:
lsblkThe partition size should match the disk size, and the filesystem should match the partition size.
Complete Example Workflow
Here’s a complete example workflow for resizing a volume:
# 1. Resize volume in Thalassa Cloud console
# Navigate to: IaaS → Storage → Volumes → Select volume → Resize to 120GB
# 2. SSH into the VM
ssh user@vm-ip
# 3. Check current status
lsblk
df -h /
# 4. Install growpart if needed (Ubuntu/Debian)
sudo apt-get update
sudo apt-get install cloud-guest-utils
# 5. Expand the partition (example: /dev/sda, partition 1)
sudo growpart /dev/sda 1
# 6. Resize the filesystem (for ext4)
sudo resize2fs /dev/sda1
# 7. Verify the resize
df -h /
lsblkTroubleshooting
growpart: command not found
Install the required package:
- Ubuntu/Debian:
sudo apt-get install cloud-guest-utils - RHEL/CentOS:
sudo yum install cloud-utils-growpart - Fedora:
sudo dnf install cloud-utils-growpart
resize2fs: Bad magic number
This error indicates the device doesn’t have an ext4 filesystem. Check the filesystem type:
sudo file -sL /dev/sda1Use the appropriate command for your filesystem type (e.g., xfs_growfs for xfs).
Partition not expanding
If growpart doesn’t work, you may need to:
- Ensure the volume was actually resized in Thalassa Cloud
- Check that the partition has free space after it (use
fdisk -l) - For GPT partition tables, ensure there’s no backup partition table at the end
Filesystem resize fails
If filesystem resize fails:
- Ensure the partition was successfully expanded first
- Check filesystem for errors:
sudo fsck /dev/sda1(unmount first if possible) - For ext4, try:
sudo resize2fs -f /dev/sda1(force flag)
Considerations and Limitations
- Volume size can only be increased, not decreased. To reduce storage, create a new smaller volume and migrate data.
- Online resizing is supported for both ext4 and xfs filesystems. No downtime is required.
- Backup before resizing is recommended, especially for production systems.
- Partition alignment is handled automatically by
growpart. - Multiple partitions on the same disk require careful handling. Only the last partition can typically be expanded easily.
References
- Block Storage Documentation — Overview of block storage capabilities
- Mounting Block Devices — Guide for attaching and mounting volumes
- tcloud CLI Reference — CLI commands for volume management
- Thalassa Cloud API Reference — API documentation for storage resources