Loader
Categories

How to Grow a Partition on Ubuntu

🧱 How to Grow a Partition on Ubuntu

If your Ubuntu server was installed using a default partition layout, and it's not using the full capacity of the physical disk, you can manually expand the partition and filesystem to utilize all available space.

This guide will walk you through the process using common tools like lsblk, growpart, and resize2fs or xfs_growfs, depending on your file system.


🔍 Step 1: Check Current Disk Usage

lsblk

Look for your main partition (usually something like /dev/sda1 or /dev/vda1) and check if there’s unallocated space after it.

df -h

This will show current mounted file systems and usage. You'll likely see that / is smaller than the full disk size.


⚠️ Step 2: Backup Your Data

IMPORTANT: Growing a partition is generally safe, but always create a backup of critical data before modifying disk partitions.


🛠️ Step 3: Grow the Partition

Install cloud-guest-utils (if not already available):

sudo apt update
sudo apt install cloud-guest-utils

Use growpart to grow the partition. Replace /dev/sda1 with your actual root partition:

sudo growpart /dev/sda 1

This will expand the partition into the available space on the disk.


📂 Step 4: Resize the Filesystem

Depending on your filesystem type:

For EXT4 (most common):

sudo resize2fs /dev/sda1

For XFS (common on some cloud images):

sudo xfs_growfs /

This command will grow the file system to fill the partition.


✅ Step 5: Confirm the Resize

df -h

You should now see that your root partition uses the full size of the disk.


🐧 Notes

  • These instructions assume a single-disk, single-partition setup. LVM and complex setups may require additional steps.
  • Always ensure you are working on the correct device (e.g., /dev/sda, /dev/vda, etc.)

Still stuck? Reach out to our support team at support@dartnode.com and we’ll help!