6 btrfs-man5 - topics about the BTRFS filesystem (mount options, supported file attributes and other)
10 This document describes topics related to BTRFS that are not specific to the
11 tools. Currently covers:
15 2. filesystem features
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).
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.
40 Enable/disable support for Posix Access Control Lists (ACLs). See the
41 `acl`(5) manual page for more information about ACLs.
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.
48 (since: 3.0, default: off)
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.
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
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 ref-links 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
70 Ensure that all IO write operations make it through the device cache and are stored
71 permanently when the filesystem is at it's 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.
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.
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.
89 *check_int_print_mask='value'*::
90 (since: 3.0, default: off)
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.
96 'check_int' enables the integrity checker module, which examines all
97 block write requests to ensure on-disk consistency, at a large
100 'check_int_data' includes extent data in the integrity checks, and
101 implies the 'check_int' option.
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.
107 See comments at the top of 'fs/btrfs/check-integrity.c'
108 for more information.
111 Force clearing and rebuilding of the disk space cache if something
112 has gone wrong. See also: 'space_cache'.
115 (since: 3.12, default: 30)
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.
126 *compress-force='type'*::
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 the compression will allways be attempted, but the data may end up uncompressed
133 if the compression would make them larger.
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.
142 NOTE: If compression is enabled, 'nodatacow' and 'nodatasum' are disabled.
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)).
152 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
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).
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)).
167 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
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.
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.
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.
186 Example: metadata -- raid1, data -- single, devices -- /dev/sda, /dev/sdb
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
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.
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.
208 Enable discarding of freed file blocks using the TRIM operation. This is useful
209 for SSD devices, thinly provisioned LUNs or virtual machine images where the
210 backing device understands the operation. Depending on support of the
211 underlying device, the operation may severely hurt performance in case the TRIM
212 operation is synchronous (eg. with SATA devices up to revision 3.0).
214 If discarding is not necessary to be done at the block freeing time, there's
215 `fstrim`(8) tool that lets the filesystem discard all free blocks in a batch,
216 possibly not much interfering with other operations. Also, the the device may
217 ignore the TRIM command if the range is too small, so running the batch discard
218 can actually discard the blocks.
224 Enable verbose output for some ENOSPC conditions. It's safe to use but can
225 be noisy if the system reaches near-full state.
227 *fatal_errors='action'*::
228 (since: 3.4, default: bug)
230 Action to take when encountering a fatal error.
233 'BUG()' on a fatal error, the system will stay in the crashed state and may be
234 still partially usable, but reboot is required for full operation
237 'panic()' on a fatal error, depending on other system configuration, this may
238 be followed by a reboot. Please refer to the documentation of kernel boot
239 parameters, eg. 'panic', 'oops' or 'crashkernel'.
245 This option forces any data dirtied by a write in a prior transaction to commit
246 as part of the current commit, effectively a full filesystem sync.
248 This makes the committed state a fully consistent view of the file system from
249 the application's perspective (i.e. it includes all completed file system
250 operations). This was previously the behavior only when a snapshot was
253 When off, the filesystem is consistent but buffered writes may last more than
254 one transaction commit.
257 (depends on compile-time option BTRFS_DEBUG, since: 4.4, default: off)
259 A debugging helper to intentionally fragment given 'type' of block groups. The
260 type can be 'data', 'metadata' or 'all'. This mount option should not be used
261 outside of debugging environments and is not recognized if the kernel config
262 option 'BTRFS_DEBUG' is not enabled.
266 (since: 3.0, default: off)
268 Enable free inode number caching. Not recommended to use unless files on your
269 filesystem get assigned inode numbers that are approaching 2^64^. Normally, new
270 files in each subvolume get assigned incrementally (plus one from the last
271 time) and are not reused. The mount option turns on caching of the existing
272 inode numbers and reuse of inode numbers of deleted files.
274 This option may slow down your system at first run, or after mounting without
277 NOTE: Defaults to off due to a potential overflow problem when the free space
278 checksums don't fit inside a single page.
280 Don't use this option unless you really need it. The inode number limit
281 on 64bit system is 2^64^, which is practically enough for the whole filesystem
282 lifetime. Due to implemention of linux VFS layer, the inode numbers on 32bit
283 systems are only 32 bits wide. This lowers the limit significantly and makes
284 it possible to reach it. In such case, this mount option will help.
285 Alternatively, files with high inode numbers can be copied to a new subvolume
286 which will effectively start the inode numbers from the beginning again.
290 (default: on, even read-only)
292 Enable/disable log replay at mount time. See also 'treelog'.
294 WARNING: currently, the tree log is replayed even with a read-only mount! To
295 disable that behaviour, mount also with 'nologreplay'.
297 *max_inline='bytes'*::
298 (default: min(2048, page size) )
300 Specify the maximum amount of space, that can be inlined in
301 a metadata B-tree leaf. The value is specified in bytes, optionally
302 with a K suffix (case insensitive). In practice, this value
303 is limited by the filesystem block size (named 'sectorsize' at mkfs time),
304 and memory page size of the system. In case of sectorsize limit, there's
305 some space unavailable due to leaf headers. For example, a 4k sectorsize,
306 maximum size of inline data is about 3900 bytes.
308 Inlining can be completely turned off by specifying 0. This will increase data
309 block slack if file sizes are much smaller than block size but will reduce
310 metadata consumption in return.
312 NOTE: the default value has changed to 2048 in kernel 4.6.
314 *metadata_ratio='value'*::
315 (default: 0, internal logic)
317 Specifies that 1 metadata chunk should be allocated after every 'value' data
318 chunks. Default behaviour depends on internal logic, some percent of unused
319 metadata space is attempted to be maintained but is not always possible if
320 there's not enough space left for chunk allocation. The option could be useful to
321 override the internal logic in favor of the metadata allocation if the expected
322 workload is supposed to be metadata intense (snapshots, reflinks, xattrs,
326 (since: 4.5, default: off)
328 Do not attempt any data recovery at mount time. This will disable 'logreplay'
329 and avoids other write operations.
331 NOTE: The opposite option 'recovery' used to have different meaning but was
332 changed for consistency with other filesystems, where 'norecovery' is used for
333 skipping log replay. BTRFS does the same and in general will try to avoid any
337 (since: 3.12, default: off)
339 Force check and rebuild procedure of the UUID tree. This should not
343 (since: 3.3, default: off)
345 Skip automatic resume of an interrupted balance operation. The operation can
346 later be resumed with *btrfs balance resume*, or the paused state can be
347 removed with *btrfs balance cancel*. The default behaviour is to resume an
348 interrupted balance immediately after a volume is mounted.
351 *space_cache='version'*::
353 ('nospace_cache' since: 3.2, 'space_cache=v1' and 'space_cache=v2' since 4.5, default: 'space_cache=v1')
355 Options to control the free space cache. The free space cache greatly improves
356 performance when reading block group free space into memory. However, managing
357 the space cache consumes some resources, including a small amount of disk
360 There are two implementations of the free space cache. The original
361 one, referred to as 'v1', is the safe default. The 'v1' space cache can be
362 disabled at mount time with 'nospace_cache' without clearing.
364 On very large filesystems (many terabytes) and certain workloads, the
365 performance of the 'v1' space cache may degrade drastically. The 'v2'
366 implementation, which adds a new B-tree called the free space tree, addresses
367 this issue. Once enabled, the 'v2' space cache will always be used and cannot
368 be disabled unless it is cleared. Use 'clear_cache,space_cache=v1' or
369 'clear_cache,nospace_cache' to do so. If 'v2' is enabled, kernels without 'v2'
370 support will only be able to mount the filesystem in read-only mode. The
371 `btrfs`(8) command currently only has read-only support for 'v2'. A read-write
372 command may be run on a 'v2' filesystem by clearing the cache, running the
373 command, and then remounting with 'space_cache=v2'.
375 If a version is not explicitly specified, the default implementation will be
376 chosen, which is 'v1'.
381 (default: SSD autodetected)
383 Options to control SSD allocation schemes. By default, BTRFS will
384 enable or disable SSD optimizations depending on status of a device with
385 respect to rotational or non-rotational type. This is determined by the
386 contents of '/sys/block/DEV/queue/rotational'). If it is 1, the 'ssd' option is
387 turned on. The option 'nossd' will disable the autodetection.
389 The optimizations make use of the absence of the seek penalty that's inherent
390 for the rotational devices. The blocks can be typically written faster and
391 are not offloaded to separate threads.
393 NOTE: Since 4.14, the block layout optimizations have been dropped. This used
394 to help with first generations of SSD devices. Their FTL (flash translation
395 layer) was not effective and the optimization was supposed to improve the wear
396 by better aligning blocks. This is no longer true with modern SSD devices and
397 the optimization had no real benefit. Furthermore it caused increased
398 fragmentation. The layout tuning has been kept intact for the option
401 The 'ssd_spread' mount option attempts to allocate into bigger and aligned
402 chunks of unused space, and may perform better on low-end SSDs. 'ssd_spread'
403 implies 'ssd', enabling all other SSD heuristics as well. The option 'nossd'
404 will disable all SSD options.
407 Mount subvolume from 'path' rather than the toplevel subvolume. The
408 'path' is always treated as relative to the the toplevel subvolume.
409 This mount option overrides the default subvolume set for the given filesystem.
411 *subvolid='subvolid'*::
412 Mount subvolume specified by a 'subvolid' number rather than the toplevel
413 subvolume. You can use *btrfs subvolume list* of *btrfs subvolume show* to see
414 subvolume ID numbers.
415 This mount option overrides the default subvolume set for the given filesystem.
417 NOTE: if both 'subvolid' and 'subvol' are specified, they must point at the
418 same subvolume, otherwise the mount will fail.
420 *thread_pool='number'*::
421 (default: min(NRCPUS + 2, 8) )
423 The number of worker threads to start. NRCPUS is number of on-line CPUs
424 detected at the time of mount. Small number leads to less parallelism in
425 processing data and metadata, higher numbers could lead to a performance hit
426 due to increased locking contention, process scheduling, cache-line bouncing or
427 costly data transfers between local CPU memories.
433 Enable the tree logging used for 'fsync' and 'O_SYNC' writes. The tree log
434 stores changes without the need of a full filesystem sync. The log operations
435 are flushed at sync and transaction commit. If the system crashes between two
436 such syncs, the pending tree log operations are replayed during mount.
438 WARNING: currently, the tree log is replayed even with a read-only mount! To
439 disable that behaviour, also mount with 'nologreplay'.
441 The tree log could contain new files/directories, these would not exist on
442 a mounted filesystem if the log is not replayed.
446 (since: 4.6, default: off)
448 Enable autorecovery attempts if a bad tree root is found at mount time.
449 Currently this scans a backup list of several previous tree roots and tries to
450 use the first readable. This can be used with read-only mounts as well.
452 NOTE: This option has replaced 'recovery'.
454 *user_subvol_rm_allowed*::
457 Allow subvolumes to be deleted by their respective owner. Otherwise, only the
458 root user can do that.
460 NOTE: historically, any user could create a snapshot even if he was not owner
461 of the source subvolume, the subvolume deletion has been restricted for that
462 reason. The subvolume creation has been restricted but this mount option is
463 still required. This is a usability issue and will be addressed in the future.
465 DEPRECATED MOUNT OPTIONS
466 ~~~~~~~~~~~~~~~~~~~~~~~~
468 List of mount options that have been removed, kept for backward compatibility.
470 *alloc_start='bytes'*::
471 (default: 1M, minimum: 1M, deprecated since: 4.13)
473 Debugging option to force all block allocations above a certain
474 byte threshold on each block device. The value is specified in
475 bytes, optionally with a K, M, or G suffix (case insensitive).
478 (since: 3.2, default: off, deprecated since: 4.5)
480 NOTE: this option has been replaced by 'usebackuproot' and should not be used
481 but will work on 4.5+ kernels.
483 *subvolrootid='objectid'*::
484 (irrelevant since: 3.2, formally deprecated since: 3.10)
486 A workaround option from times (pre 3.2) when it was not possible to mount a
487 subvolume that did not reside directly under the toplevel subvolume.
489 NOTES ON GENERIC MOUNT OPTIONS
490 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
492 Some of the general mount options from `mount`(8) that affect BTRFS and are
496 under read intensive work-loads, specifying 'noatime' significantly improves
497 performance because no new access time information needs to be written. Without
498 this option, the default is 'relatime', which only reduces the number of
499 inode atime updates in comparison to the traditional 'strictatime'. The worst
500 case for atime updates under 'relatime' occurs when many files are read whose
501 atime is older than 24 h and which are freshly snapshotted. In that case the
502 atime is updated 'and' COW happens - for each file - in bulk. See also
503 https://lwn.net/Articles/499293/ - 'Atime and btrfs: a bad combination? (LWN, 2012-05-31)'.
505 Note that 'noatime' may break applications that rely on atime uptimes like
506 the venerable Mutt (unless you use maildir mailboxes).
512 The basic set of filesystem features gets extended over time. The backward
513 compatibility is maintained and the features are optional, need to be
514 explicitly asked for so accidental use will not create incompatibilities.
516 There are several classes and the respective tools to manage the features:
519 This is namely for core structures, like the b-tree nodesize, see
520 `mkfs.btrfs`(8) for more details.
522 after mkfs, on an unmounted filesystem::
523 Features that may optimize internal structures or add new structures to support
524 new functionality, see `btrfstune`(8). The command *btrfs inspect-internal
525 dump-super device* will dump a superblock, you can map the value of
526 'incompat_flags' to the features listed below
528 after mkfs, on a mounted filesystem::
529 The features of a filesystem (with a given UUID) are listed in
530 `/sys/fs/btrfs/UUID/features/`, one file per feature. The status is stored
531 inside the file. The value '1' is for enabled and active, while '0' means the
532 feature was enabled at mount time but turned off afterwards.
534 Whether a particular feature can be turned on a mounted filesystem can be found
535 in the directory `/sys/fs/btrfs/features/`, one file per feature. The value '1'
536 means the feature can be enabled.
538 List of features (see also `mkfs.btrfs`(8) section 'FILESYSTEM FEATURES'):
543 the filesystem uses 'nodesize' for metadata blocks, this can be bigger than the
549 the 'lzo' compression has been used on the filesystem, either as a mount option
550 or via *btrfs filesystem defrag*.
555 the 'zstd' compression has been used on the filesystem, either as a mount option
556 or via *btrfs filesystem defrag*.
561 the default subvolume has been set on the filesystem
566 increased hardlink limit per file in a directory to 65536, older kernels
567 supported a varying number of hardlinks depending on the sum of all file name
568 sizes that can be stored into one metadata block
573 the last major disk format change, improved backreferences, now default
578 mixed data and metadata block groups, ie. the data and metadata are not
579 separated and occupy the same block groups, this mode is suitable for small
580 volumes as there are no constraints how the remaining space should be used
581 (compared to the split mode, where empty metadata space cannot be used for data
584 on the other hand, the final layout is quite unpredictable and possibly highly
585 fragmented, which means worse performance
590 improved representation of file extents where holes are not explicitly
591 stored as an extent, saves a few percent of metadata if sparse files are used
596 the filesystem contains or contained a raid56 profile of block groups
601 reduced-size metadata for extent references, saves a few percent of metadata
605 The btrfs filesystem supports setting the following file attributes using the
609 'append only', new writes are always written at the end of the file
615 'compress data', all data written after this attribute is set will be compressed.
616 Please note that compression is also affected by the mount options or the parent
617 directory attributes.
619 When set on a directory, all newly created files will inherit this attribute.
622 'no copy-on-write', file modifications are done in-place
624 When set on a directory, all newly created files will inherit this attribute.
626 NOTE: due to implementation limitations, this flag can be set/unset only on
630 'no dump', makes sense with 3rd party tools like `dump`(8), on BTRFS the
631 attribute can be set/unset but no other special handling is done
634 'synchronous directory updates', for more details search `open`(2) for 'O_SYNC'
638 'immutable', no file data and metadata changes allowed even to the root user as
639 long as this attribute is set (obviously the exception is unsetting the attribute)
642 'synchronous updates', for more details search `open`(2) for 'O_SYNC' and
646 'no compression', permanently turn off compression on the given file, other
647 compression mount options will not affect that
649 When set on a directory, all newly created files will inherit this attribute.
651 No other attributes are supported. For the complete list please refer to the
652 `chattr`(1) manual page.
657 There's a character special device `/dev/btrfs-control` with major and minor
658 numbers 10 and 234 (the device can be found under the 'misc' category).
661 $ ls -l /dev/btrfs-control
662 crw------- 1 root root 10, 234 Jan 1 12:00 /dev/btrfs-control
665 The device accepts some ioctl calls that can perform following actions on the
668 * scan devices for btrfs filesystem (ie. to let multi-device filesystems mount
669 automatically) and register them with the kernel module
670 * similar to scan, but also wait until the device scanning process is finished
671 for a given filesystem
672 * get the supported features (can be also found under '/sys/fs/btrfs/features')
674 The device is usually created by a system device node manager (eg. udev), but
675 can be created manually:
678 # mknod --mode=600 c 10 234 /dev/btrfs-control
681 The control device is not strictly required but the device scanning will not
682 work and a workaround would need to be used to mount a multi-device filesystem.
683 The mount option 'device' can trigger the device scanning during mount.