Linux partition resizing

close up photo of mining rig
0 0
Read Time:1 Minute, 40 Second

If you’re not interested in Linux servers, then this post may not be for you. But if you are, read on!

As you may know, this site is self-hosted, and we run our own Linux server to do this. Recently, my home server that runs PiHole and Unifi Controller ran out of disk space and caused the PiHole DNS DHCP server to stop working. It was an easy fix to allocate more disk space since the server is hosted on a XCP VM server. However, extending the volume to use all of the added disk space was not so easy.

This is because Linux now uses Logical Volume Management (LVM), which requires a more advanced process than simply extending the partition. To extend the logical volume to use the full partition, I had to use the command line interface. Here’s what I did:

First, I ran “sudo lvdisplay” to check the mount path I needed to extend. I made a note of the LV Path, which in my case was /dev/ubuntu-vg/ubuntu-lv. Next, I ran “sudo resize2fs /dev/ubuntu-vg/ubuntu-lv” to check that the file system saw the full partition. Finally, I ran “sudo lvextend -l +100%FREE /dev/ubuntu-vg/ubuntu-lv” to extend the logical volume to use the full partition.

I want to stress that this process is considered advanced, and there is no graphical way to do it. If you are going to attempt it, make sure you backup your drive first.

Overall, this experience has been an adventure into the world of Linux servers for me. While it was frustrating at times, it was also a great learning experience. It’s always good to expand your knowledge and skills in areas you’re interested in, even if they’re not directly related to your work or hobbies. Who knows, you might discover a new passion!

Reference source for this post https://askubuntu.com/questions/196125/how-can-i-resize-an-lvm-partition-i-e-physical-volume

Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %