Skip to content

Commit 9b5cc55

Browse files
committed
btrfs-progs: docs: update Glossary and add it to btrfs(5)
Signed-off-by: David Sterba <[email protected]>
1 parent c44f0be commit 9b5cc55

File tree

3 files changed

+351
-330
lines changed

3 files changed

+351
-330
lines changed

Documentation/Glossary.rst

Lines changed: 1 addition & 330 deletions
Original file line numberDiff line numberDiff line change
@@ -1,333 +1,4 @@
11
Glossary
22
========
33

4-
Terms in *italics* also appear in this glossary.
5-
6-
allocator
7-
Usually *allocator* means the *block* allocator, i.e. the logic
8-
inside filesystem which decides where to place newly allocated blocks
9-
in order to maintain several constraints (like data locality, low
10-
fragmentation).
11-
12-
In btrfs, allocator may also refer to *chunk* allocator, i.e. the
13-
logic behind placing chunks on devices.
14-
15-
balance
16-
An operation that can be done to a btrfs filesystem, for example
17-
through :command:`btrfs fi balance /path`. A
18-
balance passes all data in the filesystem through the *allocator*
19-
again. It is primarily intended to rebalance the data in the filesystem
20-
across the *devices* when a device is added or removed. A balance
21-
will regenerate missing copies for the redundant *RAID* levels, if a
22-
device has failed. As of Linux kernel 3.3, a balance operation can be
23-
made selective about which parts of the filesystem are rewritten.
24-
25-
barrier
26-
An instruction to the disk hardware to ensure that everything before
27-
the barrier is physically written to permanent storage before anything
28-
after it. Used in btrfs's *copy on write* approach to ensure
29-
filesystem consistency.
30-
31-
block
32-
A single physically and logically contiguous piece of storage on a
33-
device, of size e.g. 4K.
34-
35-
block group
36-
The unit of allocation of space in btrfs. A block group is laid out on
37-
the disk by the btrfs *allocator*, and will consist of one or more
38-
*chunks*, each stored on a different *device*. The number of chunks
39-
used in a block group will depend on its *RAID* level.
40-
41-
B-tree
42-
The fundamental storage data structure used in btrfs. Except for the
43-
*superblocks*, all of btrfs *metadata* is stored in one of several
44-
B-trees on disk. B-trees store key/item pairs. While the same code is
45-
used to implement all of the B-trees, there are a few different
46-
categories of B-tree. The name *btrfs*
47-
refers to its use of B-trees.
48-
49-
btrfsck
50-
Tool in *btrfs-progs* that checks a filesystem *offline* (i.e.
51-
unmounted), and reports on any errors in the filesystem structures it
52-
finds. By default the tool runs in read-only mode as fixing errors is
53-
potentially dangerous. See also *scrub*.
54-
55-
btrfs-progs
56-
User mode tools to manage btrfs-specific features. Maintained at
57-
http://github.com/kdave/btrfs-progs.git . The main frontend to btrfs
58-
features is the standalone tool *btrfs*, although
59-
other tools such as *mkfs.btrfs* and *btrfstune* are also part of
60-
btrfs-progs.
61-
62-
chunk
63-
A part of a *block group*. Chunks are either 1 GiB in size (for data)
64-
or 256 MiB (for *metadata*).
65-
66-
chunk tree
67-
A layer that keeps information about mapping between physical and
68-
logical block addresses. It's stored within the *system* group.
69-
70-
cleaner
71-
Usually referred to in context of deleted subvolumes. It's a background
72-
process that removes the actual data once a subvolume has been deleted.
73-
Cleaning can involve lots of IO and CPU activity depending on the
74-
fragmentation and amount of shared data with other subvolumes.
75-
76-
copy-on-write
77-
Also known as *COW*. The method that btrfs uses for modifying data.
78-
Instead of directly overwriting data in place, btrfs takes a copy of
79-
the data, alters it, and then writes the modified data back to a
80-
different (free) location on the disk. It then updates the *metadata*
81-
to reflect the new location of the data. In order to update the
82-
metadata, the affected metadata blocks are also treated in the same
83-
way. In COW filesystems, files tend to fragment as they are modified.
84-
Copy-on-write is also used in the implementation of *snapshots* and
85-
*reflink copies*. A copy-on-write filesystem is, in theory,
86-
*always* consistent, provided the underlying hardware supports
87-
*barriers*.
88-
89-
COW
90-
See *copy-on-write*.
91-
92-
default subvolume
93-
The *subvolume* in a btrfs filesystem which is mounted when mounting
94-
the filesystem without using the ``subvol=`` mount option.
95-
96-
device
97-
A Linux block device, e.g. a whole disk, partition, LVM logical volume,
98-
loopback device, or network block device. A btrfs filesystem can reside
99-
on one or more devices.
100-
101-
df
102-
A standard Unix tool for reporting the amount of space used and free in
103-
a filesystem. The standard tool does not give accurate results, but the
104-
*btrfs* command from *btrfs-progs* has
105-
an implementation of *df* which shows space available in more detail. See
106-
the
107-
[[FAQ#Why_does_df_show_incorrect_free_space_for_my_RAID_volume.3F|FAQ]]
108-
for a more detailed explanation of btrfs free space accounting.
109-
110-
DUP
111-
A form of "*RAID*" which stores two copies of each piece of data on
112-
the same *device*. This is similar to *RAID-1*, and protects
113-
against *block*-level errors on the device, but does not provide any
114-
guarantees if the entire device fails. By default, btrfs uses *DUP*
115-
profile for metadata on filesystems with one rotational device,
116-
*single* profile on filesystems with one non-rotational device, and
117-
*RAID1* profile on filesystems with more than one device.
118-
119-
ENOSPC
120-
Error code returned by the OS to a user program when the filesystem
121-
cannot allocate enough data to fulfill the user request. In most
122-
filesystems, it indicates there is no free space available in the
123-
filesystem. Due to the additional space requirements from btrfs's
124-
*COW* behaviour, btrfs can sometimes return ENOSPC when there is
125-
apparently (in terms of *df*) a large amount of space free. This is
126-
effectively a bug in btrfs, and (if it is repeatable), using the mount
127-
option ``enospc_debug`` may give a report
128-
that will help the btrfs developers. See the
129-
[[FAQ#if_your_device_is_large_.28.3E16GiB.29|FAQ entry]] on free space.
130-
131-
extent
132-
Contiguous sequence of bytes on disk that holds file data.
133-
134-
A file stored on disk with 3 extents means that it consists of three
135-
fragments of contiguous bytes. See *filefrag*. A file in one extent
136-
would mean it is not fragmented.
137-
138-
Extent buffer
139-
An abstraction to allow access to *B-tree* blocks larger than a page size.
140-
141-
fallocate
142-
Command line tool in util-linux, and a syscall, that reserves space in
143-
the filesystem for a file, without actually writing any file data to
144-
the filesystem. First data write will turn the preallocated extents
145-
into regular ones. See :manref:`fallocate(1)` and :manref:`fallocate(2)` manual pages
146-
for more details.
147-
148-
filefrag
149-
A tool to show the number of extents in a file, and hence the amount of
150-
fragmentation in the file. It is usually part of the e2fsprogs package
151-
on most Linux distributions. While initially developed for the ext2
152-
filesystem, it works on Btrfs as well. It uses the *FIEMAP* ioctl.
153-
154-
free space cache
155-
Btrfs doesn't track free space, it only tracks allocated space. Free
156-
space is by definition any holes in the allocated space, but finding
157-
these holes is actually fairly I/O intensive. The free space cache
158-
stores a condensed representation of what is free. It is updated on
159-
every *transaction* commit.
160-
161-
fsync
162-
On Unix and Unix-like operating systems (of which Linux is the latter),
163-
the :manref:`fsync(2)` system call causes all buffered file
164-
descriptor related data changes to be flushed to the underlying block
165-
device. When a file is modified on a modern operating system the
166-
changes are generally not written to the disk immediately but rather
167-
those changes are buffered in memory for reasons of performance,
168-
calling :manref:`fsync(2)` causes any in-memory changes to be written
169-
to disk.
170-
171-
generation
172-
An internal counter which updates for each *transaction*. When a
173-
*metadata* block is written (using *copy on write*), current
174-
generation is stored in the block, so that blocks which are too new
175-
(and hence possibly inconsistent) can be identified.
176-
177-
key
178-
A fixed sized tuple used to identify and sort items in a *B-tree*.
179-
The key is broken up into 3 parts: *objectid*, *type*, and
180-
*offset*. The *type* field indicates how each of the other two
181-
fields should be used, and what to expect to find in the item.
182-
183-
item
184-
A variable sized structure stored in B-tree leaves. Items hold
185-
different types of data depending on key type.
186-
187-
log tree
188-
A b-tree that temporarily tracks ongoing metadata updates until a full
189-
transaction commit is done. It's a performance optimization of
190-
``fsync``. The log tracked in the tree are replayed if the filesystem
191-
is not unmounted cleanly.
192-
193-
metadata
194-
Data about data. In btrfs, this includes all of the internal data
195-
structures of the filesystem, including directory structures,
196-
filenames, file permissions, checksums, and the location of each file's
197-
*extents*. All btrfs metadata is stored in *B-trees*.
198-
199-
mkfs.btrfs
200-
The tool (from *btrfs-progs*) to create a btrfs filesystem.
201-
202-
offline
203-
A filesystem which is not mounted is offline. Some tools (e.g.
204-
*btrfsck*) will only work on offline filesystems. Compare *online*.
205-
206-
online
207-
A filesystem which is mounted is online. Most btrfs tools will only
208-
work on online filesystems. Compare *offline*.
209-
210-
orphan
211-
A file that's still in use (opened by a running process) but all
212-
directory entries of that file have been removed.
213-
214-
RAID
215-
A class of different methods for writing some additional redundant data
216-
across multiple *devices* so that if one device fails, the missing
217-
data can be reconstructed from the remaining ones. See *RAID-0*,
218-
*RAID-1*, *RAID-5*, *RAID-6*, *RAID-10*, *DUP* and
219-
*single*. Traditional RAID methods operate across multiple devices of
220-
equal size, whereas btrfs's RAID implementation works inside *block
221-
groups*.
222-
223-
RAID-0
224-
A form of *RAID* which provides no form of error recovery, but
225-
stripes a single copy of data across multiple devices for performance
226-
purposes. The stripe size is fixed to 64KB for now.
227-
228-
RAID-1
229-
A form of *RAID* which stores two complete copies of each piece of
230-
data. Each copy is stored on a different *device*. btrfs requires a
231-
minimum of two devices to use RAID-1. This is the default for btrfs's
232-
*metadata* on more than one device.
233-
234-
RAID-5
235-
A form of *RAID* which stripes a single copy of data across multiple
236-
*devices*, including one device's worth of additional parity data.
237-
Can be used to recover from a single device failure.
238-
239-
RAID-6
240-
A form of *RAID* which stripes a single copy of data across multiple
241-
*devices*, including two device's worth of additional parity data. Can
242-
be used to recover from the failure of two devices.
243-
244-
RAID-10
245-
A form of *RAID* which stores two complete copies of each piece of
246-
data, and also stripes each copy across multiple devices for
247-
performance.
248-
249-
reflink
250-
Parameter to :command:`cp`, allowing it to take advantage of the
251-
capabilities of *COW*-capable filesystems. Allows for files to be
252-
copied and modified, with only the modifications taking up additional
253-
storage space. May be considered as *snapshots* on a single file rather
254-
than a *subvolume*. Example: :command:`cp --reflink file1 file2`
255-
256-
relocation
257-
The process of moving block groups within the filesystem while
258-
maintaining full filesystem integrity and consistency. This
259-
functionality is underlying *balance* and *device* removing features.
260-
261-
scrub
262-
An *online* filesystem checking tool. Reads all the data and metadata
263-
on the filesystem, and uses *checksums* and the duplicate copies from
264-
*RAID* storage to identify and repair any corrupt data.
265-
266-
seed device
267-
A readonly device can be used as a filesystem seed or template (e.g. a
268-
CD-ROM containing an OS image). Read/write devices can be added to
269-
store modifications (using *copy on write*), changes to the writable
270-
devices are persistent across reboots. The original device remains
271-
unchanged and can be removed at any time (after Btrfs has been
272-
instructed to copy over all missing blocks). Multiple read/write file
273-
systems can be built from the same seed.
274-
275-
single
276-
A "*RAID*" level in btrfs, storing a single copy of each piece of data.
277-
The default for data (as opposed to *metadata*) in btrfs. Single is
278-
also default metadata profile for non-rotational (SSD, flash) devices.
279-
280-
snapshot
281-
A *subvolume* which is a *copy on write* copy of another subvolume. The
282-
two subvolumes share all of their common (unmodified) data, which means
283-
that snapshots can be used to keep the historical state of a filesystem
284-
very cheaply. After the snapshot is made, the original subvolume and
285-
the snapshot are of equal status: the original does not "own" the
286-
snapshot, and either one can be deleted without affecting the other
287-
one.
288-
289-
subvolume
290-
A tree of files and directories inside a btrfs that can be mounted as
291-
if it were an independent filesystem. A subvolume is created by taking
292-
a reference on the root of another subvolume. Each btrfs filesystem has
293-
at least one subvolume, the *top-level subvolume*, which contains
294-
everything else in the filesystem. Additional subvolumes can be created
295-
and deleted with the *btrfs<* tool. All subvolumes share the same pool
296-
of free space in the filesystem. See also *default subvolume*.
297-
298-
superblock
299-
The *block* on the disk, at a fixed known location and of fixed size,
300-
which contains pointers to the disk blocks containing all the other
301-
filesystem *metadata* structures. btrfs stores multiple copies of the
302-
superblock on each *device* in the filesystem at offsets 64 KiB, 64
303-
MiB, 256 GiB, 1 TiB and PiB.
304-
305-
system array
306-
Cryptic name of *superblock* metadata describing how to assemble a
307-
filesystem from multiple device. Prior to mount, the command *btrfs dev
308-
scan* has to be called, or all the devices have to be specified via
309-
mount option *device=/dev/ice*.
310-
311-
top-level subvolume
312-
The *subvolume* at the very top of the filesystem. This is the only
313-
subvolume present in a newly-created btrfs filesystem, and internally has ID 5,
314-
otherwise could be referenced as 0 (e.g. within the *set-default* subcommand of
315-
*btrfs*).
316-
317-
transaction
318-
A consistent set of changes. To avoid generating very large amounts of
319-
disk activity, btrfs caches changes in RAM for up to 30 seconds
320-
(sometimes more often if the filesystem is running short on space or
321-
doing a lot of *fsync*s), and then writes (commits) these changes out
322-
to disk in one go (using *copy on write* behaviour). This period of
323-
caching is called a transaction. Only one transaction is active on the
324-
filesystem at any one time.
325-
326-
transid
327-
An alternative term for *generation*.
328-
329-
writeback
330-
*Writeback* in the context of the Linux kernel can be defined as the
331-
process of writing "dirty" memory from the page cache to the disk,
332-
when certain conditions are met (timeout, number of dirty pages over a
333-
ratio).
4+
.. include:: ch-glossary.rst

Documentation/btrfs-man5.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ tools. Currently covers:
2121
#. filesystems with multiple block group profiles
2222
#. seeding device
2323
#. RAID56 status and recommended practices
24+
#. glossary
2425
#. storage model, hardware considerations
2526

2627
.. _man-btrfs5-mount-options:
@@ -442,6 +443,12 @@ immediately and would require a rebalance. A fixed configured stripe width is
442443
not implemented.
443444

444445

446+
GLOSSARY
447+
--------
448+
449+
.. include:: ch-glossary.rst
450+
451+
445452
STORAGE MODEL, HARDWARE CONSIDERATIONS
446453
--------------------------------------
447454

0 commit comments

Comments
 (0)