Expand my partition to a previous one

Hello guy, I had Manjaro installed here, and I was always getting trouble with my space in the root partition ( I have root and /home separeted), I was trying to delete some cache files and acidentally destroyed my old root. I installed manjaro again separated. But now, I want to delete the old root and use it togheter with my home. Here is my Gparted.

What I want is to expand my /dev/nvme0n1p4 with this unallocated space, there is a way to do that? I just can think in create a new partition in the unallocated space copy files from my /home format my /home and then expand the new partition to it. There is a simpler way?


I’ve never used btrfs but with ext4 you could expand nvme0n1p4 to the left, however, it will be very slow, around 20min I’d think.

Obviously this would need to be done using gparted from a booted manjaro live usb and you should make sure that all power saving on the live system is deactivated so the system doesn’t suspend or lock you out during the process.

1 Like

Oh, I think that’s the reason I couldn´t, I was trying to do it from my running OS, I thought I just need to do things like that for the root partition. I will try it

The partition has to be unmounted by gparted during the resizing, that would not go well if it’s your actual home. Basically, always use live usb when resizing a single drive system.

1 Like

In btrfs you usually work with one volume(1 partition (or RAID) ) and with several subvolumes for /, /home, /var, …

If you change partitions, you should make a backup beforehand !

Make Backups:

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.

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