Skip to contentSkip to conversation

generic name for volume and subvolume root?

DISCUSSION Ulli Horlacher 5 participants 8 messages Sep 9, 2017 – Sep 10, 2017 Btrfs file system

lore
Share & tools
lore
#0 lore raw

As I am writing some documentation abount creating snapshots:
Is there a generic name for both volume and subvolume root?

Example:

root@fex:~# btrfs subvol show /mnt
ERROR: not a subvolume: /mnt
root@fex:~# btrfs subvol show /mnt/test
/mnt/test is toplevel subvolume
root@fex:~# btrfs subvol show /mnt/test/data
/mnt/test/data
        Name:                   data
        UUID:                   b32a5949-dfd6-ef45-8616-34ae4cdf6fb8
(...)
root@fex:~# btrfs subvol show /mnt/test/data/sw
ERROR: not a subvolume: /mnt/test/data/sw

I can create snapshots of /mnt/test and /mnt/test/data, but not of /mnt and /mnt/test/data/sw

Is there a simple name for directories I can snapshot?

Signature · 6 lines
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: [email protected]
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<[email protected]>
#1 lore raw
Quoted 17 lines · Ulli Horlacher

As I am writing some documentation abount creating snapshots:
Is there a generic name for both volume and subvolume root?

Example:

root@fex:~# btrfs subvol show /mnt
ERROR: not a subvolume: /mnt
root@fex:~# btrfs subvol show /mnt/test
/mnt/test is toplevel subvolume
root@fex:~# btrfs subvol show /mnt/test/data
/mnt/test/data
         Name:                   data
         UUID:                   b32a5949-dfd6-ef45-8616-34ae4cdf6fb8
(...)
Quoted 10 lines
root@fex:~# btrfs subvol show /mnt/test/data/sw
ERROR: not a subvolume: /mnt/test/data/sw

I can create snapshots of /mnt/test and /mnt/test/data, but not of /mnt and /mnt/test/data/sw

Is there a simple name for directories I can snapshot?

Nope, subvolume (including snapshot) is not distinguished by its filename/path/directory name.

And you can only do snapshot on subvolume (snapshot is one kind of subvolume) boundary.

For user to determine where is the subvolume boundary, one should first determine there is the btrfs mounted and then use "btrfs subvol show" to determine the boundaries.

Or, in a btrfs test the directory inode number. Subvolume/snapshot in btrfs will always have the same inode number 256, and regular file/directories/special files will not use that magic number.

Thanks,
Qu

#2 lore raw
Quoted 7 lines · Qu Wenruo
Quoted 1 line

Is there a generic name for both volume and subvolume root?

Nope, subvolume (including snapshot) is not distinguished by its filename/path/directory name.

And you can only do snapshot on subvolume (snapshot is one kind of subvolume) boundary.

So, I can name a btrfs root volume also btrfs subvolume?

I am talking about documentation, not coding!

I just want yo use the correct terms.

Signature · 6 lines
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: [email protected]
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/
REF:<[email protected]>
#3 lore raw
Quoted 11 lines · Ulli Horlacher
Quoted 7 lines · Qu Wenruo
Quoted 1 line

Is there a generic name for both volume and subvolume root?

Nope, subvolume (including snapshot) is not distinguished by its filename/path/directory name.

And you can only do snapshot on subvolume (snapshot is one kind of subvolume) boundary.

So, I can name a btrfs root volume also btrfs subvolume?

Yes, root volume is also a subvolume, so just call "btrfs root volume" a "subvolume".

Quoted 4 lines

I am talking about documentation, not coding!

I just want yo use the correct terms.

If you're referring to the term, I think subvolume is good enough. Which represents your original term, "directories one can snapshot".

For the whole btrfs "volume", I would just call it "filesystem" to avoid the name "volume" or "subvolume" at all.

Thanks,
Qu

#4 lore raw
Quoted 10 lines · Qu Wenruo
Quoted 7 lines · Ulli Horlacher
Quoted 5 lines · Qu Wenruo
Quoted 1 line

Is there a generic name for both volume and subvolume root?

Nope, subvolume (including snapshot) is not distinguished by its filename/path/directory name.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

And you can only do snapshot on subvolume (snapshot is one kind of subvolume) boundary.

So, I can name a btrfs root volume also btrfs subvolume?

Yes, root volume is also a subvolume, so just call "btrfs root volume" a "subvolume".

I find it's best to avoid the word "root" entirely, as it's got
several meanings, and it tends to get confusing in conversation. Instead, we have:

