Skip to contentSkip to conversation

howto create subvolume at top level?

DISCUSSION Neal Becker 3 participants 5 messages Jun 1, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

[nbecker@nbecker2 ~]$ sudo btrfs subvolume create /home2 Create subvolume '//home2'
[nbecker@nbecker2 ~]$ sudo btrfs subvolume list / ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 257 path home2

This created home2 under root. How do I create home2 with top level as top level 5, at the same level as root?

IOW:

ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 5 path home2

Signature · 1 line
Those who fail to understand recursion are doomed to repeat it
#1 lore raw
Quoted 6 lines · Neal Becker

[ nbecker@nbecker2~]$ sudo btrfs subvolume create /home2 Create subvolume '//home2'
[ nbecker@nbecker2~]$ sudo btrfs subvolume list / ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 257 path home2

Quoted 8 lines

This created home2 under root. How do I create home2 with top level as top
level 5, at the same level as root?

IOW:

ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 5 path home2

To do this, you have to mount the top level of the btrfs filesystem somewhere. For example:

mount -o subvolid=5 /dev/sda2 /mnt/btrfs

Then you can create your home directory under the top level by doing

btrfs subvolume create /mnt/btrfs/home2

Signature · 1 line
Calvin Walton <[email protected]>
#2 lore raw
In reply to Neal Becker

Neal Becker posted on Mon, 01 Jun 2015 13:25:52 -0400 as excerpted:

Quoted 6 lines

[nbecker@nbecker2 ~]$ sudo btrfs subvolume create /home2 Create subvolume '//home2'
[nbecker@nbecker2 ~]$ sudo btrfs subvolume list / ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 257 path home2

Quoted 7 lines

This created home2 under root. How do I create home2 with top level as top level 5, at the same level as root?

IOW:

ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 5 path home2

Briefly stated, you don't. Just like / is the top of a Unix style directory tree, the root subvolume is the top of a btrfs subvolume tree. You can't go higher than that, and that's what the top level /is/.

But what are you actually trying to do? You _can_ change the default subvolume pointer so a subvolume other than root/5 is mounted by default, and you can nest subvolumes, so for most purposes, you can /pretend/ that some arbitrarily named subvolume is your top subvolume. Alternatively, you can of course mount subvolumes wherever you want in the directory tree.

Also see the subvolumes discussion and related FAQs on the wiki if you haven't.

https://btrfs.wiki.kernel.org/

Signature · 3 lines
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman
#3 lore raw

Duncan posted on Mon, 01 Jun 2015 17:51:19 +0000 as excerpted:

Quoted 11 lines
Quoted 7 lines

This created home2 under root. How do I create home2 with top level as top level 5, at the same level as root?

IOW:

ID 257 gen 66376 top level 5 path root ID 316 gen 66376 top level 5 path home2

Briefly stated, you don't. Just like / is the top of a Unix style directory tree, the root subvolume is the top of a btrfs subvolume tree. You can't go higher than that, and that's what the top level /is/.

OK, I see now, you already have a subvolume called root, that's not ID5, the root (aka top level ID5) subvolume. Thus it's ID 257. Fine distinction.

Calvin W is correct. Mount the top level subvolume and create there. What you're doing now is actually what I suggested with the nesting, and your "root" subvolume <> the top-level ID5 subvolume. I'll claim just waking up and not having my caffeine yet. =:^)

Signature · 3 lines
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman
#4 lore raw
In reply to Duncan
Quoted 27 lines · Duncan

Neal Becker posted on Mon, 01 Jun 2015 13:25:52 -0400 as excerpted:

Quoted 6 lines

[nbecker@nbecker2 ~]$ sudo btrfs subvolume create /home2 Create subvolume '//home2'
[nbecker@nbecker2 ~]$ sudo btrfs subvolume list / ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 257 path home2

Quoted 7 lines

This created home2 under root. How do I create home2 with top level as top level 5, at the same level as root?

IOW:

ID 257 gen 66376 top level 5 path root
ID 316 gen 66376 top level 5 path home2

Briefly stated, you don't. Just like / is the top of a Unix style directory tree, the root subvolume is the top of a btrfs subvolume tree. You can't go higher than that, and that's what the top level /is/.

But what are you actually trying to do? You _can_ change the default subvolume pointer so a subvolume other than root/5 is mounted by default, and you can nest subvolumes, so for most purposes, you can /pretend/ that some arbitrarily named subvolume is your top subvolume. Alternatively, you can of course mount subvolumes wherever you want in the directory tree.

Quoted 5 lines

Also see the subvolumes discussion and related FAQs on the wiki if you haven't.

https://btrfs.wiki.kernel.org/

But I already have a server setup like this, which was created by anaconda:

sudo btrfs subvolume list /
ID 256 gen 1828545 top level 5 path home ID 259 gen 1818478 top level 5 path root ID 487 gen 1828544 top level 5 path root00

Signature · 1 line
Those who fail to understand recursion are doomed to repeat it