Friday, August 22, 2025

Expand disk

Step 2: Expand the Partition

From your fdisk output, I can see that /dev/sda1 (your root partition) is only using 29.9G of the available 128 GiB disk space. You need to expand this partition:

1.       Check current partition layout:

sudo lsblk

2.      Use growpart to expand the partition:

sudo growpart /dev/sda 1

This command expands partition 1 on /dev/sda to use all available space.[1]

3.      If growpart is not installed, install it first:

# For Ubuntu/Debian:
sudo apt update && sudo apt install cloud-guest-utils

# For CentOS/RHEL:
sudo yum install cloud-utils-growpart

Step 3: Resize the Filesystem

After expanding the partition, you need to resize the filesystem to use the new space:

1.       For ext4 filesystem (most common):

sudo resize2fs /dev/sda1

2.      For XFS filesystem:

sudo xfs_growfs /

Step 4: Verify the Changes

Check that the filesystem now shows the expanded size:

df -h


No comments:

Post a Comment