Can I resize the root volume?

I have some unallocated space that I would like to allocate to my root partition. Is it possible? I opened disks and the option for resizing the root partition is greyed out.

You can’t easily resize it when it is mounted.

If you boot off a live ISO, you should be able to. However, without knowing more about what filesystems you are using it is hard to say for sure.

1 Like

IIF you are using fedora 34 with btrfs then resizing should not be necessary.
IIF you are using LVM with ext4 then enlarging it while online is doable. Shrinking, OTOH must be done when the OS is not running.
IIF using another filesystem type it may or may not be possible.
IIF using a fixed partition size then how you resize is dependent upon disk partition arrangements, where the free space is, and what your goal is.

We need a lot more info before we can give you informed guidance.

Output of “sudo fdisk -l”, “df”, and “lsblk”, combined with a description of your goal would be a good start.

The answer to your query will vary depending on many factors like others have suggested.

Here is a trivial response. A simple scenario where this would be possible is when the unallocated space is adjacent to the root volume. A few situations in the past when I have done such an exercise, I found the easiest route was to create a gparted boot USB, boot off it and alter partitions. If the exercise alters the UUID of partitions, the root partition would need to be mounted to update the /etc/fstab accordingly.

How about you describe your disk layout a bit more specifically for a start - like so

sgdisk -p /dev/sda

I have a 256 GB SSD with 50 GB free space that I would like to allocate to the root partition. This is what it looks like on disks. I had a USB ISO of fedora so I aleady tried booting it up to see if I could resize the root partition with that not mounted and I couldn’t. It was still greyed out in disks -

output of ‘sudo fdisk -l’, ‘df’ and ‘lsblk’ -

[Destinyblade@fedora ~]$ sudo fdisk -l
[sudo] password for Destinyblade: 
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: WDC WD10SPZX-60Z
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: B873B1D6-2947-4888-981D-8A36C2C90ED0

Device         Start        End    Sectors   Size Type
/dev/sda1       2048  756058111  756056064 360.5G Microsoft basic data
/dev/sda2  756058112 1953523711 1197465600   571G Linux filesystem


Disk /dev/nvme0n1: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: SK hynix BC511 HFM256GDJTNI-82A0A       
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: D74E3B6F-D252-4021-A3D6-632DB4619FEC

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    534527    532480   260M EFI System
/dev/nvme0n1p2    534528    567295     32768    16M Microsoft reserved
/dev/nvme0n1p3    567296 289062911 288495616 137.6G Microsoft basic data
/dev/nvme0n1p4 499140608 500105215    964608   471M Windows recovery environment
/dev/nvme0n1p5 394280960 396378111   2097152     1G Linux filesystem
/dev/nvme0n1p6 396378112 499140607 102762496    49G Linux filesystem

Partition table entries are not in disk order.


Disk /dev/zram0: 7.54 GiB, 8092909568 bytes, 1975808 sectors
Units: sectors of 1 * 4096 = 4096 bytes
Sector size (logical/physical): 4096 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes


Disk /dev/loop0: 219 MiB, 229638144 bytes, 448512 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop1: 65.1 MiB, 68259840 bytes, 133320 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop2: 77.16 MiB, 80904192 bytes, 158016 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop3: 55.44 MiB, 58134528 bytes, 113544 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop4: 50.96 MiB, 53432320 bytes, 104360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop5: 164.76 MiB, 172761088 bytes, 337424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop6: 166.02 MiB, 174084096 bytes, 340008 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop7: 32.29 MiB, 33853440 bytes, 66120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/loop8: 32.3 MiB, 33865728 bytes, 66144 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
[Destinyblade@fedora ~]$ 

