aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2024-02-20 10:25:29 +0100
committerDavid Sterba <dsterba@suse.com>2024-02-20 10:26:09 +0100
commit93cdc1c2fc8df31a7943d2199282893eece4df53 (patch)
tree5b94f662cbdb62acbb2cbcceee1c94d2b51bf5af
parentd03594b0313db71413b9dcb040f8d5c4da7213b1 (diff)
downloadbtrfs-progs-93cdc1c2fc8df31a7943d2199282893eece4df53.tar.gz
btrfs-progs: docs: clarify inode numbers
Update wording and add an example. [ci skip] Issue: #729 Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--Documentation/ch-subvolume-intro.rst29
1 files changed, 22 insertions, 7 deletions
diff --git a/Documentation/ch-subvolume-intro.rst b/Documentation/ch-subvolume-intro.rst
index 9ca39d0a..20a46334 100644
--- a/Documentation/ch-subvolume-intro.rst
+++ b/Documentation/ch-subvolume-intro.rst
@@ -1,7 +1,8 @@
A BTRFS subvolume is a part of filesystem with its own independent
file/directory hierarchy and inode number namespace. Subvolumes can share file
extents. A snapshot is also subvolume, but with a given initial content of the
-original subvolume. A subvolume has always inode number 256.
+original subvolume. A subvolume has always inode number 256 (see more in
+:docref:`Inode numbers <Subvolumes:subvolume-inode-numbers>`).
.. note::
A subvolume in BTRFS is not like an LVM logical volume, which is block-level
@@ -15,8 +16,8 @@ changed.
A subvolume in BTRFS can be accessed in two ways:
-* like any other directory that is accessible to the user
-* like a separately mounted filesystem (options *subvol* or *subvolid*)
+- like any other directory that is accessible to the user
+- like a separately mounted filesystem (options *subvol* or *subvolid*)
In the latter case the parent directory is not visible and accessible. This is
similar to a bind mount, and in fact the subvolume mount does exactly that.
@@ -143,13 +144,27 @@ the 4th column:
27 21 0:19 /subv1 /mnt rw,relatime - btrfs /dev/sda rw,space_cache
^^^^^^
+.. duplabel:: subvolume-inode-numbers
+
Inode numbers
-------------
-A proper subvolume has always inode number 256. If a subvolume is nested and
-then a snapshot is taken, then the cloned directory entry representing the
-subvolume becomes empty and the inode has number 2. All other files and
-directories in the target snapshot preserve their original inode numbers.
+A directory representing a subvolume has always inode number 256 (sometimes
+also called a root of the subvolume):
+
+.. code-block:: none
+
+ $ ls -lis
+ total 0
+ 389111 0 drwxr-xr-x 1 user users 0 Jan 20 12:13 dir
+ 389110 0 -rw-r--r-- 1 user users 0 Jan 20 12:13 file
+ 256 0 drwxr-xr-x 1 user users 0 Jan 20 12:13 snap1
+ 256 0 drwxr-xr-x 1 user users 0 Jan 20 12:13 subv1
+
+If a subvolume is nested and then a snapshot is taken, then the cloned
+directory entry representing the subvolume becomes empty and the inode has
+number 2. All other files and directories in the target snapshot preserve their
+original inode numbers.
.. note::
Inode number is not a filesystem-wide unique identifier, some applications