Figuring out how to add space to fedora partition

I hope you have a backup, because you might break your system. But it should be fine.

What you would normally do

You create a new partition using that space. I see that you already did /dev/nvme0n1p4, but it’s formatted as a Linux FS (probably ext4).

fdisk /dev/nvme0n1
t
## change type of a partition ##
4
## select partition 4 ##
30
## 30 is usually Linux LVM, make sure that is correct by pressing L before this ##
w
## write changed ##
q
## quit fdisk ##


vgextend fedora_localhost /dev/nvme0p1n4
## extending the volume group of which your root, swap and home logical volumes and partitions are part of ##
lvextend -L +60G /dev/mapper/fedora_localhost--live-root
## expanding your root logical volume with 60GB
lvextend -l +100%FREE /dev/mapper/fedora_localhost--live-home
## expand your home logical volume with the rest of the available free space on the volume group named fedora_localhost ##

resize2fs /dev/mapper/fedora_localhost--live-root
## actual resize of the root partition, in case you added 60 GB ##
## NOTE: resize2fs ONLY WORKS WITH EXT4 ##
resize2fs /dev/mapper/fedora_localhost--live-home
## actual resize of the home partition ##

In your situation I have no idea what commands you have ran. Normally you would have to run vgextend on your volume group, using the nvme partition 4 as your new space to allocate. Ok, let me explain.

So, normally a disk would have a bare partition on it, like say formatting /dev/sda1 as ext4 or as ntfs. What LVM does is what its name implies: Logical Volumes. What are logical volumes? Well, in short, it allows you to have a whole file system reside on multiple physical disks, or in this case, multiple partitions, kinda like RAID0 (but not really). Well, LVM does more (like snapshots) but I won’t get into what it does.

LVM works this way: you have Physical Volumes (pv). a PV is a physical partition on a drive. Then, LVM has something called Volume Groups (vg). VGs can hold inside them multiple PVs, either multiple partitions from a single drive, or partitions from multiple drives, or a single partition, or any combination you want. Volume Groups define a “total amount of space” available. After that, you get into Logical Volumes (lv). Those are basically “partitions” on volume groups. I mean, partition, as in partitioning a volume into multiple smaller parts. You can have a single big LV spanning the entirety of a VG, or as is in your case, multiple LVs on a VG. Then, on top of the LV, you add a file system. That is, you format a specific LV with a certain FS, in this case it’s most likely ext4.

So, now that you hopefully understand how LVM works, let’s continue.

It is weird that you see nvme0n1p4 inside the LVM group in lsblk. I believe you already ran vgextend. I can see in your vgs output that you have 2 PVs, which can only be physical NVME partitions 3 and 4. So, from there, you should be able to just run

lvextend -l +100%FREE /dev/mapper/fedora_localhost--live-home
resize2fs /dev/mapper/fedora_localhost--live-home

And be good to go. Unless you want to add some storage to root or swap too, which I show how in the above.

The reason why you are seeing home and root on 2 partitions is because the LV reside on 2 partitions. It’s not that it has created a new home and root folders, it’s that your /home and / folders (actually the entire /home and / ext4 partitions) reside on 2 physical disk partitions (nvme0n1p3 and nvme0n1p4). If you add another disk, format it as LVM and expand the same volume group, you will see that now root, home and swap reside on 3 partitions.

Note that in your lsblk output, swap still resides only on partition 3. I guess you have expanded your root and home partitions on the new partition.

Also worth explaining is that LVM is not exactly RAID0, i.e. it doesn’t balance data between 2 disks and you don’t need the same size disks (or partitions) to run LVM. But just like RAID0, if you lose a partition or disk that is part of a volume group, you lose the whole data on the volume group. You may be able to recover some portions of the data that still remained on the disks that still work, but it will be a royal PITA to get even that back.

If you didn’t have LVM and just had plain ext4 on your / and /home, you would have been able to use gparted (that you show in a screenshot) to expand the partitions directly (if they were unmounted, or if you were on a live USB environment). But LVM allows you to expand both your root and whatever other partition on-the-fly, avoiding down-time. But it’s also nifty if you want to have a single volume spanning on multiple disks without using RAID (due to same size requirement of RAID).

1 Like