Increase disk space

hello, I am new to fedora and just installed it on my raspberry pi. I noticed, that the / partition is just about 5,4G. How can I increase that? :confused:

lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda               8:0    0 238,5G  0 disk
├─sda1            8:1    0   600M  0 part /boot/efi
├─sda2            8:2    0     1G  0 part /boot
└─sda3            8:3    0   5,4G  0 part
  └─fedora-root 253:0    0   5,4G  0 lvm  /
zram0           252:0    0   7,6G  0 disk [SWAP]

Actually it looks like that, the sda is a 256GB NVMe and I want to increase the root partition. thx in advance!

so long

edit: xfs is being used.

There are many ways. I would boot from a live linux image USB device that includes some GUI partitioning tool (I think gparted is the easiest) and then use that tool to increase the partition size (and automatically increase the fs size inside the partition).

If you use command line tools, I think increasing the fs size will be a separate step after increasing the partition size.

lvm adds some extra flexibility to the process (more choices about how you add space). But I’m pretty sure the xfs has to be unmounted in order to extend it, so I think booting from usb is still required, in which case the extra flexibility of lvm doesn’t help you and is best ignored.

BTW, I actually use a live KDE spin of Fedora, which doesn’t include gparted, but I find such tasks enough simpler with gparted that I install gparted in the running live system and then use it, even though it will be gone again on the next reboot. If your live linux image doesn’t include the GUI partitioning tool you use, installing it before use is an easy extra step.

thank you, due using the client headless I would prefer a cli tool. I am confused because sda3 also has 5,4G. thx

sda3 is partition3 on device sda. fedora-root is your logical volume on sda3.

you can run sudo lvs, sudo lvdisplay fedora_root and sudo pvs to learn more.

sda3 contains the / filesystem. That 5.4G is not a different 5.4, but the same one reported twice.

There are many online guides you can find for the command line method of extending an lvm and the fs contained in the lvm. Those are easy to find with google.

I’ve never done any of that, so I can’t help.

If you need more than you can get with google, I hope my answer here hasn’t stopped someone who knows the command line approach from answering.

But, is that 256GB device easily removable and if so, do you have an easy way to connect it to GUI computer? Years ago, when one of my sons did classwork using a raspberry pi, all partitioning tasks etc. were done by temporarily moving the ssd to an adapter in a usb port of a GUI computer.

not really. sda3 is a physical volume (PV) which hosts a Logical Volume (LV) with a file system. maybe do some reading about LVM.

Similar topic: How to add unallocated disk space to LVM /home

1 Like

A fairly simple way with cli tools would be e.g. something like:
-use fdisk or gdisk and create /dev/sda4 from free space
-do a pvcreate /dev/sda4
-vgextend fedora /dev/sda4
-lvresize -r -L +25G fedora/root

Correct me if I’m wrong. But I think that step requires being booted elsewhere (such as a USB live image). As long as you need to be booted in a live image, you might as well go for the cleaner result (extend sda3 and the things directly and indirectly inside it).

If there had been other partitions in the way of extending sda3 then your way would be simpler. If I’m mistaken about what can be done to the xfs that Linux is running from, then your way would be a lot simpler.

Edit: apparently I was quite wrong about what can be done with a mounted FS. Thanks for the corrections.

I think the pvcreate step can be skipped (nowadays on fedora) but after fdisk/gdisk a partprobe or partx might be required if you want to do it rebootless. The lvresize has no problem growing the xfs filesystem with the lv online.

That command is related to using LVM for disk management and if used would not require offline management…

When I install any os on an sd card for my Pi I normally use fedora’s arm-image-installer with the --extendfs option so it resizes the root file system to the size of the sd card. I then do not have to mess with sizes later.

When I installed using the rpi-imager it did not resize the root file system, and I then had to use gparted and resize the partition and file system. BTW, expanding the root file system can be done while the system is booted and active when using gparted. I have done so with no errors.

If you read the man pages most file systems can be expanded while active, but cannot be shrunk in the same way.

A bit risky? Yes. But it was a freshly installed system. No risk to lose anything important.
I used these steps just today on a running system, without the need to reboot:
sudo fdisk /dev/mmcblk0

Command (m for help): d
Partition number (1-3, default 3): 3

Partition 3 has been deleted.

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 3
First sector (3328000-31116287, default 3328000): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (3328000-31116287, default 31116287): 

Created a new partition 3 of type 'Linux' and of size 13.3 GiB.
Partition #3 contains a LVM2_member signature.

Do you want to remove the signature? [Y]es/[N]o: n

Command (m for help): w

The partition table has been altered.
Syncing disks.

xfs_growfs /dev/mapper/fedora-root

1 Like