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).
33 Enable/disable support for Posix Access Control Lists (ACLs). See the
34 `acl`(5) manual page for more information about ACLs.
36 The support for ACL is build-time configurable (BTRFS_FS_POSIX_ACL) and
37 mount fails if 'acl' is requested but the feature is not compiled in.
41 (since: 3.0, default: off)
43 Enable automatic file defragmentation.
44 When enabled, small random writes into files (in a range of tens of kilobytes,
45 currently it's 64K) are detected and queued up for the defragmentation process.
46 Not well suited for large database workloads.
48 The read latency may increase due to reading the adjacent blocks that make up the
49 range for defragmentation, successive write will merge the blocks in the new
52 WARNING: Defragmenting with Linux kernel versions < 3.9 or ≥ 3.14-rc2 as
53 well as with Linux stable kernel versions ≥ 3.10.31, ≥ 3.12.12 or
54 ≥ 3.13.4 will break up the ref-links of CoW data (for example files
55 copied with `cp --reflink`, snapshots or de-duplicated data).
56 This may cause considerable increase of space usage depending on the
63 Ensure that all IO write operations make it through the device cache and are stored
64 permanently when the filesystem is at it's consistency checkpoint. This
65 typically means that a flush command is sent to the device that will
66 synchronize all pending data and ordinary metadata blocks, then writes the
67 superblock and issues another flush.
69 The write flushes incur a slight hit and also prevent the IO block
70 scheduler to reorder requests in a more effective way. Disabling barriers gets
71 rid of that penalty but will most certainly lead to a corrupted filesystem in
72 case of a crash or power loss. The ordinary metadata blocks could be yet
73 unwritten at the time the new superblock is stored permanently, expecting that
74 the block pointers to metadata were stored permanently before.
76 On a device with a volatile battery-backed write-back cache, the 'nobarrier'
77 option will not lead to filesystem corruption as the pending blocks are
78 supposed to make it to the permanent storage.
82 *check_int_print_mask='value'*::
83 (since: 3.0, default: off)
85 These debugging options control the behavior of the integrity checking
86 module (the BTRFS_FS_CHECK_INTEGRITY config option required). The main goal is
87 to verify that all blocks from a given transaction period are properly linked.
89 'check_int' enables the integrity checker module, which examines all
90 block write requests to ensure on-disk consistency, at a large
93 'check_int_data' includes extent data in the integrity checks, and
94 implies the 'check_int' option.
96 'check_int_print_mask' takes a bitmask of BTRFSIC_PRINT_MASK_* values
97 as defined in 'fs/btrfs/check-integrity.c', to control the integrity
98 checker module behavior.
100 See comments at the top of 'fs/btrfs/check-integrity.c'
101 for more information.
104 Force clearing and rebuilding of the disk space cache if something
105 has gone wrong. See also: 'space_cache'.
108 (since: 3.12, default: 30)
110 Set the interval of periodic transaction commit when data are synchronized
111 to permanent storage. Higher interval values lead to larger amount of unwritten
112 data, which has obvious consequences when the system crashes.
113 The upper bound is not forced, but a warning is printed if it's more than 300
114 seconds (5 minutes). Use with care.
119 *compress-force='type'*::
122 Control BTRFS file data compression. Type may be specified as 'zlib',
123 'lzo', 'zstd' or 'no' (for no compression, used for remounting). If no type
124 is specified, 'zlib' is used. If 'compress-force' is specified,
125 the compression will allways be attempted, but the data may end up uncompressed
126 if the compression would make them larger.
128 Otherwise some simple heuristics are applied to detect an incompressible file.
129 If the first blocks written to a file are not compressible, the whole file is
130 permanently marked to skip compression. As this is too simple, the
131 'compress-force' is a workaround that will compress most of the files at the
132 cost of some wasted CPU cycles on failed attempts. The heuristics of 'compress'
133 will improve in the future so this will not be necessary.
135 NOTE: If compression is enabled, 'nodatacow' and 'nodatasum' are disabled.
141 Enable data copy-on-write for newly created files.
142 'Nodatacow' implies 'nodatasum', and disables 'compression'. All files created
143 under 'nodatacow' are also set the NOCOW file attribute (see `chattr`(1)).
145 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
147 Updates in-place improve performance for workloads that do frequent overwrites,
148 at the cost of potential partial writes, in case the write is interruted
149 (system crash, device failure).
155 Enable data checksumming for newly created files.
156 'Datasum' implies 'datacow', ie. the normal mode of operation. All files created
157 under 'nodatasum' inherit the "no checksums" property, however there's no
158 corresponding file attribute (see `chattr`(1)).
160 NOTE: If 'nodatacow' or 'nodatasum' are enabled, compression is disabled.
162 There is a slight performance gain when checksums are turned off, the
163 correspoinding metadata blocks holding the checksums do not need to updated.
164 The cost of checksumming of the blocks in memory is much lower than the IO,
165 modern CPUs feature hardware support of the checksumming algorithm.
170 Allow mounts with less devices than the RAID profile constraints
171 require. A read-write mount (or remount) may fail when there are too many devices
172 missing, for example if a stripe member is completely missing from RAID0.
174 Since 4.14, the constraint checks have been improved and are verified on the
175 chunk level, not an the device level. This allows degraded mounts of
176 filesystems with mixed RAID profiles for data and metadata, even if the
177 device number constraints would not be satisfied for some of the prifles.
179 Example: metadata -- raid1, data -- single, devices -- /dev/sda, /dev/sdb
181 Suppose the data are completely stored on 'sda', then missing 'sdb' will not
182 prevent the mount, even if 1 missing device would normally prevent (any)
183 'single' profile to mount. In case some of the data chunks are stored on 'sdb',
184 then the constraint of single/data is not satisfied and the filesystem
187 *device='devicepath'*::
188 Specify a path to a device that will be scanned for BTRFS filesystem during
189 mount. This is usually done automatically by a device manager (like udev) or
190 using the *btrfs device scan* command (eg. run from the initial ramdisk). In
191 cases where this is not possible the 'device' mount option can help.
193 NOTE: booting eg. a RAID1 system may fail even if all filesystem's 'device'
194 paths are provided as the actual device nodes may not be discovered by the
195 system at that point.
201 Enable discarding of freed file blocks using the TRIM operation. This is useful
202 for SSD devices, thinly provisioned LUNs or virtual machine images where the
203 backing device understands the operation. Depending on support of the
204 underlying device, the operation may severely hurt performance in case the TRIM
205 operation is synchronous (eg. with SATA devices up to revision 3.0).
207 If discarding is not necessary to be done at the block freeing time, there's
208 `fstrim`(8) tool that lets the filesystem discard all free blocks in a batch,
209 possibly not much interfering with other operations. Also, the the device may
210 ignore the TRIM command if the range is too small, so running the batch discard
211 can actually discard the blocks.
217 Enable verbose output for some ENOSPC conditions. It's safe to use but can
218 be noisy if the system reaches near-full state.
220 *fatal_errors='action'*::
221 (since: 3.4, default: bug)
223 Action to take when encountering a fatal error.
226 'BUG()' on a fatal error, the system will stay in the crashed state and may be
227 still partially usable, but reboot is required for full operation
230 'panic()' on a fatal error, depending on other system configuration, this may
231 be followed by a reboot. Please refer to the documentation of kernel boot
232 parameters, eg. 'panic', 'oops' or 'crashkernel'.
238 This option forces any data dirtied by a write in a prior transaction to commit
239 as part of the current commit, effectively a full filesystem sync.
241 This makes the committed state a fully consistent view of the file system from
242 the application's perspective (i.e. it includes all completed file system
243 operations). This was previously the behavior only when a snapshot was
246 When off, the filesystem is consistent but buffered writes may last more than
247 one transaction commit.
250 (depends on compile-time option BTRFS_DEBUG, since: 4.4, default: off)
252 A debugging helper to intentionally fragment given 'type' of block groups. The
253 type can be 'data', 'metadata' or 'all'. This mount option should not be used
254 outside of debugging environments and is not recognized if the kernel config
255 option 'BTRFS_DEBUG' is not enabled.
259 (since: 3.0, default: off)
261 Enable free inode number caching. Not recommended to use unless files on your
262 filesystem get assigned inode numbers that are approaching 2^64^. Normally, new
263 files in each subvolume get assigned incrementally (plus one from the last
264 time) and are not reused. The mount option turns on caching of the existing
265 inode numbers and reuse of inode numbers of deleted files.
267 This option may slow down your system at first run, or after mounting without
270 NOTE: Defaults to off due to a potential overflow problem when the free space
271 checksums don't fit inside a single page.
273 Don't use this option unless you really need it. The inode number limit
274 on 64bit system is 2^64^, which is practically enough for the whole filesystem
275 lifetime. Due to implemention of linux VFS layer, the inode numbers on 32bit
276 systems are only 32 bits wide. This lowers the limit significantly and makes
277 it possible to reach it. In such case, this mount option will help.
278 Alternatively, files with high inode numbers can be copied to a new subvolume
279 which will effectively start the inode numbers from the beginning again.
283 (default: on, even read-only)
285 Enable/disable log replay at mount time. See also 'treelog'.
287 WARNING: currently, the tree log is replayed even with a read-only mount! To
288 disable that behaviour, mount also with 'nologreplay'.
290 *max_inline='bytes'*::
291 (default: min(2048, page size) )
293 Specify the maximum amount of space, that can be inlined in
294 a metadata B-tree leaf. The value is specified in bytes, optionally
295 with a K suffix (case insensitive). In practice, this value
296 is limited by the filesystem block size (named 'sectorsize' at mkfs time),
297 and memory page size of the system. In case of sectorsize limit, there's
298 some space unavailable due to leaf headers. For example, a 4k sectorsize,
299 maximum size of inline data is about 3900 bytes.
301 Inlining can be completely turned off by specifying 0. This will increase data
302 block slack if file sizes are much smaller than block size but will reduce
303 metadata consumption in return.
305 NOTE: the default value has changed to 2048 in kernel 4.6.
307 *metadata_ratio='value'*::
308 (default: 0, internal logic)
310 Specifies that 1 metadata chunk should be allocated after every 'value' data
311 chunks. Default behaviour depends on internal logic, some percent of unused
312 metadata space is attempted to be maintained but is not always possible if
313 there's not enough space left for chunk allocation. The option could be useful to
314 override the internal logic in favor of the metadata allocation if the expected
315 workload is supposed to be metadata intense (snapshots, reflinks, xattrs,
319 (since: 4.5, default: off)
321 Do not attempt any data recovery at mount time. This will disable 'logreplay'
322 and avoids other write operations.
324 NOTE: The opposite option 'recovery' used to have different meaning but was
325 changed for consistency with other filesystems, where 'norecovery' is used for
326 skipping log replay. BTRFS does the same and in general will try to avoid any
330 (since: 3.12, default: off)
332 Force check and rebuild procedure of the UUID tree. This should not
336 (since: 3.3, default: off)
338 Skip automatic resume of an interrupted balance operation. The operation can
339 later be resumed with *btrfs balance resume*, or the paused state can be
340 removed with *btrfs balance cancel*. The default behaviour is to resume an
341 interrupted balance immediately after a volume is mounted.
344 *space_cache='version'*::
346 ('nospace_cache' since: 3.2, 'space_cache=v1' and 'space_cache=v2' since 4.5, default: 'space_cache=v1')
348 Options to control the free space cache. The free space cache greatly improves
349 performance when reading block group free space into memory. However, managing
350 the space cache consumes some resources, including a small amount of disk
353 There are two implementations of the free space cache. The original
354 one, referred to as 'v1', is the safe default. The 'v1' space cache can be
355 disabled at mount time with 'nospace_cache' without clearing.
357 On very large filesystems (many terabytes) and certain workloads, the
358 performance of the 'v1' space cache may degrade drastically. The 'v2'
359 implementation, which adds a new B-tree called the free space tree, addresses
360 this issue. Once enabled, the 'v2' space cache will always be used and cannot
361 be disabled unless it is cleared. Use 'clear_cache,space_cache=v1' or
362 'clear_cache,nospace_cache' to do so. If 'v2' is enabled, kernels without 'v2'
363 support will only be able to mount the filesystem in read-only mode. The
364 `btrfs`(8) command currently only has read-only support for 'v2'. A read-write
365 command may be run on a 'v2' filesystem by clearing the cache, running the
366 command, and then remounting with 'space_cache=v2'.
368 If a version is not explicitly specified, the default implementation will be
369 chosen, which is 'v1'.
374 (default: SSD autodetected)
376 Options to control SSD allocation schemes. By default, BTRFS will
377 enable or disable SSD optimizations depending on status of a device with
378 respect to rotational or non-rotational type. This is determined by the
379 contents of '/sys/block/DEV/queue/rotational'). If it is 1, the 'ssd' option is
380 turned on. The option 'nossd' will disable the autodetection.
382 The optimizations make use of the absence of the seek penalty that's inherent
383 for the rotational devices. The blocks can be typically written faster and
384 are not offloaded to separate threads.
386 NOTE: Since 4.14, the block layout optimizations have been dropped. This used
387 to help with first generations of SSD devices. Their FTL (flash translation
388 layer) was not effective and the optimization was supposed to improve the wear
389 by better aligning blocks. This is no longer true with modern SSD devices and
390 the optimization had no real benefit. Furthermore it caused increased
391 fragmentation. The layout tuning has been kept intact for the option
394 The 'ssd_spread' mount option attempts to allocate into bigger and aligned
395 chunks of unused space, and may perform better on low-end SSDs. 'ssd_spread'
396 implies 'ssd', enabling all other SSD heuristics as well. The option 'nossd'
397 will disable all SSD options.
400 Mount subvolume from 'path' rather than the toplevel subvolume. The
401 'path' is always treated as relative to the the toplevel subvolume.
402 This mount option overrides the default subvolume set for the given filesystem.
404 *subvolid='subvolid'*::
405 Mount subvolume specified by a 'subvolid' number rather than the toplevel
406 subvolume. You can use *btrfs subvolume list* of *btrfs subvolume show* to see
407 subvolume ID numbers.
408 This mount option overrides the default subvolume set for the given filesystem.
410 NOTE: if both 'subvolid' and 'subvol' are specified, they must point at the
411 same subvolume, otherwise the mount will fail.
413 *thread_pool='number'*::
414 (default: min(NRCPUS + 2, 8) )
416 The number of worker threads to start. NRCPUS is number of on-line CPUs
417 detected at the time of mount. Small number leads to less parallelism in
418 processing data and metadata, higher numbers could lead to a performance hit
419 due to increased locking contention, process scheduling, cache-line bouncing or
420 costly data transfers between local CPU memories.
426 Enable the tree logging used for 'fsync' and 'O_SYNC' writes. The tree log
427 stores changes without the need of a full filesystem sync. The log operations
428 are flushed at sync and transaction commit. If the system crashes between two
429 such syncs, the pending tree log operations are replayed during mount.
431 WARNING: currently, the tree log is replayed even with a read-only mount! To
432 disable that behaviour, also mount with 'nologreplay'.
434 The tree log could contain new files/directories, these would not exist on
435 a mounted filesystem if the log is not replayed.
439 (since: 4.6, default: off)
441 Enable autorecovery attempts if a bad tree root is found at mount time.
442 Currently this scans a backup list of several previous tree roots and tries to
443 use the first readable. This can be used with read-only mounts as well.
445 NOTE: This option has replaced 'recovery'.
447 *user_subvol_rm_allowed*::
450 Allow subvolumes to be deleted by their respective owner. Otherwise, only the
451 root user can do that.
453 NOTE: historically, any user could create a snapshot even if he was not owner
454 of the source subvolume, the subvolume deletion has been restricted for that
455 reason. The subvolume creation has been restricted but this mount option is
456 still required. This is a usability issue and will be addressed in the future.
458 DEPRECATED MOUNT OPTIONS
459 ~~~~~~~~~~~~~~~~~~~~~~~~
461 List of mount options that have been removed, kept for backward compatibility.
463 *alloc_start='bytes'*::
464 (default: 1M, minimum: 1M, deprecated since: 4.13)
466 Debugging option to force all block allocations above a certain
467 byte threshold on each block device. The value is specified in
468 bytes, optionally with a K, M, or G suffix (case insensitive).
471 (since: 3.2, default: off, deprecated since: 4.5)
473 NOTE: this option has been replaced by 'usebackuproot' and should not be used
474 but will work on 4.5+ kernels.
476 *subvolrootid='objectid'*::
477 (irrelevant since: 3.2, formally deprecated since: 3.10)
479 A workaround option from times (pre 3.2) when it was not possible to mount a
480 subvolume that did not reside directly under the toplevel subvolume.
486 The basic set of filesystem features gets extended over time. The backward
487 compatibility is maintained and the features are optional, need to be
488 explicitly asked for so accidental use will not create incompatibilities.
490 There are several classes and the respective tools to manage the features:
493 This is namely for core structures, like the b-tree nodesize, see
494 `mkfs.btrfs`(8) for more details.
496 after mkfs, on an unmounted filesystem::
497 Features that may optimize internal structures or add new structures to support
498 new functionality, see `btrfstune`(8). The command *btrfs inspect-internal
499 dump-super device* will dump a superblock, you can map the value of
500 'incompat_flags' to the features listed below
502 after mkfs, on a mounted filesystem::
503 The features of a filesystem (with a given UUID) are listed in
504 `/sys/fs/btrfs/UUID/features/`, one file per feature. The status is stored
505 inside the file. The value '1' is for enabled and active, while '0' means the
506 feature was enabled at mount time but turned off afterwards.
508 Whether a particular feature can be turned on a mounted filesystem can be found
509 in the directory `/sys/fs/btrfs/features/`, one file per feature. The value '1'
510 means the feature can be enabled.
512 List of features (see also `mkfs.btrfs`(8) section 'FILESYSTEM FEATURES'):
517 the filesystem uses 'nodesize' for metadata blocks, this can be bigger than the
523 the 'lzo' compression has been used on the filesystem, either as a mount option
524 or via *btrfs filesystem defrag*.
529 the 'zstd' compression has been used on the filesystem, either as a mount option
530 or via *btrfs filesystem defrag*.
535 the default subvolume has been set on the filesystem
540 increased hardlink limit per file in a directory to 65536, older kernels
541 supported a varying number of hardlinks depending on the sum of all file name
542 sizes that can be stored into one metadata block
547 the last major disk format change, improved backreferences, now default
552 mixed data and metadata block groups, ie. the data and metadata are not
553 separated and occupy the same block groups, this mode is suitable for small
554 volumes as there are no constraints how the remaining space should be used
555 (compared to the split mode, where empty metadata space cannot be used for data
558 on the other hand, the final layout is quite unpredictable and possibly highly
559 fragmented, which means worse performance
564 improved representation of file extents where holes are not explicitly
565 stored as an extent, saves a few percent of metadata if sparse files are used
570 the filesystem contains or contained a raid56 profile of block groups
575 reduced-size metadata for extent references, saves a few percent of metadata
579 The btrfs filesystem supports setting the following file attributes using the
583 'append only', new writes are always written at the end of the file
589 'compress data', all data written after this attribute is set will be compressed.
590 Please note that compression is also affected by the mount options or the parent
591 directory attributes.
593 When set on a directory, all newly created files will inherit this attribute.
596 'no copy-on-write', file modifications are done in-place
598 When set on a directory, all newly created files will inherit this attribute.
600 NOTE: due to implementation limitations, this flag can be set/unset only on
604 'no dump', makes sense with 3rd party tools like `dump`(8), on BTRFS the
605 attribute can be set/unset but no other special handling is done
608 'synchronous directory updates', for more details search `open`(2) for 'O_SYNC'
612 'immutable', no file data and metadata changes allowed even to the root user as
613 long as this attribute is set (obviously the exception is unsetting the attribute)
616 'synchronous updates', for more details search `open`(2) for 'O_SYNC' and
620 'no compression', permanently turn off compression on the given file, other
621 compression mount options will not affect that
623 When set on a directory, all newly created files will inherit this attribute.
625 No other attributes are supported. For the complete list please refer to the
626 `chattr`(1) manual page.
631 There's a character special device `/dev/btrfs-control` with major and minor
632 numbers 10 and 234 (the device can be found under the 'misc' category).
635 $ ls -l /dev/btrfs-control
636 crw------- 1 root root 10, 234 Jan 1 12:00 /dev/btrfs-control
639 The device accepts some ioctl calls that can perform following actions on the
642 * scan devices for btrfs filesystem (ie. to let multi-device filesystems mount
643 automatically) and register them with the kernel module
644 * similar to scan, but also wait until the device scanning process is finished
645 for a given filesystem
646 * get the supported features (can be also found under '/sys/fs/btrfs/features')
648 The device is usually created by a system device node manager (eg. udev), but
649 can be created manually:
652 # mknod --mode=600 c 10 234 /dev/btrfs-control
655 The control device is not strictly required but the device scanning will not
656 work and a workaround would need to be used to mount a multi-device filesystem.
657 The mount option 'device' can trigger the device scanning during mount.