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