Btrfs @/home on a different partition than /?

Btrfs @/home

I have always installed /home on a different partition than / to make updates and installs easier and to retain my personal settings and apps.

What is the process to do that in Btrfs? Is it any different than Ext4? Can the Btrfs system deal with spanning 2 partitions?

New to Btrfs, and don’t want to mess anything up.

thanks.

No. You create a separate filesystem on a separate device.

Yes, but it does not answer you question.

I don’t know if this answer your question, but during installation you’ll have the choice to choose your preferred scheme…

If I use partition to change the /home to a new partition, how do I move the existing /home contents to that new location?

mv, cp, cpio, tar, rsync, btrfs send/receive, ...

Pick your choice. Or explain your question in some more details.

Currently /home is in a single partition of Btrfs under /
I would like to add a new partition and move the existing /home to that location.

In general I understand:
1 - create a new partition /new-home
2 - copy the existing /home to the /new-home
3 - change the fstab to direct /new-home & rename to /home
4 - delete the previous /home
What I would like help with is what are the best methods to do that to ensure the permissions, links, etc remain intact and working at the new /home.

No. It is not a “partition”, it is “subvolume”. You need to learn the difference to avoid confusing yourself and others.

I do not understand what it means. Show the proposed changes.

You confuse partition (raw disk area), filesystem (the content of this area) and mount point (directory where the filesystem is made accessible). If you mount your new filesystem on /home and delete /home you will delete the content of your new filesystem.

Thank you for the information. In the meantime the question is still the same.

What is the correct process to:
Create a new /home in another partition,
Copy all of the existing /home contents into that new partition,
Have the system use the new /home,
Lastly to delete the old /home.

Please disregard the previous post. I was editing and took too long I could no longer change the one above. Below is what I intended to post.


Thank you for the information above. In the meantime the question is still the same.

1-What is the best method to copy all of the existing subvolume @/home contents?

2-The main problem is my existing partition is too small for brtfs and this new installation. I have the space to create a new partition and move the @/home subvolume to it. Can a subvolume span 2 partitions?

Is the answer as simple as using gparted and expanding the existing partition?

The process if it was a Ext4 partition:

With gparted or yast partitioner, create a new partition, and set the mount point to "/newhome "

Copy the existing /home contents (question above) into the new partition with the mount point “/newhome”

Verify all the data is there

Using yast partitioner or Gparted, change the mount point for “/home” on the old partition to “/oldhome”. Then on the new partition change “/newhome” to be “/home”.

Reboot, and the system should now be pointing to the new partition with the mount point “/home”.

What, in these steps needs to be different since it is a Btrfn format that uses subvolume @/home?

No different.

1 Like

Thanks for your answer

You cannot do it in btrfs. There is no way to control location of data in individual btrfs subvolumes.

Yes, it can - implicitly, if filesystem consists of several devices. But then any data in any subvolume can be on any of these devices, not just data belonging to a single subvolume.

arvidjaar; Can you please further explain your last point?

gogalthorp; Applying what you said, if I set a new partition with Ext4 and a mount point of /home (in fstab), will that then “overrule” the subvolume of @/home that is created automatically on the Btrfs partition that was installed?

You confuse partition, mount point and subvolume. Yes, the filesystem on the new partition will be mounted on /home, so you will see the content of this filesystem. No, it has no impact on @/home subvolume which will continue to exist. It can even be mounted somewhere else.

It may be helpful if you think of BTRFS subvolumes as things that you can mount and take snapshots of. With EXT4 you basically have one thing you can mount, the root of the filesystem, and there’s no filesystem support for snapshots. (There are, as always, more complications like bind mounts, but that’s a view into a hierarchy while subvolumes provide separate hierarchies.) With BTRFS you also have a root of the filesystem, which is called the top-level subvolume. You can then add as many or as few other subvolumes as you like below the top-level, you can mount some, nest them, whatever.

Anyway, as you’ve been advised, for what you want to do, you would create a separate filesystem inside of the other partition. That filesystem won’t be part of the existing BTRFS filesystem you have for your system, but it will be part of the system’s file hierarchy because it will be mounted to /home, just like you can mount disks at /mnt or /run/media/ or wherever, and then their contents will be visible to the rest of the system at those paths because *nix is awesome like that.

You can use btrfs, ext4, xfs, or whatever else you like. With btrfs, I’ll just mention that you wouldn’t need to create any subvolumes inside of the new filesystem, although it wouldn’t hurt either. The main reason why your system has a separate subvolume for home is because you generally don’t want home to be part of system snapshots (the stuff in usr/ and etc/ and so on) and you may want to take separate snapshots of /home as well. Snapshots are always of a single subvolume, even if it has nested subvolumes. So subvolumes are snapshot boundaries. With separate filesystems that issue doesn’t apply.