- "the top level" (subvolid=5)
- "/" (what you see at / in your running system)
- "<top-level>/@" or similar names
(the subvolume that's mounted at /)

Quoted 10 lines
Quoted 3 lines

I am talking about documentation, not coding!

I just want yo use the correct terms.

If you're referring to the term, I think subvolume is good enough. Which represents your original term, "directories one can snapshot".

For the whole btrfs "volume", I would just call it "filesystem" to avoid the name "volume" or "subvolume" at all.

Yes, it's a filesystem. (Although that does occasionally cause
confusion between "the conceptual filesystem implemented by btrfs.ko" and "the concrete filesystem stored on /dev/sda1", but it's generally far less confusing than the overloading of "root").

Hugo.

Signature · 4 lines
Hugo Mills             | Well, you don't get to be a kernel hacker simply by
hugo@... carfax.org.uk | looking good in Speedos.
http://carfax.org.uk/  |
PGP: E2AB1DE4          |                                         Rusty Russell
#5 lore raw
Quoted 36 lines · Hugo Mills
Quoted 10 lines · Qu Wenruo
Quoted 7 lines · Ulli Horlacher
Quoted 5 lines · Qu Wenruo
Quoted 1 line

Is there a generic name for both volume and subvolume root?

Nope, subvolume (including snapshot) is not distinguished by its filename/path/directory name.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

And you can only do snapshot on subvolume (snapshot is one kind of subvolume) boundary.

So, I can name a btrfs root volume also btrfs subvolume?

Yes, root volume is also a subvolume, so just call "btrfs root volume" a "subvolume".

I find it's best to avoid the word "root" entirely, as it's got
several meanings, and it tends to get confusing in conversation. Instead, we have:

- "the top level" (subvolid=5)
- "/" (what you see at / in your running system)
- "<top-level>/@" or similar names
(the subvolume that's mounted at /)

Quoted 8 lines
Quoted 3 lines

I am talking about documentation, not coding!

I just want yo use the correct terms.

If you're referring to the term, I think subvolume is good enough. Which represents your original term, "directories one can snapshot".

Quoted 7 lines
Quoted 2 lines

For the whole btrfs "volume", I would just call it "filesystem" to avoid the name "volume" or "subvolume" at all.

Yes, it's a filesystem. (Although that does occasionally cause
confusion between "the conceptual filesystem implemented by btrfs.ko" and "the concrete filesystem stored on /dev/sda1", but it's generally far less confusing than the overloading of "root").

Yes, because every subvolume is a filesystem root! :-D

https://i.imgur.com/2VzmC.gif

Signature · 1 line
Hans van Kranenburg
#6 lore raw
In reply to Ulli Horlacher
Quoted 17 lines · Ulli Horlacher

As I am writing some documentation abount creating snapshots:
Is there a generic name for both volume and subvolume root?

Example:

root@fex:~# btrfs subvol show /mnt
ERROR: not a subvolume: /mnt
root@fex:~# btrfs subvol show /mnt/test
/mnt/test is toplevel subvolume
root@fex:~# btrfs subvol show /mnt/test/data
/mnt/test/data
        Name:                   data
        UUID:                   b32a5949-dfd6-ef45-8616-34ae4cdf6fb8
(...)
Quoted 8 lines
root@fex:~# btrfs subvol show /mnt/test/data/sw
ERROR: not a subvolume: /mnt/test/data/sw

I can create snapshots of /mnt/test and /mnt/test/data, but not of /mnt and /mnt/test/data/sw

Is there a simple name for directories I can snapshot?

Subvolume. If you can snapshot it, it's a subvolume. Some
subvolumes are also snapshots. (And all snapshots are subvolumes).

The subvolume with ID 5 (or ID 0, which is an alias) is the "top
level subvolume", and has the unique property that it can't be renamed, deleted or replaced, where all other subvolumes can be.

Hugo.

Signature · 4 lines
Hugo Mills             | Well, you don't get to be a kernel hacker simply by
hugo@... carfax.org.uk | looking good in Speedos.
http://carfax.org.uk/  |
PGP: E2AB1DE4          |                                         Rusty Russell
#7 lore raw
In reply to Ulli Horlacher
Quoted 2 lines

As I am writing some documentation abount creating snapshots:
Is there a generic name for both volume and subvolume root?

Yes, it is from the UNIX side 'root directory' and from the Btrfs side 'subvolume'. Like some other things Btrfs, its terminology is often inconsistent, but "volume" *usually* means "the set of devices [and contained root directories] with the same Btrfs 'fsid'".

I think that the top-level subvolume should not be called the "volume": while there is no reason why a UNIX-like filesystem should be limited to a single block-device, one of the fundamental properties of UNIX-like filesystems is that hard-links are only possible (if at all possible) within a filesystem, and that 'statfs' returns a different "device id" per filesystem. Therefore a Btrfs volume is not properly a filesystem, but potentially a filesystem forest, as it may contain multiple filesystems each with its own root directory.

Quoted 1 line

Is there a simple name for directories I can snapshot?

You can only snapshot *root directories*, of which in Btrfs there are two types: subvolumes (an unfortunate name perhaps) or snapshots.

In UNIX-like OSes every filesystem has a "root directory" and some filesystem types like Btrfs, NILFS2, and potentially JFS can have more than one, and some can even mount more than one simultaneously.

The root directory mounted as '/' is called the "system root directory". When unmounted all filesystem root directories have no names, just an inode number. Conceivably the root inode of a UNIX-like filesystem could be an inode of any type, but I have never seen a recent UNIX-like OS able to mount anything other than a directory-type root inode (Plan 9 is not a UNIX-like OS :->).

As someone else observed, the word "root" is overloaded in UNIX-like OS discourse, like the word "filesystem", and that's unfortunate but can always be resolved verbosely by using the appropriate qualifier like "root directory", "system root directory", "'root' user", "uid 0 capabilities", etc.