LVM root filesystem running low on space

Greetings to everyone, I recently installed arch Linux with lvm support, I have a 250GB hard drive and I had created 2 logical volumes in the drive in a group volgroup0.

I have lv_root with 30GB space and lv_home with 100%FREE space. Now my lv_root is complaining of low disk space. I want to extend it, I have done a bit of research but I don’t just want to enter commands I am not sure of.

In my research I have learnt of the lvextend -l 100%FREE /dev/volgroup0/lv_root. Now my question is if I run this command, will it take up all the free space in my lv_home and assign it to lv_root. If true, is there a way I can specify the amount of space I want to extend my lv_root.

Your positive response will be highly appreciated.

This won’t work, because all the volume group’s (VG) space has already been assigned to lv_home. You need to shrink lv_home and assign the newly acquired free space to lv_root.

Do a backup of your data beforehand. Reboot your machine, do not log in, switch TTY or SSH in your box as root, then

umount /home
e2fsck /dev/volgroup0/lv_home ## checking fs integrity ##
resize2fs /dev/volgroup0/lv_home 50G ## shrinking the file system to 50 GB ##

## note that you cannot shrink the partition to less than what data you have on it,  ##
## so if you are using more than 50GB, you have to delete data first, ##
## before you can make your FS 50 GB in size. Or you can elect ##
## to make it bigger, like 200G, your choice. ##

lvreduce -L 50G /dev/volgroup0/lv_home ## taking free space from the LVM part
## and giving it back to the volume group, making the LV 50G in size ##

resize2fs /dev/volgroup0/lv_home # just to make sure it uses all
## its allocated space, after we reduced its size ##

lvextend -l 100%FREE /dev/volumegroup0/lv_root ## giving all the free space 
## to the root logical volume ##

resize2fs /dev/volgroup0/lv_root ## expand the file system ##

mount /home
## just to make sure it's on when you login, or you can just reboot ##

That should be it. You can expand any FS while it’s in use, but you cannot shrink them when they are mounted, so if you shrink home, you cannot login to a user that has its home dir under /home. You can create a user and put its home under /opt, but easiest way by far it to login as root.

Thank you very much for your response, I made a mistake I had shrinked whilst it was on and now my pc can’t book, I tried to make a flesh install but whenever I reach the DE installation which is gnome, am getting keyring problems, I don’t know what am missing coz even after installing archlinux-keyring I still get the same error, is there a way I can solve the keyring problems.

Here’s a page on troubleshooting and fixing keyring problems for Arch and Arch-based distros:

https://wiki.archlinux.org/title/Pacman/Package_signing#Troubleshooting

Hopefully that will help you get back running again. :smile_cat: :penguin:

1 Like

Ouch. Hope you had a backup of your data.

For fresh install, maybe something is not right with your networking? Or maybe your arch iso is too old now? Try grabbing a new one, see if it works.

Thank you very much let me do the suggestions then I will come back with the feedback, am very grateful.

2 Likes

Thank you very I solved my problem of keyring, I followed the above link and followed all the step, am now back and running.

2 Likes