Ubuntu Server 20.04.1 LVM Partitioning Issue

Recently, I deployed a new server to a customer with a fresh install of Ubuntu Server 20.04.1 using the default partitioning which defaults to using all free disk space for LVM. However, shortly after taking delivery of the server, my customer reported that the disk was only 200 GB. What? I physically inventoried this server myself! It’s brand new from my hardware vendor. I logged every component in my asset tracking system.

Unless I read the order wrong or I misread the label, the server has a Micron M.2 1 TB drive in it.

My customer returned df -h showing 200 GB.

Looking into it further and testing with a virtual machine created from the same media, I discovered that Ubuntu Server 20.04.1 may not actually give all the disk space to the LV. My test server was given 50 GB disk but only had 24 GB available.

Here’s how to fix:

Resize the logical volume to use all available space:

$ sudo lvm
lvm> lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv
lvm> exit

Now, resize the file system.

$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

And then if you run df -h again, you’ll see that it’s using all available space.

If you changed your LVM settings from the default, you’ll just need to adjust those when running the commands listed.

About Travis Newton 18 Articles
I am a Cloud Engineer currently working in the financial and web hosting industry. My passion has been Linux since I first discovered it in 2005. Throughout my career, I have always implemented Linux wherever possible and am an advocate of using open source software over proprietary whenever possible. I strongly believe in the UNIX philosophy of "Do One Thing and Do It Well". I started The Linux Lab as a way for people to discover Linux (and UNIX in general, even macOS users) and to find solutions to problems and learn about Linux.

Be the first to comment

Leave a Reply

Your email address will not be published.