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
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).
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.
42 Enable/disable support for Posix Access Control Lists (ACLs). See the
43 `acl`(5) manual page for more information about ACLs.
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.
50 (since: 3.0, default: off)
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.
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
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
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.
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.
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.
91 *check_int_print_mask='value'*::
92 (since: 3.0, default: off)
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.
98 'check_int' enables the integrity checker module, which examines all
99 block write requests to ensure on-disk consistency, at a large
102 'check_int_data' includes extent data in the integrity checks, and
103 implies the 'check_int' option.
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.
109 See comments at the top of 'fs/btrfs/check-integrity.c'
110 for more information.
113 Force clearing and rebuilding of the disk space cache if something
114 has gone wrong. See also: 'space_cache'.
117 (since: 3.12, default: 30)
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.
128 *compress-force='type'*::
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.
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.
142 Since kernel 4.15, a set of heuristic algorithms have been improved by using
143 frequency sampling, repeated pattern detection and Shannon entropy calculation
146 NOTE: If compression is enabled, 'nodatacow' and 'nodatasum' are disabled.
152 Enable data copy-on-write for newly created files.
153 'Nodatacow' implies 'nodatasum', and disables 'compression'. All files created
154 under 'nodatacow' are also set the NOCOW file attribute (see `chattr`(1)).
156 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
158 Updates in-place improve performance for workloads that do frequent overwrites,
159 at the cost of potential partial writes, in case the write is interruted
160 (system crash, device failure).
166 Enable data checksumming for newly created files.
167 'Datasum' implies 'datacow', ie. the normal mode of operation. All files created
168 under 'nodatasum' inherit the "no checksums" property, however there's no
169 corresponding file attribute (see `chattr`(1)).
171 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
173 There is a slight performance gain when checksums are turned off, the
174 correspoinding metadata blocks holding the checksums do not need to updated.
175 The cost of checksumming of the blocks in memory is much lower than the IO,
176 modern CPUs feature hardware support of the checksumming algorithm.
181 Allow mounts with less devices than the RAID profile constraints
182 require. A read-write mount (or remount) may fail when there are too many devices
183 missing, for example if a stripe member is completely missing from RAID0.
185 Since 4.14, the constraint checks have been improved and are verified on the
186 chunk level, not an the device level. This allows degraded mounts of
187 filesystems with mixed RAID profiles for data and metadata, even if the
188 device number constraints would not be satisfied for some of the prifles.
190 Example: metadata -- raid1, data -- single, devices -- /dev/sda, /dev/sdb
192 Suppose the data are completely stored on 'sda', then missing 'sdb' will not
193 prevent the mount, even if 1 missing device would normally prevent (any)
194 'single' profile to mount. In case some of the data chunks are stored on 'sdb',
195 then the constraint of single/data is not satisfied and the filesystem
198 *device='devicepath'*::
199 Specify a path to a device that will be scanned for BTRFS filesystem during
200 mount. This is usually done automatically by a device manager (like udev) or
201 using the *btrfs device scan* command (eg. run from the initial ramdisk). In
202 cases where this is not possible the 'device' mount option can help.
204 NOTE: booting eg. a RAID1 system may fail even if all filesystem's 'device'
205 paths are provided as the actual device nodes may not be discovered by the
206 system at that point.
212 Enable discarding of freed file blocks. This is useful for SSD devices, thinly
213 provisioned LUNs, or virtual machine images; however, every storage layer must
214 support discard for it to work. if the backing device does not support
215 asynchronous queued TRIM, then this operation can severely degrade performance,
216 because a synchronous TRIM operation will be attempted instead. Queued TRIM
217 requires newer than SATA revision 3.1 chipsets and devices.
219 If it is not necessary to immediately discard freed blocks, then the `fstrim`
220 tool can be used to discard all free blocks in a batch. Scheduling a TRIM
221 during a period of low system activity will prevent latent interference with
222 the performance of other operations. Also, a device may ignore the TRIM command
223 if the range is too small, so running a batch discard has a greater probability
224 of actually discarding the blocks.
226 If discarding is not necessary to be done at the block freeing time, there's
227 `fstrim`(8) tool that lets the filesystem discard all free blocks in a batch,
228 possibly not much interfering with other operations. Also, the device may
229 ignore the TRIM command if the range is too small, so running the batch discard
230 can actually discard the blocks.
236 Enable verbose output for some ENOSPC conditions. It's safe to use but can
237 be noisy if the system reaches near-full state.
239 *fatal_errors='action'*::
240 (since: 3.4, default: bug)
242 Action to take when encountering a fatal error.
245 'BUG()' on a fatal error, the system will stay in the crashed state and may be
246 still partially usable, but reboot is required for full operation
249 'panic()' on a fatal error, depending on other system configuration, this may
250 be followed by a reboot. Please refer to the documentation of kernel boot
251 parameters, eg. 'panic', 'oops' or 'crashkernel'.
257 This option forces any data dirtied by a write in a prior transaction to commit
258 as part of the current commit, effectively a full filesystem sync.
260 This makes the committed state a fully consistent view of the file system from
261 the application's perspective (i.e. it includes all completed file system
262 operations). This was previously the behavior only when a snapshot was
265 When off, the filesystem is consistent but buffered writes may last more than
266 one transaction commit.
269 (depends on compile-time option BTRFS_DEBUG, since: 4.4, default: off)
271 A debugging helper to intentionally fragment given 'type' of block groups. The
272 type can be 'data', 'metadata' or 'all'. This mount option should not be used
273 outside of debugging environments and is not recognized if the kernel config
274 option 'BTRFS_DEBUG' is not enabled.
278 (since: 3.0, default: off)
280 Enable free inode number caching. Not recommended to use unless files on your
281 filesystem get assigned inode numbers that are approaching 2^64^. Normally, new
282 files in each subvolume get assigned incrementally (plus one from the last
283 time) and are not reused. The mount option turns on caching of the existing
284 inode numbers and reuse of inode numbers of deleted files.
286 This option may slow down your system at first run, or after mounting without
289 NOTE: Defaults to off due to a potential overflow problem when the free space
290 checksums don't fit inside a single page.
292 Don't use this option unless you really need it. The inode number limit
293 on 64bit system is 2^64^, which is practically enough for the whole filesystem
294 lifetime. Due to implementation of linux VFS layer, the inode numbers on 32bit
295 systems are only 32 bits wide. This lowers the limit significantly and makes
296 it possible to reach it. In such case, this mount option will help.
297 Alternatively, files with high inode numbers can be copied to a new subvolume
298 which will effectively start the inode numbers from the beginning again.
302 (default: on, even read-only)
304 Enable/disable log replay at mount time. See also 'treelog'.
305 Note that 'nologreplay' is the same as 'norecovery'.
307 WARNING: currently, the tree log is replayed even with a read-only mount! To
308 disable that behaviour, mount also with 'nologreplay'.
310 *max_inline='bytes'*::
311 (default: min(2048, page size) )
313 Specify the maximum amount of space, that can be inlined in
314 a metadata B-tree leaf. The value is specified in bytes, optionally
315 with a K suffix (case insensitive). In practice, this value
316 is limited by the filesystem block size (named 'sectorsize' at mkfs time),
317 and memory page size of the system. In case of sectorsize limit, there's
318 some space unavailable due to leaf headers. For example, a 4k sectorsize,
319 maximum size of inline data is about 3900 bytes.
321 Inlining can be completely turned off by specifying 0. This will increase data
322 block slack if file sizes are much smaller than block size but will reduce
323 metadata consumption in return.
325 NOTE: the default value has changed to 2048 in kernel 4.6.
327 *metadata_ratio='value'*::
328 (default: 0, internal logic)
330 Specifies that 1 metadata chunk should be allocated after every 'value' data
331 chunks. Default behaviour depends on internal logic, some percent of unused
332 metadata space is attempted to be maintained but is not always possible if
333 there's not enough space left for chunk allocation. The option could be useful to
334 override the internal logic in favor of the metadata allocation if the expected
335 workload is supposed to be metadata intense (snapshots, reflinks, xattrs,
339 (since: 4.5, default: off)
341 Do not attempt any data recovery at mount time. This will disable 'logreplay'
342 and avoids other write operations. Note that this option is the same as
345 NOTE: The opposite option 'recovery' used to have different meaning but was
346 changed for consistency with other filesystems, where 'norecovery' is used for
347 skipping log replay. BTRFS does the same and in general will try to avoid any
351 (since: 3.12, default: off)
353 Force check and rebuild procedure of the UUID tree. This should not
357 (since: 3.3, default: off)
359 Skip automatic resume of an interrupted balance operation. The operation can
360 later be resumed with *btrfs balance resume*, or the paused state can be
361 removed with *btrfs balance cancel*. The default behaviour is to resume an
362 interrupted balance immediately after a volume is mounted.
365 *space_cache='version'*::
367 ('nospace_cache' since: 3.2, 'space_cache=v1' and 'space_cache=v2' since 4.5, default: 'space_cache=v1')
369 Options to control the free space cache. The free space cache greatly improves
370 performance when reading block group free space into memory. However, managing
371 the space cache consumes some resources, including a small amount of disk
374 There are two implementations of the free space cache. The original
375 one, referred to as 'v1', is the safe default. The 'v1' space cache can be
376 disabled at mount time with 'nospace_cache' without clearing.
378 On very large filesystems (many terabytes) and certain workloads, the
379 performance of the 'v1' space cache may degrade drastically. The 'v2'
380 implementation, which adds a new B-tree called the free space tree, addresses
381 this issue. Once enabled, the 'v2' space cache will always be used and cannot
382 be disabled unless it is cleared. Use 'clear_cache,space_cache=v1' or
383 'clear_cache,nospace_cache' to do so. If 'v2' is enabled, kernels without 'v2'
384 support will only be able to mount the filesystem in read-only mode. The
385 `btrfs`(8) command currently only has read-only support for 'v2'. A read-write
386 command may be run on a 'v2' filesystem by clearing the cache, running the
387 command, and then remounting with 'space_cache=v2'.
389 If a version is not explicitly specified, the default implementation will be
390 chosen, which is 'v1'.
396 (default: SSD autodetected)
398 Options to control SSD allocation schemes. By default, BTRFS will
399 enable or disable SSD optimizations depending on status of a device with
400 respect to rotational or non-rotational type. This is determined by the
401 contents of '/sys/block/DEV/queue/rotational'). If it is 0, the 'ssd' option is
402 turned on. The option 'nossd' will disable the autodetection.
404 The optimizations make use of the absence of the seek penalty that's inherent
405 for the rotational devices. The blocks can be typically written faster and
406 are not offloaded to separate threads.
408 NOTE: Since 4.14, the block layout optimizations have been dropped. This used
409 to help with first generations of SSD devices. Their FTL (flash translation
410 layer) was not effective and the optimization was supposed to improve the wear
411 by better aligning blocks. This is no longer true with modern SSD devices and
412 the optimization had no real benefit. Furthermore it caused increased
413 fragmentation. The layout tuning has been kept intact for the option
416 The 'ssd_spread' mount option attempts to allocate into bigger and aligned
417 chunks of unused space, and may perform better on low-end SSDs. 'ssd_spread'
418 implies 'ssd', enabling all other SSD heuristics as well. The option 'nossd'
419 will disable all SSD options while 'nossd_spread' only disables 'ssd_spread'.
422 Mount subvolume from 'path' rather than the toplevel subvolume. The
423 'path' is always treated as relative to the toplevel subvolume.
424 This mount option overrides the default subvolume set for the given filesystem.
426 *subvolid='subvolid'*::
427 Mount subvolume specified by a 'subvolid' number rather than the toplevel
428 subvolume. You can use *btrfs subvolume list* of *btrfs subvolume show* to see
429 subvolume ID numbers.
430 This mount option overrides the default subvolume set for the given filesystem.
432 NOTE: if both 'subvolid' and 'subvol' are specified, they must point at the
433 same subvolume, otherwise the mount will fail.
435 *thread_pool='number'*::
436 (default: min(NRCPUS + 2, 8) )
438 The number of worker threads to start. NRCPUS is number of on-line CPUs
439 detected at the time of mount. Small number leads to less parallelism in
440 processing data and metadata, higher numbers could lead to a performance hit
441 due to increased locking contention, process scheduling, cache-line bouncing or
442 costly data transfers between local CPU memories.
448 Enable the tree logging used for 'fsync' and 'O_SYNC' writes. The tree log
449 stores changes without the need of a full filesystem sync. The log operations
450 are flushed at sync and transaction commit. If the system crashes between two
451 such syncs, the pending tree log operations are replayed during mount.
453 WARNING: currently, the tree log is replayed even with a read-only mount! To
454 disable that behaviour, also mount with 'nologreplay'.
456 The tree log could contain new files/directories, these would not exist on
457 a mounted filesystem if the log is not replayed.
461 (since: 4.6, default: off)
463 Enable autorecovery attempts if a bad tree root is found at mount time.
464 Currently this scans a backup list of several previous tree roots and tries to
465 use the first readable. This can be used with read-only mounts as well.
467 NOTE: This option has replaced 'recovery'.
469 *user_subvol_rm_allowed*::
472 Allow subvolumes to be deleted by their respective owner. Otherwise, only the
473 root user can do that.
475 NOTE: historically, any user could create a snapshot even if he was not owner
476 of the source subvolume, the subvolume deletion has been restricted for that
477 reason. The subvolume creation has been restricted but this mount option is
478 still required. This is a usability issue.
479 Since 4.18, the `rmdir`(2) syscall can delete an empty subvolume just like an
480 ordinary directory. Whether this is possible can be detected at runtime, see
481 'rmdir_subvol' feature in 'FILESYSTEM FEATURES'.
483 DEPRECATED MOUNT OPTIONS
484 ~~~~~~~~~~~~~~~~~~~~~~~~
486 List of mount options that have been removed, kept for backward compatibility.
488 *alloc_start='bytes'*::
489 (default: 1M, minimum: 1M, deprecated since: 4.13)
491 Debugging option to force all block allocations above a certain
492 byte threshold on each block device. The value is specified in
493 bytes, optionally with a K, M, or G suffix (case insensitive).
496 (since: 3.2, default: off, deprecated since: 4.5)
498 NOTE: this option has been replaced by 'usebackuproot' and should not be used
499 but will work on 4.5+ kernels.
501 *subvolrootid='objectid'*::
502 (irrelevant since: 3.2, formally deprecated since: 3.10)
504 A workaround option from times (pre 3.2) when it was not possible to mount a
505 subvolume that did not reside directly under the toplevel subvolume.
507 NOTES ON GENERIC MOUNT OPTIONS
508 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
510 Some of the general mount options from `mount`(8) that affect BTRFS and are
514 under read intensive work-loads, specifying 'noatime' significantly improves
515 performance because no new access time information needs to be written. Without
516 this option, the default is 'relatime', which only reduces the number of
517 inode atime updates in comparison to the traditional 'strictatime'. The worst
518 case for atime updates under 'relatime' occurs when many files are read whose
519 atime is older than 24 h and which are freshly snapshotted. In that case the
520 atime is updated 'and' COW happens - for each file - in bulk. See also
521 https://lwn.net/Articles/499293/ - 'Atime and btrfs: a bad combination? (LWN, 2012-05-31)'.
523 Note that 'noatime' may break applications that rely on atime uptimes like
524 the venerable Mutt (unless you use maildir mailboxes).
530 The basic set of filesystem features gets extended over time. The backward
531 compatibility is maintained and the features are optional, need to be
532 explicitly asked for so accidental use will not create incompatibilities.
534 There are several classes and the respective tools to manage the features:
537 This is namely for core structures, like the b-tree nodesize, see
538 `mkfs.btrfs`(8) for more details.
540 after mkfs, on an unmounted filesystem::
541 Features that may optimize internal structures or add new structures to support
542 new functionality, see `btrfstune`(8). The command *btrfs inspect-internal
543 dump-super device* will dump a superblock, you can map the value of
544 'incompat_flags' to the features listed below
546 after mkfs, on a mounted filesystem::
547 The features of a filesystem (with a given UUID) are listed in
548 `/sys/fs/btrfs/UUID/features/`, one file per feature. The status is stored
549 inside the file. The value '1' is for enabled and active, while '0' means the
550 feature was enabled at mount time but turned off afterwards.
552 Whether a particular feature can be turned on a mounted filesystem can be found
553 in the directory `/sys/fs/btrfs/features/`, one file per feature. The value '1'
554 means the feature can be enabled.
556 List of features (see also `mkfs.btrfs`(8) section 'FILESYSTEM FEATURES'):
561 the filesystem uses 'nodesize' for metadata blocks, this can be bigger than the
567 the 'lzo' compression has been used on the filesystem, either as a mount option
568 or via *btrfs filesystem defrag*.
573 the 'zstd' compression has been used on the filesystem, either as a mount option
574 or via *btrfs filesystem defrag*.
579 the default subvolume has been set on the filesystem
584 increased hardlink limit per file in a directory to 65536, older kernels
585 supported a varying number of hardlinks depending on the sum of all file name
586 sizes that can be stored into one metadata block
591 the last major disk format change, improved backreferences, now default
596 mixed data and metadata block groups, ie. the data and metadata are not
597 separated and occupy the same block groups, this mode is suitable for small
598 volumes as there are no constraints how the remaining space should be used
599 (compared to the split mode, where empty metadata space cannot be used for data
602 on the other hand, the final layout is quite unpredictable and possibly highly
603 fragmented, which means worse performance
608 improved representation of file extents where holes are not explicitly
609 stored as an extent, saves a few percent of metadata if sparse files are used
614 the filesystem contains or contained a raid56 profile of block groups
619 indicate that `rmdir`(2) syscall can delete an empty subvolume just like an
620 ordinary directory. Note that this feature only depends on the kernel version.
625 reduced-size metadata for extent references, saves a few percent of metadata
630 maximum file name length::
633 maximum symlink target length::
634 depends on the 'nodesize' value, for 4k it's 3949 bytes, for larger nodesize
637 The symlink target may not be a valid path, ie the path name components
638 can exceed the limits, there's no content validation at `symlink`(3) creation.
640 maximum number of inodes::
641 2^64^ but depends on the available metadata space as the inodes are created
645 minimum number: 256 (for subvolumes), regular files and directories: 257
647 maximum file length::
648 inherent limit of btrfs is 2^64^ (16 EiB) but the linux VFS limit is 2^63^ (8 EiB)
650 maximum number of subvolumes::
651 2^64^ but depends on the available metadata space, the space consumed by all
652 subvolume metadata includes bookeeping of the shared extents can be large (MiB,
655 maximum number of hardlinks of a file in a directory::
656 65536 when the `extref` feature is turned on during mkfs (default), roughly
662 The btrfs filesystem supports setting the following file attributes using the
666 'append only', new writes are always written at the end of the file
672 'compress data', all data written after this attribute is set will be compressed.
673 Please note that compression is also affected by the mount options or the parent
674 directory attributes.
676 When set on a directory, all newly created files will inherit this attribute.
679 'no copy-on-write', file modifications are done in-place
681 When set on a directory, all newly created files will inherit this attribute.
683 NOTE: due to implementation limitations, this flag can be set/unset only on
687 'no dump', makes sense with 3rd party tools like `dump`(8), on BTRFS the
688 attribute can be set/unset but no other special handling is done
691 'synchronous directory updates', for more details search `open`(2) for 'O_SYNC'
695 'immutable', no file data and metadata changes allowed even to the root user as
696 long as this attribute is set (obviously the exception is unsetting the attribute)
699 'synchronous updates', for more details search `open`(2) for 'O_SYNC' and
703 'no compression', permanently turn off compression on the given file. Any
704 compression mount options will not affect this file.
706 When set on a directory, all newly created files will inherit this attribute.
708 No other attributes are supported. For the complete list please refer to the
709 `chattr`(1) manual page.
714 There's a character special device `/dev/btrfs-control` with major and minor
715 numbers 10 and 234 (the device can be found under the 'misc' category).
718 $ ls -l /dev/btrfs-control
719 crw------- 1 root root 10, 234 Jan 1 12:00 /dev/btrfs-control
722 The device accepts some ioctl calls that can perform following actions on the
725 * scan devices for btrfs filesystem (ie. to let multi-device filesystems mount
726 automatically) and register them with the kernel module
727 * similar to scan, but also wait until the device scanning process is finished
728 for a given filesystem
729 * get the supported features (can be also found under '/sys/fs/btrfs/features')
731 The device is usually created by a system device node manager (eg. udev), but
732 can be created manually:
735 # mknod --mode=600 c 10 234 /dev/btrfs-control
738 The control device is not strictly required but the device scanning will not
739 work and a workaround would need to be used to mount a multi-device filesystem.
740 The mount option 'device' can trigger the device scanning during mount.