Extend Ubuntu Root Partition After Installation (Ubuntu 22.04 & 24.04)
If you missed allocating 100% of your hard disk while installing Ubuntu, don’t worry—it’s a common mistake. Many users unintentionally assign limited space to the root (/) partition, leaving the rest of the disk unused.
This step-by-step guide will help you extend your Ubuntu root partition using LVM (Logical Volume Management), tested on Ubuntu 22.04 and 24.04 systems.
🔍 How to Know You’re Affected
Run:
df -h
If your root partition shows only a portion of the total disk, like:
/dev/mapper/ubuntu--vg-ubuntu--lv 98G 73G 21G /
And lsblk shows much more available:
sda 238.5G
└─sda3 236.5G
└─ubuntu--vg-ubuntu--lv 100G /
Then you have unallocated space.
✅ How to Extend Ubuntu Root Partition (LVM)
1. Check Free Space in Volume Group
sudo vgdisplay
Find: Free PE / Size → Should show unused space.
2. Extend Logical Volume
sudo lvextend -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv
3. Resize the Filesystem
sudo resize2fs /dev/mapper/ubuntu--vg-ubuntu--lv
(Use xfs_growfs, if using XFS.)
4. Verify with:
df -h
Your root (/) should now reflect full disk usage.
🧠 Summary
You’ve now fully utilized your disk space without reinstalling. This is a must-know for developers or sysadmins using LVM.
📌 Related Reading
More in Linux
How to Upgrade from Ubuntu 22.04 to 24.04
Learn how to seamlessly upgrade your Ubuntu system from 22.04 LTS (Jammy Jellyfish) to 24.04 LTS with this step-by-step guide.
How to Generate an SSH Key Pair in Ubuntu for Secure Authentication
Secure Shell (SSH) keys provide a secure and convenient method for authenticating to remote servers without needing passwords. If you’re a developer or system administrator, setting up an SSH key pair is an essential step to streamline secure access to servers.
How to Copy Files to Another Machine Through the Terminal?
Learn how to securely copy files to another machine using the terminal. Explore SCP, Rsync, and best practices.
Guide to whitelisting, banning or unbanning an IP in Fail2ban
Welcome to Codenet Solutions, In this article you’ll learn about the whitelisting of IPs in the Fail2ban service. Before going deeper let’s learn a little about the Fail2ban service. What is Fail2ban? It is software or a service that is developed in Python to prevent malicious requests sent to the servers.
