Issues Moving/Cloning Manjaro BTRFS Partition

I’ve been trying to move my Manjaro partition to another place on the disk, but I had problems with my approach.

Now, after deleting a defective linux mint partition /dev/sda2 which was on the first portion of my disk I ended up with a lot of empty space, which I intend to fulfill by either moving back my Manjaro partition /dev/sda3 to the place where linux mint stood or clone sda3 to a new sda2 partition, boot from there, delete sda3 and grow the new partition.

Both approaches have been problematic since when trying to move the sda3 partition, gparted throws an error when checking sda3. It is a error thrown by the command btrfs check and it says “errors” but not exactly which one. The output is as follows:

$ btrfs check /dev/sda3                                                                                                                                               

Opening filesystem to check...
Checking filesystem on /dev/sda3
UUID: e1772e86-7c31-4e43-a88b-ce17bc8ad783
[1/7] checking root items
[2/7] checking extents
[3/7] checking free space cache
[4/7] checking fs roots
[5/7] checking only csums items (without verifying data)
[6/7] checking root refs
[7/7] checking quota groups
found 148458024960 bytes used, error(s) found
total csum bytes: 141281076
total tree bytes: 2346696704
total fs tree bytes: 1974140928
total extent tree bytes: 157073408
btree space waste bytes: 532324234
file data blocks allocated: 1012668215296
 referenced 208511270912

When trying to do what I want with the second approach by cloning my /dev/sda3 into /dev/sda2 with dd it clones just fine but I was not able to boot from there, even after changing my fstab to specifically boot from there. This seems to be more complicated so I would prefer to fix the issue by the first approach and try to go further with this only if the first solution is not possible.

I have a backup of my important files but I really don’t want to have to do a new install from scratch here. What can I try next?

Since you using BTRFS im out, but i added BTRFS to your Topic Title.

To clarify which filesystem you need help with.

Edit:
I hope that you are aware that BTRFS is a difficulty Filesystem for advanced user’s.

Im not saying that you shouldn’t use that, but i find it strange that a Mint user… where the average user normaly decide when using a easy distro like that but then not using ext4 which is much more userfriendly.

Generally speaking moving and changing partitions will change UUIDs, so you will at the very least have to update them in the fstab and the grub config.
But i am also out on the btrfs. Maybe it is different there. No idea.

Hope I am not too late but I’ll drop my thoughts in any case. A simple two step resize would have worked if Manjaro lived in /dev/sda2 instead like in this SUSE documentation on resizing BTRFS filesystem.

However, you might still be in luck with the help of btrfs-replace to move the stuff from sda3 to sda2. The term “devices” is used by them address both physical devices and partitions as mentioned in the glossary. So, in theory, you just have to make a large enough BTRFS partition where the old sda2 was and use the btrfs replace ... to move the data. I haven’t done this myself, this is just my understanding about how replace function should work. This walk-through shows how you can do it with physical devices (it also says using dd to replicate btrfs partitions is a bad idea), it maybe simple as replacing the device parameters (/dev/sdX) with partions (/dev/sdaX) instead.

Keep in mind that you will still need to update entries in /etc/fstab and update grub while chroot’d inside the new sda2 to make Manjaro boot properly. If all that happened accordingly, you can resize/grow the file system easily as mentioned in the SUSE documentation i linked above.

Sorry I couldn’t test the theory immediately, just wanted to drop some quick pointers from what I know.

There is a way to keep the UUIDs
→ move the filesystem like described:

You find good Information about Btrfs in the wiki

:footprints:

(You need an empty partition with NO filesystem as destination !!! )

2 Likes

Oh wow, I guess I was overthinking the approach. Didnt realize btrfs can handle the move like that. Wiki (and BTRFS) ftw :smile:

After some digging I end up realizing that the issues thrown are still a reminiscent of this. Actually the btrfs check was founding issues related to the size of the physical partition contrasting with what btrfs thinks is the size of the partition. This was solved by momentarily shrinking the partition and only then moving it back, as it now does not believes to have a partition outside the limits of the disk.

My problem is solved but after trying this approach I’m still curious about the ways of having a cloned btrfs partition working.

Well while I don’t feel comfortable say that I’m an advanced user, the only reason why I pick those instead of something like Arch or even Gentoo is the amount of choices you have to make just to have a proper system working. I did experimented with those is the past, but nowdays I would rather stick with a solid starting ground and then build what I want from there. Also I find btrfs very interesting, and wanted to do something with it when I formatted this system 2yrs ago, so it explains how my choices led me here.

This is a point. When I was trying to solve this by cloning the partition I edited /etc/fstab to have the new UUID but despite that / was still booting from the old partition. Only the /home directory was accessible from the new partition which I found confusing and thus decided to do it by moving /dev/sda3 back.

I definitively will delve into that in the future to understand what happened but for now i have my disk working is I intended. Thanks everyone for the help!

2 Likes

Please tell us exactly how the problem was solved; tell us what you did; and indicate which post helped the most to solve it. Please click the :ballot_box_with_check: (tick) under whichever post that was, to show it solved your issue.

Marking your own post as the solution does not help others reading this thread later, who might have the same issue.

Thanks.

1 Like

The described solution for my problem is here

Shrinking the partition and trying to move it later using gParted did the trick for me, as it didn’t show any errors no more and my disk is now with the partitions the way I wanted them to be.

I marked my own reply as a solution because even though the responses were helpful I did not used them to solve the issue, but as I don’t have a problem anymore and I marked it to close the thread, but if this is not the correct approach how should I proceed then?

2 Likes

Maybe you missed that, but he did exactly this… he points with link to a solution to another topic that he recently found.

I think this is one of the Topic where the Topic Creator shouldn’t click on a solve button, but instead on a neutral Topic Closed button (A button that only admin’s have Strangely) which i find is a missing feature in this Forum.

1 Like

Indeed, this is what I might usually suggest for anyone concerned about misaligned partitions; to shrink a partition (even by 1mb) to allow the extent to again fall on an appropriate boundary. I always recommend GParted.

It seems the KDE partitioner (when used via Calamares) can occasionally leave partitions in this state, which may be disconcerting for anyone reading the warning messages, but is not necessarily harmful.

Because it’s BTRFS, this might have needed a deeper dive for the benefit of those reading later; a better explanation, maybe. I confess to only skimming through the thread, and likely missed your brief description.

Thanks for making an attempt, when so many would not.

A tutorial of sorts to help others in a similar situation might be a good idea. I’ll add that to my todo list, unless someone else does it first.

On reflection, at least in this instance, it was fair enough that the OP should mark their own post as the solution. However, there are so many cases where a marked solution was something like:

"I was so annoyed with this stupid problem that I just reinstalled the OS. It’s all working fine now… :slight_smile: " – this neither solves a described problem or helps anyone else with theirs; arguably the point of having a user forum.

So, @Kobold – I agree there is no provision for these situations – I think we are limited by the Discourse (forum software) options available. Some kind of workaround would be nice.

Ohh that’s bad, i thought we may have still the option if a forum dev changed the forum privileges a little. I was close to create a forum feedback topic, but when its sure that we can’t archive that, then i can save my time.

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