Repartition to a separate / and /home

A freshly installed Manjaro. There is a /boot/efi partition and there is a large btrfs partition mounted at Filesystem Root.

I will like to separate / and /home.

Is there a safe way of doing it without re-installation? How to do it?

I will prefer to stick to some GUI app. But if needed, can use command line on terminal.

I think a separate @home BTRFS volume is part of the default installation
as well as a couple more
If you only have @ (the / subvolume) then you must have explicitly wanted that.

Creating more subvolumes should not be a problem with BTRFS.

If you really want physically separate partitions then I can’t give advise in good conscience - I have very little knowledge and zero experience with BTRFS.

3 Likes

The first question is what are you trying to do? As it’s on its own subvolume, it is probably a simple single command.

btrfs always comes with btrfs-tools, and it can do a lot of things in one place.

man btrfs-subvolume

# For commands like 
sudo btrfs subvolume list /
1 Like

With btrfs there is really no need to. By default, calamares — i.e. the Manjaro installer — will create four dedicated subvolumes, being…

  • @ : your root subvolume, /
  • @home : the subvolume holding /home
  • @cache : the subvolume holding /var/cache
  • @log : the subvolume holding /var/log

btrfs subvolumes are like separate partitions, in that they each have their own inode tree, and they can (to a certain extent) be mounted with their own distinct mount options. However, they do all share the total amount of free space on the btrfs filesystem, and therefore, the individual subvolumes do not have fixed size limits, as would be the case with individual physical partitions.

timeshift also by default only creates snapshots of the @ subvolume, so that the system can be rolled back to a previous state without losing anything you’ve recently changed in your home directory, and without overwriting the system logs, so that you can still inspect them for the sake of forensics. And of course, the content of /var/cache is by definition disposable — a cache can always be rebuilt — and therefore its inclusion in a snapshot is not needed either.

That all said, perhaps you can take a look at this thread below in order to familiarize yourself with btrfs. :backhand_index_pointing_down:

Yes, there is, even though there’s no point. But you could shrink your system partition and then create an additional partition behind it. You can do this with gparted, which is a flexible GUI partition manager.

However, once you’ve then created the new partition and designated it to be mounted at /home, you’ll need to move everything over from the @home subvolume on the system partition to the new partition, and you’ll need to do that from within a live session — chrooting is not necessary — because once the new partition is mounted to /home, whatever was in /home before will not be accessible anymore.

I’ve created a tutorial a while ago that touches upon this subject, albeit that it was written before Manjaro started installing btrfs as the default filesystem. :backhand_index_pointing_down:

Still, the principle is roughly the same — you only need to make sure that you mount the @home subvolume at a temporary directory in the live session, and the partition you intend to use as /home at another temporary directory in the live system, and then move everything over.

After that, you must remove the @home subvolume on the main filesystem and replace it with a common directory called /home.

In closing, I would however recommend against it. I used to have a setup with distinct partitions as well, even though they were all formatted as btrfs — except for /boot, which was ext4 — but I’ve overhauled my entire system — without reinstalling, even though I did need to restore from a backup — to a unified btrfs filesystem with subvolumes. The only exception is my /boot partition, which is also btrfs, but it sits in front of the root filesystem, and therefore it was too dangerous to delete it and move the root filesystem to the left.

Really, you should stick with the setup you have. It’s very robust, and actually far more fault-tolerant than ext4.

2 Likes

Thanks all. That clarified almost all the points. Just one point, though.

If I need to reinstall the system (or, may be try a different distribution), can I do that without affecting my /home which is on @home subvolume?

Use a completely separate disk for the second OS – this is the safest method of multi-booting – however, if you use a laptop, that’s often not an option.

If you’re trying other Linux distributions, I might suggest using the ext4 filesystem for the sake of convenience.

You just delete all subvolumes but @home.

But as said, that is dangerous.

Different versions of apps and libraries could save certain formats to disk, something as simple as an app configuration setting. It can easily break in many ways popping your /home into a whole new environment. (Or you may not get it back, once going one way and seemingly working so far.)

But btrfs with snapshots, I say hell yeah. Have some fun. :grinning_face:

Yes, if you opt not to format the partition. As @Molski said, all you need to do then is delete the @, @cache and @log subvolumes from within the live session — see… :backhand_index_pointing_down:

man btrfs-subvolume

The things would have helped, at least me, jumping into btrfs. (With knowledge of many other file systems, including CoW based.)

1. Never fill a btrfs file system

I’ve done it once. For me, it was scary, but easily recoverable. But just don’t. btrfs can do so much, but only if you give it room.

(It’s unfortunate, that it handles it this way.)

2. There’s a top level subvolume?

sudo mount /dev/.. -o subvolid=5 /mnt

btrfs reserves subvolume ID number 5 for the “top level” volume. You can always see everything mounting it this way. Otherwise it will use whatever volume the btrfs sub get-default volume is if you don’t specify the subvolume.

And if you use snapshot software..

  • Timeshift (Much easier, and can you do pretty much everything through the GUI.)
  • Snapper (More setup, more command line, more features.)

You can see and manage your snapshots living on the file system here.

3. Your root is now: @

You have most likely noticed this all ready. But this is only a convention to start volume names with @. The “at sign” by itself should be the subvol name of the root subvolume.

Everything else I’ve run into also follows this convention, including grub. So whatever volume is called @, is your root.

Now don’t just move your root around. There are other steps. But it really is almost that easy.

The big takeaway here, is that everything that needs to mount your root, essentially does it like:

sudo mount /dev/.. -o subvol=@ /mnt

4. btrfs-progs (or the btrfs command) may be weird sometimes

This could only be me, and from working on other CoW file systems, but I expected commands to be there. And they weren’t.

Like you can copy and delete subvolumes but not: btrfs subvolume rename? Nope. :cross_mark:

You just mv them after you mount it like any folder, pretty much any command works on them.

So you are always passing parameters relative to where you mounted it in your shell, whether it’s any part of a btrfs FS, a subvolume, folder, or a file. Some commands do take explicitly take --subvol or --subvolid, otherwise it’s just a path to where you put it.

You can delete, copy, or whatever on subvolumes directly too, if you wish. Though there is a delete command, and there are better ways to copy a whole volume.


Maybe this was only me. :person_shrugging:

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