If you’ve recently upgraded the disk size of a volume on Hetzner Cloud, you’ll find that the additional space is not automatically available for use. This is because the filesystem on the disk needs to be resized to utilize the new space. Here’s a straightforward guide on how to resize your filesystem on a Hetzner Cloud virtual machine (VM).
Step 1: Verify the New Disk Size
Before you start resizing the filesystem, it’s crucial to ensure that the operating system recognizes the new size of your disk. You can use the lsblk command to list all block devices and their sizes:
lsblk
Look for the disk that corresponds to your volume (usually /dev/sda or similar) and check that the size reflects the recent changes you made.
Step 2: Resize the File System
With the disk size confirmed, the next step is to resize the filesystem. This is done using the resize2fs command. It’s important to perform this operation when the disk is not in active use. Here’s how you can do it:
sudo resize2fs /dev/[your-device]
Step 3: Confirm the Operation
To ensure that the filesystem has been successfully resized, you can use the df -h command to check the disk usage and space availability:
df -h /mnt/HC_Volume_1234
This will show you the total, used, and available space of your volume. It should reflect the new size.
Important Reminder
Always ensure that any critical data is backed up before performing operations like resizing a filesystem. This precaution helps avoid data loss in case of any unexpected issues during the resizing process.