btrfs-progs: docs: annual typo, clarity, & grammar review & fixups
[platform/upstream/btrfs-progs.git] / Documentation / btrfs-man5.asciidoc
1 btrfs-man5(5)
2 ==============
3
4 NAME
5 ----
6 btrfs-man5 - topics about the BTRFS filesystem (mount options, supported file attributes and other)
7
8 DESCRIPTION
9 -----------
10 This document describes topics related to BTRFS that are not specific to the
11 tools.  Currently covers:
12
13 1. mount options
14
15 2. filesystem features
16
17 3. file attributes
18
19 4. control device
20
21
22 MOUNT OPTIONS
23 -------------
24
25 This section describes mount options specific to BTRFS.  For the generic mount
26 options please refer to `mount`(8) manpage. The options are sorted alphabetically
27 (discarding the 'no' prefix).
28
29 NOTE: most mount options apply to the whole filesystem and only options in the
30 first mounted subvolume will take effect. This is due to lack of implementation
31 and may change in the future. This means that (for example) you can't set
32 per-subvolume 'nodatacow', 'nodatasum', or 'compress' using mount options. This
33 should eventually be fixed, but it has proved to be difficult to implement
34 correctly within the Linux VFS framework.
35
36 *acl*::
37 *noacl*::
38 (default: on)
39 +
40 Enable/disable support for Posix Access Control Lists (ACLs).  See the
41 `acl`(5) manual page for more information about ACLs.
42 +
43 The support for ACL is build-time configurable (BTRFS_FS_POSIX_ACL) and
44 mount fails if 'acl' is requested but the feature is not compiled in.
45
46 *autodefrag*::
47 *noautodefrag*::
48 (since: 3.0, default: off)
49 +
50 Enable automatic file defragmentation.
51 When enabled, small random writes into files (in a range of tens of kilobytes,
52 currently it's 64K) are detected and queued up for the defragmentation process.
53 Not well suited for large database workloads.
54 +
55 The read latency may increase due to reading the adjacent blocks that make up the
56 range for defragmentation, successive write will merge the blocks in the new
57 location.
58 +
59 WARNING: Defragmenting with Linux kernel versions < 3.9 or ≥ 3.14-rc2 as
60 well as with Linux stable kernel versions ≥ 3.10.31, ≥ 3.12.12 or
61 ≥ 3.13.4 will break up the reflinks of COW data (for example files
62 copied with `cp --reflink`, snapshots or de-duplicated data).
63 This may cause considerable increase of space usage depending on the
64 broken up reflinks.
65
66 *barrier*::
67 *nobarrier*::
68 (default: on)
69 +
70 Ensure that all IO write operations make it through the device cache and are stored
71 permanently when the filesystem is at its consistency checkpoint. This
72 typically means that a flush command is sent to the device that will
73 synchronize all pending data and ordinary metadata blocks, then writes the
74 superblock and issues another flush.
75 +
76 The write flushes incur a slight hit and also prevent the IO block
77 scheduler to reorder requests in a more effective way. Disabling barriers gets
78 rid of that penalty but will most certainly lead to a corrupted filesystem in
79 case of a crash or power loss. The ordinary metadata blocks could be yet
80 unwritten at the time the new superblock is stored permanently, expecting that
81 the block pointers to metadata were stored permanently before.
82 +
83 On a device with a volatile battery-backed write-back cache, the 'nobarrier'
84 option will not lead to filesystem corruption as the pending blocks are
85 supposed to make it to the permanent storage.
86
87 *check_int*::
88 *check_int_data*::
89 *check_int_print_mask='value'*::
90 (since: 3.0, default: off)
91 +
92 These debugging options control the behavior of the integrity checking
93 module (the BTRFS_FS_CHECK_INTEGRITY config option required). The main goal is
94 to verify that all blocks from a given transaction period are properly linked.
95 +
96 'check_int' enables the integrity checker module, which examines all
97 block write requests to ensure on-disk consistency, at a large
98 memory and CPU cost.
99 +
100 'check_int_data' includes extent data in the integrity checks, and
101 implies the 'check_int' option.
102 +
103 'check_int_print_mask' takes a bitmask of BTRFSIC_PRINT_MASK_* values
104 as defined in 'fs/btrfs/check-integrity.c', to control the integrity
105 checker module behavior.
106 +
107 See comments at the top of 'fs/btrfs/check-integrity.c'
108 for more information.
109
110 *clear_cache*::
111 Force clearing and rebuilding of the disk space cache if something
112 has gone wrong. See also: 'space_cache'.
113
114 *commit='seconds'*::
115 (since: 3.12, default: 30)
116 +
117 Set the interval of periodic transaction commit when data are synchronized
118 to permanent storage. Higher interval values lead to larger amount of unwritten
119 data, which has obvious consequences when the system crashes.
120 The upper bound is not forced, but a warning is printed if it's more than 300
121 seconds (5 minutes). Use with care.
122
123 *compress*::
124 *compress='type'*::
125 *compress-force*::
126 *compress-force='type'*::
127 (default: off)
128 +
129 Control BTRFS file data compression.  Type may be specified as 'zlib',
130 'lzo', 'zstd' or 'no' (for no compression, used for remounting).  If no type
131 is specified, 'zlib' is used.  If 'compress-force' is specified,
132 then compression will always be attempted, but the data may end up uncompressed
133 if the compression would make them larger.
134 +
135 Otherwise some simple heuristics are applied to detect an incompressible file.
136 If the first blocks written to a file are not compressible, the whole file is
137 permanently marked to skip compression. As this is too simple, the
138 'compress-force' is a workaround that will compress most of the files at the
139 cost of some wasted CPU cycles on failed attempts. The heuristics of 'compress'
140 will improve in the future so this will not be necessary.
141 +
142 NOTE: If compression is enabled, 'nodatacow' and 'nodatasum' are disabled.
143
144 *datacow*::
145 *nodatacow*::
146 (default: on)
147 +
148 Enable data copy-on-write for newly created files.
149 'Nodatacow' implies 'nodatasum', and disables 'compression'. All files created
150 under 'nodatacow' are also set the NOCOW file attribute (see `chattr`(1)).
151 +
152 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
153 +
154 Updates in-place improve performance for workloads that do frequent overwrites,
155 at the cost of potential partial writes, in case the write is interruted
156 (system crash, device failure).
157
158 *datasum*::
159 *nodatasum*::
160 (default: on)
161 +
162 Enable data checksumming for newly created files.
163 'Datasum' implies 'datacow', ie. the normal mode of operation. All files created
164 under 'nodatasum' inherit the "no checksums" property, however there's no
165 corresponding file attribute (see `chattr`(1)).
166 +
167 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
168 +
169 There is a slight performance gain when checksums are turned off, the
170 correspoinding metadata blocks holding the checksums do not need to updated.
171 The cost of checksumming of the blocks in memory is much lower than the IO,
172 modern CPUs feature hardware support of the checksumming algorithm.
173
174 *degraded*::
175 (default: off)
176 +
177 Allow mounts with less devices than the RAID profile constraints
178 require.  A read-write mount (or remount) may fail when there are too many devices
179 missing, for example if a stripe member is completely missing from RAID0.
180 +
181 Since 4.14, the constraint checks have been improved and are verified on the
182 chunk level, not an the device level. This allows degraded mounts of
183 filesystems with mixed RAID profiles for data and metadata, even if the
184 device number constraints would not be satisfied for some of the prifles.
185 +
186 Example: metadata -- raid1, data -- single, devices -- /dev/sda, /dev/sdb
187 +
188 Suppose the data are completely stored on 'sda', then missing 'sdb' will not
189 prevent the mount, even if 1 missing device would normally prevent (any)
190 'single' profile to mount. In case some of the data chunks are stored on 'sdb',
191 then the constraint of single/data is not satisfied and the filesystem
192 cannot be mounted.
193
194 *device='devicepath'*::
195 Specify a path to a device that will be scanned for BTRFS filesystem during
196 mount. This is usually done automatically by a device manager (like udev) or
197 using the *btrfs device scan* command (eg. run from the initial ramdisk). In
198 cases where this is not possible the 'device' mount option can help.
199 +
200 NOTE: booting eg. a RAID1 system may fail even if all filesystem's 'device'
201 paths are provided as the actual device nodes may not be discovered by the
202 system at that point.
203
204 *discard*::
205 *nodiscard*::
206 (default: off)
207 +
208 Enable discarding of freed file blocks.  This is useful for SSD devices, thinly
209 provisioned LUNs, or virtual machine images; however, every storage layer must
210 support discard for it to work. if the backing device does not support
211 asynchronous queued TRIM, then this operation can severly degrade performance,
212 because a synchronous TRIM operation will be attempted instead. Queued TRIM
213 requires newer than SATA revision 3.1 chipsets and devices.
214
215 If it is not necessary to immediately discard freed blocks, then the `fstrim`
216 tool can be used to discard all free blocks in a batch. Scheduling a TRIM
217 during a period of low system activity will prevent latent interference with
218 the performance of other operations. Also, a device may ignore the TRIM command
219 if the range is too small, so running a batch discard has a greater probability
220 of actually discarding the blocks.
221
222 If discarding is not necessary to be done at the block freeing time, there's
223 `fstrim`(8) tool that lets the filesystem discard all free blocks in a batch,
224 possibly not much interfering with other operations. Also, the the device may
225 ignore the TRIM command if the range is too small, so running the batch discard
226 can actually discard the blocks.
227
228 *enospc_debug*::
229 *noenospc_debug*::
230 (default: off)
231 +
232 Enable verbose output for some ENOSPC conditions. It's safe to use but can
233 be noisy if the system reaches near-full state.
234
235 *fatal_errors='action'*::
236 (since: 3.4, default: bug)
237 +
238 Action to take when encountering a fatal error.
239 +
240 *bug*::::
241 'BUG()' on a fatal error, the system will stay in the crashed state and may be
242 still partially usable, but reboot is required for full operation
243 +
244 *panic*::::
245 'panic()' on a fatal error, depending on other system configuration, this may
246 be followed by a reboot. Please refer to the documentation of kernel boot
247 parameters, eg. 'panic', 'oops' or 'crashkernel'.
248
249 *flushoncommit*::
250 *noflushoncommit*::
251 (default: off)
252 +
253 This option forces any data dirtied by a write in a prior transaction to commit
254 as part of the current commit, effectively a full filesystem sync.
255 +
256 This makes the committed state a fully consistent view of the file system from
257 the application's perspective (i.e. it includes all completed file system
258 operations). This was previously the behavior only when a snapshot was
259 created.
260 +
261 When off, the filesystem is consistent but buffered writes may last more than
262 one transaction commit.
263
264 *fragment='type'*::
265 (depends on compile-time option BTRFS_DEBUG, since: 4.4, default: off)
266 +
267 A debugging helper to intentionally fragment given 'type' of block groups. The
268 type can be 'data', 'metadata' or 'all'. This mount option should not be used
269 outside of debugging environments and is not recognized if the kernel config
270 option 'BTRFS_DEBUG' is not enabled.
271
272 *inode_cache*::
273 *noinode_cache*::
274 (since: 3.0, default: off)
275 +
276 Enable free inode number caching. Not recommended to use unless files on your
277 filesystem get assigned inode numbers that are approaching 2^64^. Normally, new
278 files in each subvolume get assigned incrementally (plus one from the last
279 time) and are not reused. The mount option turns on caching of the existing
280 inode numbers and reuse of inode numbers of deleted files.
281 +
282 This option may slow down your system at first run, or after mounting without
283 the option.
284 +
285 NOTE: Defaults to off due to a potential overflow problem when the free space
286 checksums don't fit inside a single page.
287 +
288 Don't use this option unless you really need it. The inode number limit
289 on 64bit system is 2^64^, which is practically enough for the whole filesystem
290 lifetime. Due to implemention of linux VFS layer, the inode numbers on 32bit
291 systems are only 32 bits wide. This lowers the limit significantly and makes
292 it possible to reach it. In such case, this mount option will help.
293 Alternatively, files with high inode numbers can be copied to a new subvolume
294 which will effectively start the inode numbers from the beginning again.
295
296 *logreplay*::
297 *nologreplay*::
298 (default: on, even read-only)
299 +
300 Enable/disable log replay at mount time. See also 'treelog'.
301 +
302 WARNING: currently, the tree log is replayed even with a read-only mount! To
303 disable that behaviour, mount also with 'nologreplay'.
304
305 *max_inline='bytes'*::
306 (default: min(2048, page size) )
307 +
308 Specify the maximum amount of space, that can be inlined in
309 a metadata B-tree leaf.  The value is specified in bytes, optionally
310 with a K suffix (case insensitive).  In practice, this value
311 is limited by the filesystem block size (named 'sectorsize' at mkfs time),
312 and memory page size of the system. In case of sectorsize limit, there's
313 some space unavailable due to leaf headers.  For example, a 4k sectorsize,
314 maximum size of inline data is about 3900 bytes.
315 +
316 Inlining can be completely turned off by specifying 0. This will increase data
317 block slack if file sizes are much smaller than block size but will reduce
318 metadata consumption in return.
319 +
320 NOTE: the default value has changed to 2048 in kernel 4.6.
321
322 *metadata_ratio='value'*::
323 (default: 0, internal logic)
324 +
325 Specifies that 1 metadata chunk should be allocated after every 'value' data
326 chunks. Default behaviour depends on internal logic, some percent of unused
327 metadata space is attempted to be maintained but is not always possible if
328 there's not enough space left for chunk allocation. The option could be useful to
329 override the internal logic in favor of the metadata allocation if the expected
330 workload is supposed to be metadata intense (snapshots, reflinks, xattrs,
331 inlined files).
332
333 *norecovery*::
334 (since: 4.5, default: off)
335 +
336 Do not attempt any data recovery at mount time. This will disable 'logreplay'
337 and avoids other write operations.
338 +
339 NOTE: The opposite option 'recovery' used to have different meaning but was
340 changed for consistency with other filesystems, where 'norecovery' is used for
341 skipping log replay. BTRFS does the same and in general will try to avoid any
342 write operations.
343
344 *rescan_uuid_tree*::
345 (since: 3.12, default: off)
346 +
347 Force check and rebuild procedure of the UUID tree. This should not
348 normally be needed.
349
350 *skip_balance*::
351 (since: 3.3, default: off)
352 +
353 Skip automatic resume of an interrupted balance operation. The operation can
354 later be resumed with *btrfs balance resume*, or the paused state can be
355 removed with *btrfs balance cancel*. The default behaviour is to resume an
356 interrupted balance immediately after a volume is mounted.
357
358 *space_cache*::
359 *space_cache='version'*::
360 *nospace_cache*::
361 ('nospace_cache' since: 3.2, 'space_cache=v1' and 'space_cache=v2' since 4.5, default: 'space_cache=v1')
362 +
363 Options to control the free space cache. The free space cache greatly improves
364 performance when reading block group free space into memory. However, managing
365 the space cache consumes some resources, including a small amount of disk
366 space.
367 +
368 There are two implementations of the free space cache. The original
369 one, referred to as 'v1', is the safe default. The 'v1' space cache can be
370 disabled at mount time with 'nospace_cache' without clearing.
371 +
372 On very large filesystems (many terabytes) and certain workloads, the
373 performance of the 'v1' space cache may degrade drastically. The 'v2'
374 implementation, which adds a new B-tree called the free space tree, addresses
375 this issue. Once enabled, the 'v2' space cache will always be used and cannot
376 be disabled unless it is cleared. Use 'clear_cache,space_cache=v1' or
377 'clear_cache,nospace_cache' to do so. If 'v2' is enabled, kernels without 'v2'
378 support will only be able to mount the filesystem in read-only mode. The
379 `btrfs`(8) command currently only has read-only support for 'v2'. A read-write
380 command may be run on a 'v2' filesystem by clearing the cache, running the
381 command, and then remounting with 'space_cache=v2'.
382 +
383 If a version is not explicitly specified, the default implementation will be
384 chosen, which is 'v1'.
385
386 *ssd*::
387 *ssd_spread*::
388 *nossd*::
389 (default: SSD autodetected)
390 +
391 Options to control SSD allocation schemes.  By default, BTRFS will
392 enable or disable SSD optimizations depending on status of a device with
393 respect to rotational or non-rotational type. This is determined by the
394 contents of '/sys/block/DEV/queue/rotational'). If it is 1, the 'ssd' option is
395 turned on.  The option 'nossd' will disable the autodetection.
396 +
397 The optimizations make use of the absence of the seek penalty that's inherent
398 for the rotational devices. The blocks can be typically written faster and
399 are not offloaded to separate threads.
400 +
401 NOTE: Since 4.14, the block layout optimizations have been dropped. This used
402 to help with first generations of SSD devices. Their FTL (flash translation
403 layer) was not effective and the optimization was supposed to improve the wear
404 by better aligning blocks. This is no longer true with modern SSD devices and
405 the optimization had no real benefit. Furthermore it caused increased
406 fragmentation. The layout tuning has been kept intact for the option
407 'ssd_spread'.
408 +
409 The 'ssd_spread' mount option attempts to allocate into bigger and aligned
410 chunks of unused space, and may perform better on low-end SSDs.  'ssd_spread'
411 implies 'ssd', enabling all other SSD heuristics as well. The option 'nossd'
412 will disable all SSD options.
413
414 *subvol='path'*::
415 Mount subvolume from 'path' rather than the toplevel subvolume. The
416 'path' is always treated as relative to the the toplevel subvolume.
417 This mount option overrides the default subvolume set for the given filesystem.
418
419 *subvolid='subvolid'*::
420 Mount subvolume specified by a 'subvolid' number rather than the toplevel
421 subvolume.  You can use *btrfs subvolume list* of *btrfs subvolume show* to see
422 subvolume ID numbers.
423 This mount option overrides the default subvolume set for the given filesystem.
424 +
425 NOTE: if both 'subvolid' and 'subvol' are specified, they must point at the
426 same subvolume, otherwise the mount will fail.
427
428 *thread_pool='number'*::
429 (default: min(NRCPUS + 2, 8) )
430 +
431 The number of worker threads to start. NRCPUS is number of on-line CPUs
432 detected at the time of mount. Small number leads to less parallelism in
433 processing data and metadata, higher numbers could lead to a performance hit
434 due to increased locking contention, process scheduling, cache-line bouncing or
435 costly data transfers between local CPU memories.
436
437 *treelog*::
438 *notreelog*::
439 (default: on)
440 +
441 Enable the tree logging used for 'fsync' and 'O_SYNC' writes. The tree log
442 stores changes without the need of a full filesystem sync. The log operations
443 are flushed at sync and transaction commit. If the system crashes between two
444 such syncs, the pending tree log operations are replayed during mount.
445 +
446 WARNING: currently, the tree log is replayed even with a read-only mount! To
447 disable that behaviour, also mount with 'nologreplay'.
448 +
449 The tree log could contain new files/directories, these would not exist on
450 a mounted filesystem if the log is not replayed.
451
452 *usebackuproot*::
453 *nousebackuproot*::
454 (since: 4.6, default: off)
455 +
456 Enable autorecovery attempts if a bad tree root is found at mount time.
457 Currently this scans a backup list of several previous tree roots and tries to
458 use the first readable. This can be used with read-only mounts as well.
459 +
460 NOTE: This option has replaced 'recovery'.
461
462 *user_subvol_rm_allowed*::
463 (default: off)
464 +
465 Allow subvolumes to be deleted by their respective owner. Otherwise, only the
466 root user can do that.
467 +
468 NOTE: historically, any user could create a snapshot even if he was not owner
469 of the source subvolume, the subvolume deletion has been restricted for that
470 reason. The subvolume creation has been restricted but this mount option is
471 still required. This is a usability issue and will be addressed in the future.
472
473 DEPRECATED MOUNT OPTIONS
474 ~~~~~~~~~~~~~~~~~~~~~~~~
475
476 List of mount options that have been removed, kept for backward compatibility.
477
478 *alloc_start='bytes'*::
479 (default: 1M, minimum: 1M, deprecated since: 4.13)
480 +
481 Debugging option to force all block allocations above a certain
482 byte threshold on each block device.  The value is specified in
483 bytes, optionally with a K, M, or G suffix (case insensitive).
484
485 *recovery*::
486 (since: 3.2, default: off, deprecated since: 4.5)
487 +
488 NOTE: this option has been replaced by 'usebackuproot' and should not be used
489 but will work on 4.5+ kernels.
490
491 *subvolrootid='objectid'*::
492 (irrelevant since: 3.2, formally deprecated since: 3.10)
493 +
494 A workaround option from times (pre 3.2) when it was not possible to mount a
495 subvolume that did not reside directly under the toplevel subvolume.
496
497 NOTES ON GENERIC MOUNT OPTIONS
498 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
499
500 Some of the general mount options from `mount`(8) that affect BTRFS and are
501 worth mentioning.
502
503 *noatime*::
504 under read intensive work-loads, specifying 'noatime' significantly improves
505 performance because no new access time information needs to be written. Without
506 this option, the default is 'relatime', which only reduces the number of
507 inode atime updates in comparison to the traditional 'strictatime'. The worst
508 case for atime updates under 'relatime' occurs when many files are read whose
509 atime is older than 24 h and which are freshly snapshotted. In that case the
510 atime is updated 'and' COW happens - for each file - in bulk. See also
511 https://lwn.net/Articles/499293/ - 'Atime and btrfs: a bad combination? (LWN, 2012-05-31)'.
512 +
513 Note that 'noatime' may break applications that rely on atime uptimes like
514 the venerable Mutt (unless you use maildir mailboxes).
515
516
517 FILESYSTEM FEATURES
518 -------------------
519
520 The basic set of filesystem features gets extended over time. The backward
521 compatibility is maintained and the features are optional, need to be
522 explicitly asked for so accidental use will not create incompatibilities.
523
524 There are several classes and the respective tools to manage the features:
525
526 at mkfs time only::
527 This is namely for core structures, like the b-tree nodesize, see
528 `mkfs.btrfs`(8) for more details.
529
530 after mkfs, on an unmounted filesystem::
531 Features that may optimize internal structures or add new structures to support
532 new functionality, see `btrfstune`(8). The command *btrfs inspect-internal
533 dump-super device* will dump a superblock, you can map the value of
534 'incompat_flags' to the features listed below
535
536 after mkfs, on a mounted filesystem::
537 The features of a filesystem (with a given UUID) are listed in
538 `/sys/fs/btrfs/UUID/features/`, one file per feature. The status is stored
539 inside the file. The value '1' is for enabled and active, while '0' means the
540 feature was enabled at mount time but turned off afterwards.
541 +
542 Whether a particular feature can be turned on a mounted filesystem can be found
543 in the directory `/sys/fs/btrfs/features/`, one file per feature. The value '1'
544 means the feature can be enabled.
545
546 List of features (see also `mkfs.btrfs`(8) section 'FILESYSTEM FEATURES'):
547
548 *big_metadata*::
549 (since: 3.4)
550 +
551 the filesystem uses 'nodesize' for metadata blocks, this can be bigger than the
552 page size
553
554 *compress_lzo*::
555 (since: 2.6.38)
556 +
557 the 'lzo' compression has been used on the filesystem, either as a mount option
558 or via *btrfs filesystem defrag*.
559
560 *compress_zstd*::
561 (since: 4.14)
562 +
563 the 'zstd' compression has been used on the filesystem, either as a mount option
564 or via *btrfs filesystem defrag*.
565
566 *default_subvol*::
567 (since: 2.6.34)
568 +
569 the default subvolume has been set on the filesystem
570
571 *extended_iref*::
572 (since: 3.7)
573 +
574 increased hardlink limit per file in a directory to 65536, older kernels
575 supported a varying number of hardlinks depending on the sum of all file name
576 sizes that can be stored into one metadata block
577
578 *mixed_backref*::
579 (since: 2.6.31)
580 +
581 the last major disk format change, improved backreferences, now default
582
583 *mixed_groups*::
584 (since: 2.6.37)
585 +
586 mixed data and metadata block groups, ie. the data and metadata are not
587 separated and occupy the same block groups, this mode is suitable for small
588 volumes as there are no constraints how the remaining space should be used
589 (compared to the split mode, where empty metadata space cannot be used for data
590 and vice versa)
591 +
592 on the other hand, the final layout is quite unpredictable and possibly highly
593 fragmented, which means worse performance
594
595 *no_holes*::
596 (since: 3.14)
597 +
598 improved representation of file extents where holes are not explicitly
599 stored as an extent, saves a few percent of metadata if sparse files are used
600
601 *raid56*::
602 (since: 3.9)
603 +
604 the filesystem contains or contained a raid56 profile of block groups
605
606 *skinny_metadata*::
607 (since: 3.10)
608 +
609 reduced-size metadata for extent references, saves a few percent of metadata
610
611 FILE ATTRIBUTES
612 ---------------
613 The btrfs filesystem supports setting the following file attributes using the
614 `chattr`(1) utility:
615
616 *a*::
617 'append only', new writes are always written at the end of the file
618
619 *A*::
620 'no atime updates'
621
622 *c*::
623 'compress data', all data written after this attribute is set will be compressed.
624 Please note that compression is also affected by the mount options or the parent
625 directory attributes.
626 +
627 When set on a directory, all newly created files will inherit this attribute.
628
629 *C*::
630 'no copy-on-write', file modifications are done in-place
631 +
632 When set on a directory, all newly created files will inherit this attribute.
633 +
634 NOTE: due to implementation limitations, this flag can be set/unset only on
635 empty files.
636
637 *d*::
638 'no dump', makes sense with 3rd party tools like `dump`(8), on BTRFS the
639 attribute can be set/unset but no other special handling is done
640
641 *D*::
642 'synchronous directory updates', for more details search `open`(2) for 'O_SYNC'
643 and 'O_DSYNC'
644
645 *i*::
646 'immutable', no file data and metadata changes allowed even to the root user as
647 long as this attribute is set (obviously the exception is unsetting the attribute)
648
649 *S*::
650 'synchronous updates', for more details search `open`(2) for 'O_SYNC' and
651 'O_DSYNC'
652
653 *X*::
654 'no compression', permanently turn off compression on the given file. Any
655 compression mount options will not affect this file.
656 +
657 When set on a directory, all newly created files will inherit this attribute.
658
659 No other attributes are supported.  For the complete list please refer to the
660 `chattr`(1) manual page.
661
662 CONTROL DEVICE
663 --------------
664
665 There's a character special device `/dev/btrfs-control` with major and minor
666 numbers 10 and 234 (the device can be found under the 'misc' category).
667
668 --------------------
669 $ ls -l /dev/btrfs-control
670 crw------- 1 root root 10, 234 Jan  1 12:00 /dev/btrfs-control
671 --------------------
672
673 The device accepts some ioctl calls that can perform following actions on the
674 filesystem module:
675
676 * scan devices for btrfs filesystem (ie. to let multi-device filesystems mount
677   automatically) and register them with the kernel module
678 * similar to scan, but also wait until the device scanning process is finished
679   for a given filesystem
680 * get the supported features (can be also found under '/sys/fs/btrfs/features')
681
682 The device is usually created by a system device node manager (eg. udev), but
683 can be created manually:
684
685 --------------------
686 # mknod --mode=600 c 10 234 /dev/btrfs-control
687 --------------------
688
689 The control device is not strictly required but the device scanning will not
690 work and a workaround would need to be used to mount a multi-device filesystem.
691 The mount option 'device' can trigger the device scanning during mount.
692
693 SEE ALSO
694 --------
695 `acl`(5),
696 `btrfs`(8),
697 `chattr`(1),
698 `fstrim`(8),
699 `ioctl`(2),
700 `mkfs.btrfs`(8),
701 `mount`(8)