[Destinyblade@fedora ~]$ df
Filesystem     1K-blocks      Used Available Use% Mounted on
devtmpfs         3931916         0   3931916   0% /dev
tmpfs            3952056     14124   3937932   1% /dev/shm
tmpfs            1580824      2244   1578580   1% /run
/dev/nvme0n1p6  51381248  32228756  18936396  63% /
/dev/nvme0n1p6  51381248  32228756  18936396  63% /home
/dev/nvme0n1p5    999320    195904    734604  22% /boot
/dev/loop0        224256    224256         0 100% /var/lib/snapd/snap/gnome-3-34-1804/72
tmpfs            3952056        68   3951988   1% /tmp
/dev/nvme0n1p1    262144    101228    160916  39% /boot/efi
/dev/loop1         66688     66688         0 100% /var/lib/snapd/snap/gtk-common-themes/1515
/dev/loop2         79104     79104         0 100% /var/lib/snapd/snap/discord/128
/dev/sda2      588287160 234200952 324133184  42% /mnt/83e58ee1-30ea-4093-91cc-005980994c71
/dev/sda1      378027496 227836380 150191116  61% /mnt/BC00C39700C356D4
/dev/loop3         56832     56832         0 100% /var/lib/snapd/snap/core18/2074
/dev/loop4         52224     52224         0 100% /var/lib/snapd/snap/snap-store/547
/dev/loop5        168832    168832         0 100% /var/lib/snapd/snap/gnome-3-28-1804/161
/dev/loop6        170112    170112         0 100% /var/lib/snapd/snap/signal-desktop/365
/dev/loop7         33152     33152         0 100% /var/lib/snapd/snap/snapd/12398
tmpfs             790408       160    790248   1% /run/user/1000
/dev/loop8         33152     33152         0 100% /var/lib/snapd/snap/snapd/12704
[Destinyblade@fedora ~]$ 
[Destinyblade@fedora ~]$ lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0         7:0    0   219M  1 loop /var/lib/snapd/snap/gnome-3-34-1804/72
loop1         7:1    0  65.1M  1 loop /var/lib/snapd/snap/gtk-common-themes/1515
loop2         7:2    0  77.2M  1 loop /var/lib/snapd/snap/discord/128
loop3         7:3    0  55.4M  1 loop /var/lib/snapd/snap/core18/2074
loop4         7:4    0    51M  1 loop /var/lib/snapd/snap/snap-store/547
loop5         7:5    0 164.8M  1 loop /var/lib/snapd/snap/gnome-3-28-1804/161
loop6         7:6    0   166M  1 loop /var/lib/snapd/snap/signal-desktop/365
loop7         7:7    0  32.3M  1 loop /var/lib/snapd/snap/snapd/12398
loop8         7:8    0  32.3M  1 loop /var/lib/snapd/snap/snapd/12704
sda           8:0    0 931.5G  0 disk 
├─sda1        8:1    0 360.5G  0 part /mnt/BC00C39700C356D4
└─sda2        8:2    0   571G  0 part /mnt/83e58ee1-30ea-4093-91cc-005980994c71
zram0       252:0    0   7.5G  0 disk [SWAP]
nvme0n1     259:0    0 238.5G  0 disk 
├─nvme0n1p1 259:1    0   260M  0 part /boot/efi
├─nvme0n1p2 259:2    0    16M  0 part 
├─nvme0n1p3 259:3    0 137.6G  0 part 
├─nvme0n1p4 259:4    0   471M  0 part 
├─nvme0n1p5 259:5    0     1G  0 part /boot
└─nvme0n1p6 259:6    0    49G  0 part /home
[Destinyblade@fedora ~]$ 



Should I put the preformatted text in a pastebin next time? I don’t know if something this long is fine for this forum

The free space has to adjacent to the partition you want to expand. Your free space has other partitions in the way. You need to move the partitions around so that the free space is next to the root partition.

I’m your case, move partition 5 to other end of the free space. Then you can expand partition 6

how do I move a partition?

Edit: I don’t see any option for this in disks. I installed Gparted and I see an option called resize/move. I clicked on it for partition 5 and I can’t do anything with it at all

I don’t think gparted lets you modify a mounted disk. If it is your /boot partition, you can unmount it, move it and then mount it again. Just don’t forget to remount it :slight_smile:

it is the /boot partition that I need to move around but Gparted can’t unmount it, saying - target is busy.

So I assume the solution here would be to boot up live USB fedora, install Gparted on it and then move and resize since those partitions shouldn’t be mounted when booting with a USB instead?

That would be one easy way to solve the problem, yes.

1 Like

gparted has a LiveUSB

https://gparted.org/liveusb.php

2 Likes

If I understand what you want to do, is to increase the root partition with unallocated space, with btrfs it’s simple: Format the unallocated space in Btrfs and at add to volume “/”:

sudo btrfs device add /dev/nvme0n1pN /
2 Likes

I already did it. I’ll keep that in mind for later though

I add the documentation with more details: https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices#Adding_new_devices

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.