So you want to use the unallocated partition 3 space, and combine partitions 4 and 5? As flexible btrfs is, I’m pretty sure you cannot do this with resizing.
I’m assuming you are using the default subvoulmes: @, @home, @var/cache, and @var/log. Since you have unallocated space that precedes your first btrfs partition, this makes it slightly more complicated. Since I’ve restored Manjaro from snapshot backups this way quite a few times, so I would go about it this way… But you will need ~200G of space elsewhere whether it’s an external USB drive or whatever.
First you would have to transfer the data off. You can can do this on a live system by taking a snapshots. (Or you can just do all this from a live boot, but I’ll just keep going ahead with the snapshot way.). I’ve been loving btrfs send/receive for doing this kind of stuff, but the destination has to be a btrfs filesystem. When btrfs sending a snapshot it has to be read only. If you’re using Timeshift which Manjaro comes with, that’s fine, but you will have to set the snapshot to read only since Timeshift is hard-coded to make read/write snapshots. I’ve just never dealt with my home volume on a different device/partition, so I’m not sure how it handles your @home volume. There’s always just btrfs subvolume snapshot -r
too.
After creating the snapshots, mount your /dev/nvme0n1p4 and p5 drives to /mnt/root and /mnt/home for example. If you used Timeshift, you can set them to read only by the command:
btrfs prop set /mnt/root/timeshift-btrfs/snapshots/2023-01-XX_XX-XX-XX/@ ro true
btrfs prop set /mnt/home/timeshift-btrfs/snapshots/2023-01-XX_XX-XX-XX/@home ro true
Adjusting the path to the actual snapshots, I just preceded the path to the Timeshift default location.
So wherever you have ~200G of space, mkfs.btrfs /dev/XXX
it if it’s not btrfs. And mount it, to a location like /mnt/backup. Now you can copy the snapshots over.
This is done by a simple: btrfs send SOURCE | btrfs receive DEST
Assuming the paths are somewhat like the above, these would be the commands:
btrfs send /mnt/root/timeshift-btrfs/snapshots/2023-01-XX_XX-XX-XX/@ | btrfs receive /mnt/backup
btrfs send /mnt/home/timeshift-btrfs/snapshots/2023-01-XX_XX-XX-XX/@home | btrfs receive /mnt/backup
Minus the EFI partition, you now have a complete backup of your system. Since we’ve made it this far why not do that too.
dd if=/dev/nvme0n1p1 | xz -c | dd of=/mnt/backup/nvme0n1p1.efi.xz
There’s many ways you can do this, but I just dump the entire partition, since it’s very quick and compresses to 126k for me.
Now for the dangerous part. I would make sure you have your all your data in /mnt/home and /mnt/root. Run commands like diff -qr
and btrfs filesystem usage /mnt/root
and see if the Used:
space correlates with your live system volumes.
Now is when you will need to live boot for the rest.
Now you can delete all your partitions after your p2 swap partition. Then just recreate one big btrfs partition for p3 in all that space.
This is taking much longer than I anticipated. Actually, let me know if you want me to continue with the restore part. I’ll be coming back in a few hours.