You are not logged in.

#1 2015-06-07 21:56:01

banana_pancakes
Member
Registered: 2015-06-06
Posts: 19

[Solved] Mounting btrfs subvolume into a non-root subvolume

I'm looking for a way to mount a btrfs subvolume when I'm not booting from the root subvolume.

Here's the description of my hierarchy:

  • I have a toplevel subvolume (root) which is where I boot into and mount '/' ("subvol=root" specified in the bootloader's rootflags)

  • /home is also a subvolume (root/home) (no /etc/fstab entries)

  • Finally, the rest of the subvolumes/snapshots are under root/subvolumes (which are found in /subvolumes)

What I've done:
I took a snapshot of /, placed it under /subvolumes. And changed the boot param to "subvol=root/snapshots/snap1". It's the same kernel so it works on the same initramfs. I now reboot into this snapshot. It works, but of course, it doesn't have /home mounted.

What I'd like to do
I would like to mount /root/home into the current /home. To do this, I assume I need to mount the subvolume. It seems like a basic thing, but I can't figure out how to do it, even though I've read that subvolumes are supposed to be mountable. A simple

mount -o subvoldid=x /home

doesn't cut it, and fails with a "can't find /home in /etc/fstab".

I've also seen this related post which suggests an alternative hierarchy but also casually mentions "you mount btrfs to something like /mnt/ctrl" without specifying what it means to "mount btrfs" or how that's done. I assume he means to mount the toplevel btrfs subvolume. Any ideas?

edit: marked as solved

Last edited by banana_pancakes (2015-06-08 08:06:03)

Offline

#2 2015-06-07 23:12:54

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,896
Website

Re: [Solved] Mounting btrfs subvolume into a non-root subvolume

You need to tell mount which filesystem you want to mount (e.g. /dev/sda3).

mount -o subvolid=x /dev/sda3 /home

You can use subvol, instead of subvolid.

mount -o subvol=home /dev/sda3 /home

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#3 2015-06-08 08:04:50

banana_pancakes
Member
Registered: 2015-06-06
Posts: 19

Re: [Solved] Mounting btrfs subvolume into a non-root subvolume

It worked, how silly of me. The error message could have been more descriptive since the number of parameters to the mount command is wrong hmm, but I guess it works with different number of parameters depending on the flags (e.g. -o remount). I did not expect that.

Well, at least I posted in the correct forum section tongue

Thanks, WorMzy! Marking as solved.

Offline

Board footer

Powered by FluxBB