Docs / Server Management / How to Resize a Disk Partition on Linux

How to Resize a Disk Partition on Linux

By Admin · Feb 25, 2026 · Updated Apr 25, 2026 · 107 views · 1 min read

Important Warnings

  • Always backup data before modifying partitions
  • Unmount the partition before resizing (except root)
  • Root partition can be resized from a rescue system or live USB

Check Current Layout

lsblk
df -h
fdisk -l /dev/vda

Resize with growpart (Cloud VPS)

Most VPS providers expand the disk at the hypervisor level. You then need to grow the partition and filesystem:

# Grow the partition to fill available space
sudo growpart /dev/vda 1

# Resize the filesystem
# For ext4:
sudo resize2fs /dev/vda1

# For XFS:
sudo xfs_growfs /

Resize with LVM

# Check available space
sudo vgs

# Extend the logical volume
sudo lvextend -l +100%FREE /dev/vg0/root

# Resize the filesystem
sudo resize2fs /dev/vg0/root

Verify

df -h
# Should show the increased size

Adding a New Disk

# List disks
lsblk

# Create partition on new disk
sudo fdisk /dev/vdb
# n (new), p (primary), 1, Enter, Enter, w (write)

# Create filesystem
sudo mkfs.ext4 /dev/vdb1

# Mount
sudo mkdir /mnt/data
sudo mount /dev/vdb1 /mnt/data

# Add to fstab for persistence
echo "/dev/vdb1 /mnt/data ext4 defaults 0 2" | sudo tee -a /etc/fstab

Was this article helpful?