I can't merge these free spaces somehow.
1 Answer
The free spaces are not physically adjacent: there is a swap partition in the way.
If using LVM, you could make partitions out of both chunks of free space, pvcreate
them, create a VG using both new PVs, and then lvcreate
to create a logical volume that would use both of them as one seamless unit.
Or you could temporarily disable swapping with swapoff -a
, delete the swap partition, use partprobe /dev/sda
to make sure the kernel recognizes the new partitioning, and then create a new swap partition + whatever you want to do with the remaining space. Remember to mkswap
the re-created swap partition before use.
If you do the latter, remember to find all the references to the swap partition and fix them as necessary. There's going to be one in /etc/fstab
, but there might also be one at /etc/initramfs-tools/conf.d/resume
if it's a Debian/Ubuntu-style distribution, or probably somewhere under /etc/sysconfig/
if it's RedHat/Fedora-style. Finally run swapon -a
to verify that the swap activates correctly, and perhaps recreate your initramfs file to make sure the initramfs boot phase won't try and find the old swap partition.
-
Deleting and recreating the swap partition worked. Thank you so much! I never would have guessed something as easy as deleting the swap partition would solve my problem.– user365910Aug 9, 2020 at 13:09