{"id":4566,"date":"2022-12-20T18:09:05","date_gmt":"2022-12-20T21:09:05","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/btrfsman5-man5\/"},"modified":"2022-12-20T18:09:05","modified_gmt":"2022-12-20T21:09:05","slug":"btrfsman5-man5","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/btrfsman5-man5\/","title":{"rendered":"BTRFS&minus;MAN5 (man5)"},"content":{"rendered":"<h1 align=\"center\">BTRFS\u2212MAN5<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#MOUNT OPTIONS\">MOUNT OPTIONS<\/a><br \/> <a href=\"#FILESYSTEM FEATURES\">FILESYSTEM FEATURES<\/a><br \/> <a href=\"#CHECKSUM ALGORITHMS\">CHECKSUM ALGORITHMS<\/a><br \/> <a href=\"#COMPRESSION\">COMPRESSION<\/a><br \/> <a href=\"#FILESYSTEM EXCLUSIVE OPERATIONS\">FILESYSTEM EXCLUSIVE OPERATIONS<\/a><br \/> <a href=\"#FILESYSTEM LIMITS\">FILESYSTEM LIMITS<\/a><br \/> <a href=\"#BOOTLOADER SUPPORT\">BOOTLOADER SUPPORT<\/a><br \/> <a href=\"#FILE ATTRIBUTES\">FILE ATTRIBUTES<\/a><br \/> <a href=\"#ZONED MODE\">ZONED MODE<\/a><br \/> <a href=\"#CONTROL DEVICE\">CONTROL DEVICE<\/a><br \/> <a href=\"#FILESYSTEM WITH MULTIPLE PROFILES\">FILESYSTEM WITH MULTIPLE PROFILES<\/a><br \/> <a href=\"#SEEDING DEVICE\">SEEDING DEVICE<\/a><br \/> <a href=\"#RAID56 STATUS AND RECOMMENDED PRACTICES\">RAID56 STATUS AND RECOMMENDED PRACTICES<\/a><br \/> <a href=\"#STORAGE MODEL\">STORAGE MODEL<\/a><br \/> <a href=\"#HARDWARE CONSIDERATIONS\">HARDWARE CONSIDERATIONS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">btrfs-man5 \u2212 topics about the BTRFS filesystem (mount options, supported file attributes and other)<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This document describes topics related to BTRFS that are not specific to the tools. Currently covers:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">1. mount options<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">2. filesystem features<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">3. checksum algorithms<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">4. compression<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">5. filesystem exclusive operations<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">6. filesystem limits<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">7. bootloader support<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">8. file attributes<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">9. zoned mode<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">10. control device<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">11. filesystems with multiple block group profiles<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">12. seeding device<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">13. raid56 status and recommended practices<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">14. storage model<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">15. hardware considerations<\/p>\n<h2>MOUNT OPTIONS <a name=\"MOUNT OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This section describes mount options specific to BTRFS. For the generic mount options please refer to <b>mount<\/b>(8) manpage. The options are sorted alphabetically (discarding the <i>no<\/i> prefix).<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><b><big>Note<\/big><\/b> <br \/> most mount options apply to the whole filesystem and only options in the first mounted subvolume will take effect. This is due to lack of implementation and may change in the future. This means that (for example) you can\u2019t set per\u2212subvolume <i>nodatacow<\/i>, <i>nodatasum<\/i>, or <i>compress<\/i> using mount options. This should eventually be fixed, but it has proved to be difficult to implement correctly within the Linux VFS framework.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Mount options are processed in order, only the last occurrence of an option takes effect and may disable other options due to constraints (see eg. <i>nodatacow<\/i> and <i>compress<\/i>). The output of <i>mount<\/i> command shows which options have been applied.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b><big>acl<\/big><\/b><big>, <b>noacl<\/b><\/big><\/p>\n<p style=\"margin-left:17%;\"><big>(default: on)<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>Enable\/disable support for Posix Access Control Lists (ACLs). See the <b>acl<\/b>(5) manual page for more information about ACLs.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>The support for ACL is build\u2212time configurable (BTRFS_FS_POSIX_ACL) and mount fails if <i>acl<\/i> is requested but the feature is not compiled in.<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b>autodefrag<\/b>, <b>noautodefrag<\/b><\/big><\/p>\n<p style=\"margin-left:17%;\"><big>(since: 3.0, default: off)<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>Enable automatic file defragmentation. When enabled, small random writes into files (in a range of tens of kilobytes, currently it\u2019s 64K) are detected and queued up for the defragmentation process. Not well suited for large database workloads.<\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big>The read latency may increase due to reading the adjacent blocks that make up the range for defragmentation, successive write will merge the blocks in the new location.<\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><b><big>Warning<\/big><\/b> <br \/> Defragmenting with Linux kernel versions < 3.9 or \u2265 3.14\u2212rc2 as well as with Linux stable kernel versions \u2265 3.10.31, \u2265 3.12.12 or \u2265 3.13.4 will break up the reflinks of COW data (for example files copied with <b>cp \u2212\u2212reflink<\/b>, snapshots or de\u2212duplicated data). This may cause considerable increase of space usage depending on the broken up reflinks.<\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><b><big>barrier<\/big><\/b><big>, <b>nobarrier<\/b><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big>(default: on)<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>Ensure that all IO write operations make it through the device cache and are stored permanently when the filesystem is at its consistency checkpoint. This typically means that a flush command is sent to the device that will synchronize all pending data and ordinary metadata blocks, then writes the superblock and issues another flush.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>The write flushes incur a slight hit and also prevent the IO block scheduler to reorder requests in a more effective way. Disabling barriers gets rid of that penalty but will most certainly lead to a corrupted filesystem in case of a crash or power loss. The ordinary metadata blocks could be yet unwritten at the time the new superblock is stored permanently, expecting that the block pointers to metadata were stored permanently before.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>On a device with a volatile battery\u2212backed write\u2212back cache, the <i>nobarrier<\/i> option will not lead to filesystem corruption as the pending blocks are supposed to make it to the permanent storage.<\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><b>check_int<\/b>, <b>check_int_data<\/b>, <b>check_int_print_mask=<\/b><i>value<\/i><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big>(since: 3.0, default: off)<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>These debugging options control the behavior of the integrity checking module (the BTRFS_FS_CHECK_INTEGRITY config option required). The main goal is to verify that all blocks from a given transaction period are properly linked.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><i>check_int<\/i> enables the integrity checker module, which examines all block write requests to ensure on\u2212disk consistency, at a large memory and CPU cost.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><i>check_int_data<\/i> includes extent data in the integrity checks, and implies the <i>check_int<\/i> option.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><i>check_int_print_mask<\/i> takes a bitmask of BTRFSIC_PRINT_MASK_* values as defined in <i>fs\/btrfs\/check\u2212integrity.c<\/i>, to control the integrity checker module behavior.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>See comments at the top of <i>fs\/btrfs\/check\u2212integrity.c<\/i> for more information.<\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><b>clear_cache<\/b><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big>Force clearing and rebuilding of the disk space cache if something has gone wrong. See also: <i>space_cache<\/i>.<\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><b>commit=<\/b><i>seconds<\/i><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big>(since: 3.12, default: 30)<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>Set the interval of periodic transaction commit when data are synchronized to permanent storage. Higher interval values lead to larger amount of unwritten data, which has obvious consequences when the system crashes. The upper bound is not forced, but a warning is printed if it\u2019s more than 300 seconds (5 minutes). Use with care.<\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><b>compress<\/b>, <b>compress=<\/b><i>type[:level]<\/i>, <b>compress\u2212force<\/b>, <b>compress\u2212force=<\/b><i>type[:level]<\/i><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big>(default: off, level support since: 5.1)<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>Control BTRFS file data compression. Type may be specified as <i>zlib<\/i>, <i>lzo<\/i>, <i>zstd<\/i> or <i>no<\/i> (for no compression, used for remounting). If no type is specified, <i>zlib<\/i> is used. If <i>compress\u2212force<\/i> is specified, then compression will always be attempted, but the data may end up uncompressed if the compression would make them larger.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>Both <i>zlib<\/i> and <i>zstd<\/i> (since version 5.1) expose the compression level as a tunable knob with higher levels trading speed and memory (<i>zstd<\/i>) for higher compression ratios. This can be set by appending a colon and the desired level. Zlib accepts the range [1, 9] and zstd accepts [1, 15]. If no level is set, both currently use a default level of 3. The value 0 is an alias for the default level.<\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big>Otherwise some simple heuristics are applied to detect an incompressible file. If the first blocks written to a file are not compressible, the whole file is permanently marked to skip compression. As this is too simple, the <i>compress\u2212force<\/i> is a workaround that will compress most of the files at the cost of some wasted CPU cycles on failed attempts. Since kernel 4.15, a set of heuristic algorithms have been improved by using frequency sampling, repeated pattern detection and Shannon entropy calculation to avoid that.<\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><b><big>Note<\/big><\/b> <br \/> If compression is enabled, <i>nodatacow<\/i> and <i>nodatasum<\/i> are disabled.<\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><b><big>datacow<\/big><\/b><big>, <b>nodatacow<\/b><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big>(default: on)<\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big>Enable data copy\u2212on\u2212write for newly created files. <i>Nodatacow<\/i> implies <i>nodatasum<\/i>, and disables <i>compression<\/i>. All files created under <i>nodatacow<\/i> are also set the NOCOW file attribute (see <b>chattr<\/b>(1)).<\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><b><big>Note<\/big><\/b> <br \/> If <i>nodatacow<\/i> or <i>nodatasum<\/i> are enabled, compression is disabled.<\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big>Updates in\u2212place improve performance for workloads that do frequent overwrites, at the cost of potential partial writes, in case the write is interrupted (system crash, device failure).<\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><b><big>datasum<\/big><\/b><big>, <b>nodatasum<\/b><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big>(default: on)<\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big>Enable data checksumming for newly created files. <i>Datasum<\/i> implies <i>datacow<\/i>, ie. the normal mode of operation. All files created under <i>nodatasum<\/i> inherit the &#8220;no checksums&#8221; property, however there\u2019s no corresponding file attribute (see <b>chattr<\/b>(1)).<\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><b><big>Note<\/big><\/b> <br \/> If <i>nodatacow<\/i> or <i>nodatasum<\/i> are enabled, compression is disabled.<\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big>There is a slight performance gain when checksums are turned off, the corresponding metadata blocks holding the checksums do not need to updated. The cost of checksumming of the blocks in memory is much lower than the IO, modern CPUs feature hardware support of the checksumming algorithm.<\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><b><big>degraded<\/big><\/b><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big>(default: off)<\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big>Allow mounts with less devices than the RAID profile constraints require. A read\u2212write mount (or remount) may fail when there are too many devices missing, for example if a stripe member is completely missing from RAID0.<\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big>Since 4.14, the constraint checks have been improved and are verified on the chunk level, not an the device level. This allows degraded mounts of filesystems with mixed RAID profiles for data and metadata, even if the device number constraints would not be satisfied for some of the profiles.<\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big>Example: metadata \u2014 raid1, data \u2014 single, devices \u2014 \/dev\/sda, \/dev\/sdb<\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big>Suppose the data are completely stored on <i>sda<\/i>, then missing <i>sdb<\/i> will not prevent the mount, even if 1 missing device would normally prevent (any) <i>single<\/i> profile to mount. In case some of the data chunks are stored on <i>sdb<\/i>, then the constraint of single\/data is not satisfied and the filesystem cannot be mounted.<\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><b>device=<\/b><i>devicepath<\/i><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big>Specify a path to a device that will be scanned for BTRFS filesystem during mount. This is usually done automatically by a device manager (like udev) or using the <b>btrfs device scan<\/b> command (eg. run from the initial ramdisk). In cases where this is not possible the <i>device<\/i> mount option can help.<\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> booting eg. a RAID1 system may fail even if all filesystem\u2019s <i>device<\/i> paths are provided as the actual device nodes may not be discovered by the system at that point.<\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><b><big>discard<\/big><\/b><big>, <b>discard=sync<\/b>, <b>discard=async<\/b>, <b>nodiscard<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big>(default: off, async support since: 5.6)<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>Enable discarding of freed file blocks. This is useful for SSD devices, thinly provisioned LUNs, or virtual machine images; however, every storage layer must support discard for it to work.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>In the synchronous mode (<i>sync<\/i> or without option value), lack of asynchronous queued TRIM on the backing device TRIM can severely degrade performance, because a synchronous TRIM operation will be attempted instead. Queued TRIM requires newer than SATA revision 3.1 chipsets and devices.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>The asynchronous mode (<i>async<\/i>) gathers extents in larger chunks before sending them to the devices for TRIM. The overhead and performance impact should be negligible compared to the previous mode and it\u2019s supposed to be the preferred mode if needed.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>If it is not necessary to immediately discard freed blocks, then the <b>fstrim<\/b> tool can be used to discard all free blocks in a batch. Scheduling a TRIM during a period of low system activity will prevent latent interference with the performance of other operations. Also, a device may ignore the TRIM command if the range is too small, so running a batch discard has a greater probability of actually discarding the blocks.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><b>enospc_debug<\/b>, <b>noenospc_debug<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big>(default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>Enable verbose output for some ENOSPC conditions. It\u2019s safe to use but can be noisy if the system reaches near\u2212full state.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><b>fatal_errors=<\/b><i>action<\/i><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big>(since: 3.4, default: bug)<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>Action to take when encountering a fatal error.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><b>bug<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%;\"><big><big><big><big><big><big><i>BUG()<\/i> on a fatal error, the system will stay in the crashed state and may be still partially usable, but reboot is required for full operation<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><b>panic<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%;\"><big><big><big><big><big><big><i>panic()<\/i> on a fatal error, depending on other system configuration, this may be followed by a reboot. Please refer to the documentation of kernel boot parameters, eg. <i>panic<\/i>, <i>oops<\/i> or <i>crashkernel<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><b>flushoncommit<\/b>, <b>noflushoncommit<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big>(default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>This option forces any data dirtied by a write in a prior transaction to commit as part of the current commit, effectively a full filesystem sync.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>This makes the committed state a fully consistent view of the file system from the application\u2019s perspective (i.e. it includes all completed file system operations). This was previously the behavior only when a snapshot was created.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>When off, the filesystem is consistent but buffered writes may last more than one transaction commit.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><b>fragment=<\/b><i>type<\/i><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big>(depends on compile\u2212time option BTRFS_DEBUG, since: 4.4, default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>A debugging helper to intentionally fragment given <i>type<\/i> of block groups. The type can be <i>data<\/i>, <i>metadata<\/i> or <i>all<\/i>. This mount option should not be used outside of debugging environments and is not recognized if the kernel config option <i>BTRFS_DEBUG<\/i> is not enabled.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><b>nologreplay<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big>(default: off, even read\u2212only)<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big>The tree\u2212log contains pending updates to the filesystem until the full commit. The log is replayed on next mount, this can be disabled by this option. See also <i>treelog<\/i>. Note that <i>nologreplay<\/i> is the same as <i>norecovery<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><b><big>Warning<\/big><\/b> <br \/> currently, the tree log is replayed even with a read\u2212only mount! To disable that behaviour, mount also with <i>nologreplay<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><b><big>max_inline=<\/big><\/b><big><i>bytes<\/i><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big>(default: min(2048, page size) )<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big>Specify the maximum amount of space, that can be inlined in a metadata B\u2212tree leaf. The value is specified in bytes, optionally with a K suffix (case insensitive). In practice, this value is limited by the filesystem block size (named <i>sectorsize<\/i> at mkfs time), and memory page size of the system. In case of sectorsize limit, there\u2019s some space unavailable due to leaf headers. For example, a 4k sectorsize, maximum size of inline data is about 3900 bytes.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big>Inlining can be completely turned off by specifying 0. This will increase data block slack if file sizes are much smaller than block size but will reduce metadata consumption in return.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> the default value has changed to 2048 in kernel 4.6.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><b><big>metadata_ratio=<\/big><\/b><big><i>value<\/i><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big>(default: 0, internal logic)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big>Specifies that 1 metadata chunk should be allocated after every <i>value<\/i> data chunks. Default behaviour depends on internal logic, some percent of unused metadata space is attempted to be maintained but is not always possible if there\u2019s not enough space left for chunk allocation. The option could be useful to override the internal logic in favor of the metadata allocation if the expected workload is supposed to be metadata intense (snapshots, reflinks, xattrs, inlined files).<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><b>norecovery<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big>(since: 4.5, default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big>Do not attempt any data recovery at mount time. This will disable <i>logreplay<\/i> and avoids other write operations. Note that this option is the same as <i>nologreplay<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> The opposite option <i>recovery<\/i> used to have different meaning but was changed for consistency with other filesystems, where <i>norecovery<\/i> is used for skipping log replay. BTRFS does the same and in general will try to avoid any write operations.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><b><big>rescan_uuid_tree<\/big><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big>(since: 3.12, default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>Force check and rebuild procedure of the UUID tree. This should not normally be needed.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><b>rescue<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big>(since: 5.9)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>Modes allowing mount with damaged filesystem structures.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>\u2022 <i>usebackuproot<\/i> (since: 5.9, replaces standalone option <i>usebackuproot<\/i>)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>\u2022 <i>nologreplay<\/i> (since: 5.9, replaces standalone option <i>nologreplay<\/i>)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>\u2022 <i>ignorebadroots<\/i>, <i>ibadroots<\/i> (since: 5.11)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>\u2022 <i>ignoredatacsums<\/i>, <i>idatacsums<\/i> (since: 5.11)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>\u2022 <i>all<\/i> (since: 5.9)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><b>skip_balance<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big>(since: 3.3, default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>Skip automatic resume of an interrupted balance operation. The operation can later be resumed with <b>btrfs balance resume<\/b>, or the paused state can be removed with <b>btrfs balance cancel<\/b>. The default behaviour is to resume an interrupted balance immediately after a volume is mounted.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><b>space_cache<\/b>, <b>space_cache=<\/b><i>version<\/i>, <b>nospace_cache<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big>(<i>nospace_cache<\/i> since: 3.2, <i>space_cache=v1<\/i> and <i>space_cache=v2<\/i> since 4.5, default: <i>space_cache=v1<\/i>)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>Options to control the free space cache. The free space cache greatly improves performance when reading block group free space into memory. However, managing the space cache consumes some resources, including a small amount of disk space.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>There are two implementations of the free space cache. The original one, referred to as <i>v1<\/i>, is the safe default. The <i>v1<\/i> space cache can be disabled at mount time with <i>nospace_cache<\/i> without clearing.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>On very large filesystems (many terabytes) and certain workloads, the performance of the <i>v1<\/i> space cache may degrade drastically. The <i>v2<\/i> implementation, which adds a new B\u2212tree called the free space tree, addresses this issue. Once enabled, the <i>v2<\/i> space cache will always be used and cannot be disabled unless it is cleared. Use <i>clear_cache,space_cache=v1<\/i> or <i>clear_cache,nospace_cache<\/i> to do so. If <i>v2<\/i> is enabled, kernels without <i>v2<\/i> support will only be able to mount the filesystem in read\u2212only mode.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>The <b>btrfs\u2212check<\/b>(8) and <b>mkfs.btrfs<\/b>(8) commands have full <i>v2<\/i> free space cache support since v4.19.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>If a version is not explicitly specified, the default implementation will be chosen, which is <i>v1<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><b>ssd<\/b>, <b>ssd_spread<\/b>, <b>nossd<\/b>, <b>nossd_spread<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big>(default: SSD autodetected)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>Options to control SSD allocation schemes. By default, BTRFS will enable or disable SSD optimizations depending on status of a device with respect to rotational or non\u2212rotational type. This is determined by the contents of <i>\/sys\/block\/DEV\/queue\/rotational<\/i>). If it is 0, the <i>ssd<\/i> option is turned on. The option <i>nossd<\/i> will disable the autodetection.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big>The optimizations make use of the absence of the seek penalty that\u2019s inherent for the rotational devices. The blocks can be typically written faster and are not offloaded to separate threads.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> Since 4.14, the block layout optimizations have been dropped. This used to help with first generations of SSD devices. Their FTL (flash translation layer) was not effective and the optimization was supposed to improve the wear by better aligning blocks. This is no longer true with modern SSD devices and the optimization had no real benefit. Furthermore it caused increased fragmentation. The layout tuning has been kept intact for the option <i>ssd_spread<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big>The <i>ssd_spread<\/i> mount option attempts to allocate into bigger and aligned chunks of unused space, and may perform better on low\u2212end SSDs. <i>ssd_spread<\/i> implies <i>ssd<\/i>, enabling all other SSD heuristics as well. The option <i>nossd<\/i> will disable all SSD options while <i>nossd_spread<\/i> only disables <i>ssd_spread<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><b><big>subvol=<\/big><\/b><big><i>path<\/i><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big>Mount subvolume from <i>path<\/i> rather than the toplevel subvolume. The <i>path<\/i> is always treated as relative to the toplevel subvolume. This mount option overrides the default subvolume set for the given filesystem.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><b>subvolid=<\/b><i>subvolid<\/i><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big>Mount subvolume specified by a <i>subvolid<\/i> number rather than the toplevel subvolume. You can use <b>btrfs subvolume list<\/b> of <b>btrfs subvolume show<\/b> to see subvolume ID numbers. This mount option overrides the default subvolume set for the given filesystem.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> if both <i>subvolid<\/i> and <i>subvol<\/i> are specified, they must point at the same subvolume, otherwise the mount will fail.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><b><big>thread_pool=<\/big><\/b><big><i>number<\/i><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big>(default: min(NRCPUS + 2, 8) )<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big>The number of worker threads to start. NRCPUS is number of on\u2212line CPUs detected at the time of mount. Small number leads to less parallelism in processing data and metadata, higher numbers could lead to a performance hit due to increased locking contention, process scheduling, cache\u2212line bouncing or costly data transfers between local CPU memories.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><b>treelog<\/b>, <b>notreelog<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big>(default: on)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big>Enable the tree logging used for <i>fsync<\/i> and <i>O_SYNC<\/i> writes. The tree log stores changes without the need of a full filesystem sync. The log operations are flushed at sync and transaction commit. If the system crashes between two such syncs, the pending tree log operations are replayed during mount.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><b><big>Warning<\/big><\/b> <br \/> currently, the tree log is replayed even with a read\u2212only mount! To disable that behaviour, also mount with <i>nologreplay<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big>The tree log could contain new files\/directories, these would not exist on a mounted filesystem if the log is not replayed.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><b><big>usebackuproot<\/big><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big>(since: 4.6, default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big>Enable autorecovery attempts if a bad tree root is found at mount time. Currently this scans a backup list of several previous tree roots and tries to use the first readable. This can be used with read\u2212only mounts as well.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> This option has replaced <i>recovery<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><b><big>user_subvol_rm_allowed<\/big><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big>(default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big>Allow subvolumes to be deleted by their respective owner. Otherwise, only the root user can do that.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> historically, any user could create a snapshot even if he was not owner of the source subvolume, the subvolume deletion has been restricted for that reason. The subvolume creation has been restricted but this mount option is still required. This is a usability issue. Since 4.18, the <b>rmdir<\/b>(2) syscall can delete an empty subvolume just like an ordinary directory. Whether this is possible can be detected at runtime, see <i>rmdir_subvol<\/i> feature in <i>FILESYSTEM FEATURES<\/i>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><b><big>DEPRECATED MOUNT OPTIONS<\/big><\/b> <big><br \/> List of mount options that have been removed, kept for backward compatibility.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><b>recovery<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big>(since: 3.2, default: off, deprecated since: 4.5)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> this option has been replaced by <i>usebackuproot<\/i> and should not be used but will work on 4.5+ kernels.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><b><big>inode_cache<\/big><\/b><big>, <b>noinode_cache<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big>(removed in: 5.11, since: 3.0, default: off)<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><b><big>Note<\/big><\/b> <br \/> the functionality has been removed in 5.11, any stale data created by previous use of the <i>inode_cache<\/i> option can be removed by <b>btrfs check \u2212\u2212clear\u2212ino\u2212cache<\/b>.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><b><big>NOTES ON GENERIC MOUNT OPTIONS<\/big><\/b> <big><br \/> Some of the general mount options from <b>mount<\/b>(8) that affect BTRFS and are worth mentioning.<\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><b>noatime<\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big>under read intensive work\u2212loads, specifying <i>noatime<\/i> significantly improves performance because no new access time information needs to be written. Without this option, the default is <i>relatime<\/i>, which only reduces the number of inode atime updates in comparison to the traditional <i>strictatime<\/i>. The worst case for atime updates under <i>relatime<\/i> occurs when many files are read whose atime is older than 24 h and which are freshly snapshotted. In that case the atime is updated <i>and<\/i> COW happens \u2212 for each file \u2212 in bulk. See also <b><font color=\"#0000FF\">https:\/\/lwn.net\/Articles\/499293\/<\/font><\/b> <font color=\"#000000\">\u2212 <i>Atime and btrfs: a bad combination? (LWN, 2012\u221205\u221231)<\/i>.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Note that <i>noatime<\/i> may break applications that rely on atime uptimes like the venerable Mutt (unless you use maildir mailboxes).<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>FILESYSTEM FEATURES <a name=\"FILESYSTEM FEATURES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The basic set of filesystem features gets extended over time. The backward compatibility is maintained and the features are optional, need to be explicitly asked for so accidental use will not create incompatibilities.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are several classes and the respective tools to manage the features:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">at mkfs time only<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">This is namely for core structures, like the b\u2212tree nodesize or checksum algorithm, see <b>mkfs.btrfs<\/b>(8) for more details.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">after mkfs, on an unmounted filesystem<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Features that may optimize internal structures or add new structures to support new functionality, see <b>btrfstune<\/b>(8). The command <b>btrfs inspect\u2212internal dump\u2212super device<\/b> will dump a superblock, you can map the value of <i>incompat_flags<\/i> to the features listed below<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">after mkfs, on a mounted filesystem<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The features of a filesystem (with a given UUID) are listed in <b>\/sys\/fs\/btrfs\/UUID\/features\/<\/b>, one file per feature. The status is stored inside the file. The value <i>1<\/i> is for enabled and active, while <i>0<\/i> means the feature was enabled at mount time but turned off afterwards.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Whether a particular feature can be turned on a mounted filesystem can be found in the directory <b>\/sys\/fs\/btrfs\/features\/<\/b>, one file per feature. The value <i>1<\/i> means the feature can be enabled.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">List of features (see also <b>mkfs.btrfs<\/b>(8) section <i>FILESYSTEM FEATURES<\/i>):<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>big_metadata<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 3.4)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the filesystem uses <i>nodesize<\/i> for metadata blocks, this can be bigger than the page size<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>compress_lzo<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 2.6.38)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the <i>lzo<\/i> compression has been used on the filesystem, either as a mount option or via <b>btrfs filesystem defrag<\/b>.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>compress_zstd<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 4.14)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the <i>zstd<\/i> compression has been used on the filesystem, either as a mount option or via <b>btrfs filesystem defrag<\/b>.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>default_subvol<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 2.6.34)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the default subvolume has been set on the filesystem<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>extended_iref<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 3.7)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">increased hardlink limit per file in a directory to 65536, older kernels supported a varying number of hardlinks depending on the sum of all file name sizes that can be stored into one metadata block<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>free_space_tree<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 4.5)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">free space representation using a dedicated b\u2212tree, successor of v1 space cache<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>metadata_uuid<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 5.0)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the main filesystem UUID is the metadata_uuid, which stores the new UUID only in the superblock while all metadata blocks still have the UUID set at mkfs time, see <b>btrfstune<\/b>(8) for more<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>mixed_backref<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 2.6.31)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the last major disk format change, improved backreferences, now default<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>mixed_groups<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 2.6.37)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">mixed data and metadata block groups, ie. the data and metadata are not separated and occupy the same block groups, this mode is suitable for small volumes as there are no constraints how the remaining space should be used (compared to the split mode, where empty metadata space cannot be used for data and vice versa)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">on the other hand, the final layout is quite unpredictable and possibly highly fragmented, which means worse performance<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>no_holes<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 3.14)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">improved representation of file extents where holes are not explicitly stored as an extent, saves a few percent of metadata if sparse files are used<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>raid1c34<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 5.5)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">extended RAID1 mode with copies on 3 or 4 devices respectively<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>raid56<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 3.9)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the filesystem contains or contained a raid56 profile of block groups<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>rmdir_subvol<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 4.18)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">indicate that <b>rmdir<\/b>(2) syscall can delete an empty subvolume just like an ordinary directory. Note that this feature only depends on the kernel version.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>skinny_metadata<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 3.10)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">reduced\u2212size metadata for extent references, saves a few percent of metadata<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>send_stream_version<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 5.10)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">number of the highest supported send stream version<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>supported_checksums<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 5.5)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">list of checksum algorithms supported by the kernel module, the respective modules or built\u2212in implementing the algorithms need to be present to mount the filesystem, see <i>CHECKSUM ALGORITHMS<\/i><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>supported_sectorsizes<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 5.13)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">list of values that are accepted as sector sizes (<b>mkfs.btrfs \u2212\u2212sectorsize<\/b>) by the running kernel<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>supported_rescue_options<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 5.11)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">list of values for the mount option <i>rescue<\/i> that are supported by the running kernel, see <b>btrfs<\/b>(5)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>zoned<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">(since: 5.12)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">zoned mode is allocation\/write friendly to host\u2212managed zoned devices, allocation space is partitioned into fixed\u2212size zones that must be updated sequentially, see <i>ZONED MODE<\/i><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>SWAPFILE SUPPORT<\/b> <br \/> The swapfile is supported since kernel 5.0. Use <b>swapon<\/b>(8) to activate the swapfile. There are some limitations of the implementation in btrfs and linux swap subsystem:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 filesystem \u2212 must be only single device<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 filesystem \u2212 must have only <i>single<\/i> data profile<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 swapfile \u2212 the containing subvolume cannot be snapshotted<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 swapfile \u2212 must be preallocated<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 swapfile \u2212 must be nodatacow (ie. also nodatasum)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 swapfile \u2212 must not be compressed<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The limitations come namely from the COW\u2212based design and mapping layer of blocks that allows the advanced features like relocation and multi\u2212device filesystems. However, the swap subsystem expects simpler mapping and no background changes of the file blocks once they\u2019ve been attached to swap.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">With active swapfiles, the following whole\u2212filesystem operations will skip swapfile extents or may fail:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 balance \u2212 block groups with swapfile extents are skipped and reported, the rest will be processed normally<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 resize grow \u2212 unaffected<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 resize shrink \u2212 works as long as the extents are outside of the shrunk range<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 device add \u2212 a new device does not interfere with existing swapfile and this operation will work, though no new swapfile can be activated afterwards<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 device delete \u2212 if the device has been added as above, it can be also deleted<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 device replace \u2212 ditto<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">When there are no active swapfiles and a whole\u2212filesystem exclusive operation is running (ie. balance, device delete, shrink), the swapfiles cannot be temporarily activated. The operation must finish first.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">To create and activate a swapfile run the following commands:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"># truncate \u2212s 0 swapfile <br \/> # chattr +C swapfile <br \/> # fallocate \u2212l 2G swapfile <br \/> # chmod 0600 swapfile <br \/> # mkswap swapfile <br \/> # swapon swapfile<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Please note that the UUID returned by the <i>mkswap<\/i> utility identifies the swap &#8220;filesystem&#8221; and because it\u2019s stored in a file, it\u2019s not generally visible and usable as an identifier unlike if it was on a block device.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The file will appear in <i>\/proc\/swaps<\/i>:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"># cat \/proc\/swaps <br \/> Filename Type Size Used Priority <br \/> \/path\/swapfile file 2097152 0 \u22122<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The swapfile can be created as one\u2212time operation or, once properly created, activated on each boot by the <i>swapon \u2212a<\/i> command (usually started by the service manager). Add the following entry to <i>\/etc\/fstab<\/i>, assuming the filesystem that provides the <i>\/path<\/i> has been already mounted at this point. Additional mount options relevant for the swapfile can be set too (like priority, not the btrfs mount options).<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\/path\/swapfile none swap defaults 0 0<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>CHECKSUM ALGORITHMS <a name=\"CHECKSUM ALGORITHMS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are several checksum algorithms supported. The default and backward compatible is <i>crc32c<\/i>. Since kernel 5.5 there are three more with different characteristics and trade\u2212offs regarding speed and strength. The following list may help you to decide which one to select.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>CRC32C<\/b> (32bit digest)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">default, best backward compatibility, very fast, modern CPUs have instruction\u2212level support, not collision\u2212resistant but still good error detection capabilities<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>XXHASH<\/b> (64bit digest)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">can be used as CRC32C successor, very fast, optimized for modern CPUs utilizing instruction pipelining, good collision resistance and error detection<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>SHA256<\/b> (256bit digest)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">a cryptographic\u2212strength hash, relatively slow but with possible CPU instruction acceleration or specialized hardware cards, FIPS certified and in wide use<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>BLAKE2b<\/b> (256bit digest)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">a cryptographic\u2212strength hash, relatively fast with possible CPU acceleration using SIMD extensions, not standardized but based on BLAKE which was a SHA3 finalist, in wide use, the algorithm used is BLAKE2b\u2212256 that\u2019s optimized for 64bit platforms<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The <i>digest size<\/i> affects overall size of data block checksums stored in the filesystem. The metadata blocks have a fixed area up to 256bits (32 bytes), so there\u2019s no increase. Each data block has a separate checksum stored, with additional overhead of the b\u2212tree leaves.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Approximate relative performance of the algorithms, measured against CRC32C using reference software implementations on a 3.5GHz intel CPU:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p align=\"center\" style=\"margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><img decoding=\"async\" src=\"grohtml-1221211.png\" alt=\"Image grohtml-1221211.png\"><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Many kernels are configured with SHA256 as built\u2212in and not as a module. The accelerated versions are however provided by the modules and must be loaded explicitly (<b>modprobe sha256<\/b>) before mounting the filesystem to make use of them. You can check in <i>\/sys\/fs\/btrfs\/FSID\/checksum<\/i> which one is used. If you see <i>sha256\u2212generic<\/i>, then you may want to unmount and mount the filesystem again, changing that on a mounted filesystem is not possible. Check the file <i>\/proc\/crypto<\/i>, when the implementation is built\u2212in, you\u2019d find<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">name : sha256 <br \/> driver : sha256\u2212generic <br \/> module : kernel <br \/> priority : 100 <br \/> &#8230;<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">while accelerated implementation is e.g.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">name : sha256 <br \/> driver : sha256\u2212avx2 <br \/> module : sha256_ssse3 <br \/> priority : 170 <br \/> &#8230;<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>COMPRESSION <a name=\"COMPRESSION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Btrfs supports transparent file compression. There are three algorithms available: ZLIB, LZO and ZSTD (since v4.14). Basically, compression is on a file by file basis. You can have a single btrfs mount point that has some files that are uncompressed, some that are compressed with LZO, some with ZLIB, for instance (though you may not want it that way, it is supported).<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">To enable compression, mount the filesystem with options <i>compress<\/i> or <i>compress\u2212force<\/i>. Please refer to section <i>MOUNT OPTIONS<\/i>. Once compression is enabled, all new writes will be subject to compression. Some files may not compress very well, and these are typically not recompressed but still written uncompressed.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Each compression algorithm has different speed\/ratio trade offs. The levels can be selected by a mount option and affect only the resulting size (ie. no compatibility issues).<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Basic characteristics:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p align=\"center\" style=\"margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><img decoding=\"async\" src=\"grohtml-1221212.png\" alt=\"Image grohtml-1221212.png\"><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The differences depend on the actual data set and cannot be expressed by a single number or recommendation. Higher levels consume more CPU time and may not bring a significant improvement, lower levels are close to real time.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The algorithms could be mixed in one file as they\u2019re stored per extent. The compression can be changed on a file by <b>btrfs filesystem defrag<\/b> command, using the <i>\u2212c<\/i> option, or by <b>btrfs property set<\/b> using the <i>compression<\/i> property. Setting compression by <i>chattr +c<\/i> utility will set it to zlib.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>INCOMPRESSIBLE DATA<\/b> <br \/> Files with already compressed data or with data that won\u2019t compress well with the CPU and memory constraints of the kernel implementations are using a simple decision logic. If the first portion of data being compressed is not smaller than the original, the compression of the file is disabled \u2014 unless the filesystem is mounted with <i>compress\u2212force<\/i>. In that case compression will always be attempted on the file only to be later discarded. This is not optimal and subject to optimizations and further development.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">If a file is identified as incompressible, a flag is set (NOCOMPRESS) and it\u2019s sticky. On that file compression won\u2019t be performed unless forced. The flag can be also set by <i>chattr +m<\/i> (since e2fsprogs 1.46.2) or by properties with value <i>no<\/i> or <i>none<\/i>. Empty value will reset it to the default that\u2019s currently applicable on the mounted filesystem.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are two ways to detect incompressible data:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 actual compression attempt \u2212 data are compressed, if the result is not smaller, it\u2019s discarded, so this depends on the algorithm and level<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 pre\u2212compression heuristics \u2212 a quick statistical evaluation on the data is peformed and based on the result either compression is performed or skipped, the NOCOMPRESS bit is not set just by the heuristic, only if the compression algorithm does not make an improvent<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>PRE\u2212COMPRESSION HEURISTICS<\/b> <br \/> The heuristics aim to do a few quick statistical tests on the compressed data in order to avoid probably costly compression that would turn out to be inefficient. Compression algorithms could have internal detection of incompressible data too but this leads to more overhead as the compression is done in another thread and has to write the data anyway. The heuristic is read\u2212only and can utilize cached memory.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The tests performed based on the following: data sampling, long repated pattern detection, byte frequency, Shannon entropy.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>COMPATIBILITY WITH OTHER FEATURES<\/b> <br \/> Compression is done using the COW mechanism so it\u2019s incompatible with <i>nodatacow<\/i>. Direct IO works on compressed files but will fall back to buffered writes. Currently <i>nodatasum<\/i> and compression don\u2019t work together.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>FILESYSTEM EXCLUSIVE OPERATIONS <a name=\"FILESYSTEM EXCLUSIVE OPERATIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are several operations that affect the whole filesystem and cannot be run in parallel. Attempt to start one while another is running will fail.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Since kernel 5.10 the currently running operation can be obtained from <b>\/sys\/fs\/UUID\/exclusive_operation<\/b> with following values and operations:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 balance<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 device add<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 device delete<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 device replace<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 resize<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 swapfile activate<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 none<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Enqueuing is supported for several btrfs subcommands so they can be started at once and then serialized.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>FILESYSTEM LIMITS <a name=\"FILESYSTEM LIMITS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">maximum file name length<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">255<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">maximum symlink target length<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">depends on the <i>nodesize<\/i> value, for 4k it\u2019s 3949 bytes, for larger nodesize it\u2019s 4095 due to the system limit PATH_MAX<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The symlink target may not be a valid path, ie. the path name components can exceed the limits (NAME_MAX), there\u2019s no content validation at <b>symlink<\/b>(3) creation.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">maximum number of inodes<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">2^64 but depends on the available metadata space as the inodes are created dynamically<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">inode numbers<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">minimum number: 256 (for subvolumes), regular files and directories: 257<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">maximum file length<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">inherent limit of btrfs is 2^64 (16 EiB) but the linux VFS limit is 2^63 (8 EiB)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">maximum number of subvolumes<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the subvolume ids can go up to 2^64 but the number of actual subvolumes depends on the available metadata space, the space consumed by all subvolume metadata includes bookkeeping of shared extents can be large (MiB, GiB)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">maximum number of hardlinks of a file in a directory<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">65536 when the <b>extref<\/b> feature is turned on during mkfs (default), roughly 100 otherwise<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">minimum filesystem size<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">the minimal size of each device depends on the <i>mixed\u2212bg<\/i> feature, without that (the default) it\u2019s about 109MiB, with mixed\u2212bg it\u2019s is 16MiB<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>BOOTLOADER SUPPORT <a name=\"BOOTLOADER SUPPORT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">GRUB2 (<\/font><b><font color=\"#0000FF\">https:\/\/www.gnu.org\/software\/grub<\/font><\/b><font color=\"#000000\">) has the most advanced support of booting from BTRFS with respect to features.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">U\u2212boot (<\/font><b><font color=\"#0000FF\">https:\/\/www.denx.de\/wiki\/U\u2212Boot\/<\/font><\/b><font color=\"#000000\">) has decent support for booting but not all BTRFS features are implemented, check the documentation.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">EXTLINUX (from the<\/font> <b><font color=\"#0000FF\">https:\/\/syslinux.org<\/font><\/b> <font color=\"#000000\">project) can boot but does not support all features. Please check the upstream documentation before you use it.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The first 1MiB on each device is unused with the exception of primary superblock that is on the offset 64KiB and spans 4KiB.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>FILE ATTRIBUTES <a name=\"FILE ATTRIBUTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The btrfs filesystem supports setting file attributes or flags. Note there are old and new interfaces, with confusing names. The following list should clarify that:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 <i>attributes<\/i>: <b>chattr<\/b>(1) or <b>lsattr<\/b>(1) utilities (the ioctls are FS_IOC_GETFLAGS and FS_IOC_SETFLAGS), due to the ioctl names the attributes are also called flags<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 <i>xflags<\/i>: to distinguish from the previous, it\u2019s extended flags, with tunable bits similar to the attributes but extensible and new bits will be added in the future (the ioctls are FS_IOC_FSGETXATTR and FS_IOC_FSSETXATTR but they are not related to extended attributes that are also called xattrs), there\u2019s no standard tool to change the bits, there\u2019s support in <b>xfs_io<\/b>(8) as command <b>xfs_io \u2212c chattr<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>ATTRIBUTES <br \/> a<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><i>append only<\/i>, new writes are always written at the end of the file<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>A<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><i>no atime updates<\/i><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>c<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><i>compress data<\/i>, all data written after this attribute is set will be compressed. Please note that compression is also affected by the mount options or the parent directory attributes.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">When set on a directory, all newly created files will inherit this attribute. This attribute cannot be set with <i>m<\/i> at the same time.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>C<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><i>no copy\u2212on\u2212write<\/i>, file data modifications are done in\u2212place<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">When set on a directory, all newly created files will inherit this attribute.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:23%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b><big>Note<\/big><\/b> <br \/> due to implementation limitations, this flag can be set\/unset only on empty files.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b><big>d<\/big><\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>no dump<\/i>, makes sense with 3rd party tools like <b>dump<\/b>(8), on BTRFS the attribute can be set\/unset but no other special handling is done<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>D<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>synchronous directory updates<\/i>, for more details search <b>open<\/b>(2) for <i>O_SYNC<\/i> and <i>O_DSYNC<\/i><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>i<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>immutable<\/i>, no file data and metadata changes allowed even to the root user as long as this attribute is set (obviously the exception is unsetting the attribute)<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>m<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>no compression<\/i>, permanently turn off compression on the given file. Any compression mount options will not affect this file. (<b>chattr<\/b> support added in 1.46.2)<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>When set on a directory, all newly created files will inherit this attribute. This attribute cannot be set with <i>c<\/i> at the same time.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>S<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>synchronous updates<\/i>, for more details search <b>open<\/b>(2) for <i>O_SYNC<\/i> and <i>O_DSYNC<\/i><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>No other attributes are supported. For the complete list please refer to the <b>chattr<\/b>(1) manual page.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>XFLAGS<\/b> <br \/> There\u2019s overlap of letters assigned to the bits with the attributes, this list refers to what <b>xfs_io<\/b>(8) provides:<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>i<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>immutable<\/i>, same as the attribute<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>a<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>append only<\/i>, same as the attribute<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>s<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>synchronous updates<\/i>, same as the attribute <i>S<\/i><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>A<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>no atime updates<\/i>, same as the attribute<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>d<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>no dump<\/i>, same as the attribute<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>ZONED MODE <a name=\"ZONED MODE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Since version 5.12 btrfs supports so called <i>zoned mode<\/i>. This is a special on\u2212disk format and allocation\/write strategy that\u2019s friendly to zoned devices. In short, a device is partitioned into fixed\u2212size zones and each zone can be updated by append\u2212only manner, or reset. As btrfs has no fixed data structures, except the super blocks, the zoned mode only requires block placement that follows the device constraints. You can learn about the whole architecture at<\/big><\/font> <big><b><font color=\"#0000FF\">https:\/\/zonedstorage.io<\/font><\/b> <font color=\"#000000\">.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The devices are also called SMR\/ZBC\/ZNS, in <i>host\u2212managed<\/i> mode. Note that there are devices that appear as non\u2212zoned but actually are, this is <i>drive\u2212managed<\/i> and using zoned mode won\u2019t help.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The zone size depends on the device, typical sizes are 256MiB or 1GiB. In general it must be a power of two. Emulated zoned devices like <i>null_blk<\/i> allow to set various zone sizes.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>REQUIREMENTS, LIMITATIONS<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%;\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 all devices must have the same zone size<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 maximum zone size is 8GiB<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 mixing zoned and non\u2212zoned devices is possible, the zone writes are emulated, but this is namely for testing<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 the super block is handled in a special way and is at different locations than on a non\u2212zoned filesystem:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 primary: 0B (and the next two zones)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 secondary: 512G (and the next two zones)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 tertiary: 4TiB (4096GiB, and the next two zones)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>INCOMPATIBLE FEATURES<\/b> <br \/> The main constraint of the zoned devices is lack of in\u2212place update of the data. This is inherently incompatbile with some features:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 nodatacow \u2212 overwrite in\u2212place, cannot create such files<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 fallocate \u2212 preallocating space for in\u2212place first write<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 mixed\u2212bg \u2212 unordered writes to data and metadata, fixing that means using separate data and metadata block groups<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 booting \u2212 the zone at offset 0 contains superblock, resetting the zone would destroy the bootloader data<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Initial support lacks some features but they\u2019re planned:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 only single profile is supported<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 fstrim \u2212 due to dependency on free space cache v1<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>SUPER BLOCK<\/b> <br \/> As said above, super block is handled in a special way. In order to be crash safe, at least one zone in a known location must contain a valid superblock. This is implemented as a ring buffer in two consecutive zones, starting from known offsets 0, 512G and 4TiB. The values are different than on non\u2212zoned devices. Each new super block is appended to the end of the zone, once it\u2019s filled, the zone is reset and writes continue to the next one. Looking up the latest super block needs to read offsets of both zones and determine the last written version.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The amount of space reserved for super block depends on the zone size. The secondary and tertiary copies are at distant offsets as the capacity of the devices is expected to be large, tens of terabytes. Maximum zone size supported is 8GiB, which would mean that eg. offset 0\u221216GiB would be reserved just for the super block on a hypothetical device of that zone size. This is wasteful but required to guarantee crash safety.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>CONTROL DEVICE <a name=\"CONTROL DEVICE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There\u2019s a character special device <b>\/dev\/btrfs\u2212control<\/b> with major and minor numbers 10 and 234 (the device can be found under the <i>misc<\/i> category).<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">$ ls \u2212l \/dev\/btrfs\u2212control <br \/> crw\u2212\u2212\u2212\u2212\u2212\u2212\u2212 1 root root 10, 234 Jan 1 12:00 \/dev\/btrfs\u2212control<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The device accepts some ioctl calls that can perform following actions on the filesystem module:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 scan devices for btrfs filesystem (ie. to let multi\u2212device filesystems mount automatically) and register them with the kernel module<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 similar to scan, but also wait until the device scanning process is finished for a given filesystem<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 get the supported features (can be also found under <i>\/sys\/fs\/btrfs\/features<\/i>)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The device is created when btrfs is initialized, either as a module or a built\u2212in functionality and makes sense only in connection with that. Running eg. mkfs without the module loaded will not register the device and will probably warn about that.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">In rare cases when the module is loaded but the device is not present (most likely accidentally deleted), it\u2019s possible to recreate it by<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"># mknod \u2212\u2212mode=600 \/dev\/btrfs\u2212control c 10 234<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">or (since 5.11) by a convenience command<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"># btrfs rescue create\u2212control\u2212device<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The control device is not strictly required but the device scanning will not work and a workaround would need to be used to mount a multi\u2212device filesystem. The mount option <i>device<\/i> can trigger the device scanning during mount, see also <b>btrfs device scan<\/b>.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>FILESYSTEM WITH MULTIPLE PROFILES <a name=\"FILESYSTEM WITH MULTIPLE PROFILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">It is possible that a btrfs filesystem contains multiple block group profiles of the same type. This could happen when a profile conversion using balance filters is interrupted (see <b>btrfs\u2212balance<\/b>(8)). Some <i>btrfs<\/i> commands perform a test to detect this kind of condition and print a warning like this:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">WARNING: Multiple block group profiles detected, see &#8216;man btrfs(5)&#8217;. <br \/> WARNING: Data: single, raid1 <br \/> WARNING: Metadata: single, raid1<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The corresponding output of <b>btrfs filesystem df<\/b> might look like:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">WARNING: Multiple block group profiles detected, see &#8216;man btrfs(5)&#8217;. <br \/> WARNING: Data: single, raid1 <br \/> WARNING: Metadata: single, raid1 <br \/> Data, RAID1: total=832.00MiB, used=0.00B <br \/> Data, single: total=1.63GiB, used=0.00B <br \/> System, single: total=4.00MiB, used=16.00KiB <br \/> Metadata, single: total=8.00MiB, used=112.00KiB <br \/> Metadata, RAID1: total=64.00MiB, used=32.00KiB <br \/> GlobalReserve, single: total=16.25MiB, used=0.00B<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There\u2019s more than one line for type <i>Data<\/i> and <i>Metadata<\/i>, while the profiles are <i>single<\/i> and <i>RAID1<\/i>.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">This state of the filesystem OK but most likely needs the user\/administrator to take an action and finish the interrupted tasks. This cannot be easily done automatically, also the user knows the expected final profiles.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">In the example above, the filesystem started as a single device and <i>single<\/i> block group profile. Then another device was added, followed by balance with <i>convert=raid1<\/i> but for some reason hasn\u2019t finished. Restarting the balance with <i>convert=raid1<\/i> will continue and end up with filesystem with all block group profiles <i>RAID1<\/i>.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b><big>Note<\/big><\/b> <br \/> If you\u2019re familiar with balance filters, you can use <i>convert=raid1,profiles=single,soft<\/i>, which will take only the unconverted <i>single<\/i> profiles and convert them to <i>raid1<\/i>. This may speed up the conversion as it would not try to rewrite the already convert <i>raid1<\/i> profiles.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Having just one profile is desired as this also clearly defines the profile of newly allocated block groups, otherwise this depends on internal allocation policy. When there are multiple profiles present, the order of selection is RAID6, RAID5, RAID10, RAID1, RAID0 as long as the device number constraints are satisfied.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Commands that print the warning were chosen so they\u2019re brought to user attention when the filesystem state is being changed in that regard. This is: <i>device add<\/i>, <i>device delete<\/i>, <i>balance cancel<\/i>, <i>balance pause<\/i>. Commands that report space usage: <i>filesystem df<\/i>, <i>device usage<\/i>. The command <i>filesystem usage<\/i> provides a line in the overall summary:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Multiple profiles: yes (data, metadata)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>SEEDING DEVICE <a name=\"SEEDING DEVICE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The COW mechanism and multiple devices under one hood enable an interesting concept, called a seeding device: extending a read\u2212only filesystem on a single device filesystem with another device that captures all writes. For example imagine an immutable golden image of an operating system enhanced with another device that allows to use the data from the golden image and normal operation. This idea originated on CD\u2212ROMs with base OS and allowing to use them for live systems, but this became obsolete. There are technologies providing similar functionality, like <i>unionmount<\/i>, <i>overlayfs<\/i> or <i>qcow2<\/i> image snapshot.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The seeding device starts as a normal filesystem, once the contents is ready, <b>btrfstune \u2212S 1<\/b> is used to flag it as a seeding device. Mounting such device will not allow any writes, except adding a new device by <b>btrfs device add<\/b>. Then the filesystem can be remounted as read\u2212write.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Given that the filesystem on the seeding device is always recognized as read\u2212only, it can be used to seed multiple filesystems, at the same time. The UUID that is normally attached to a device is automatically changed to a random UUID on each mount.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Once the seeding device is mounted, it needs the writable device. After adding it, something like <i>remount \u2212o remount,rw \/path<\/i> makes the filesystem at <i>\/path<\/i> ready for use. The simplest usecase is to throw away all changes by unmounting the filesystem when convenient.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Alternatively, deleting the seeding device from the filesystem can turn it into a normal filesystem, provided that the writable device can also contain all the data from the seeding device.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The seeding device flag can be cleared again by <b>btrfstune \u2212f \u2212s 0<\/b>, eg. allowing to update with newer data but please note that this will invalidate all existing filesystems that use this particular seeding device. This works for some usecases, not for others, and a forcing flag to the command is mandatory to avoid accidental mistakes.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Example how to create and use one seeding device:<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big># mkfs.btrfs \/dev\/sda <br \/> # mount \/dev\/sda \/mnt\/mnt1 <br \/> # &#8230; fill mnt1 with data <br \/> # umount \/mnt\/mnt1 <br \/> # btrfstune \u2212S 1 \/dev\/sda <br \/> # mount \/dev\/sda \/mnt\/mnt1 <br \/> # btrfs device add \/dev\/sdb \/mnt <br \/> # mount \u2212o remount,rw \/mnt\/mnt1 <br \/> # &#8230; \/mnt\/mnt1 is now writable<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Now <i>\/mnt\/mnt1<\/i> can be used normally. The device <i>\/dev\/sda<\/i> can be mounted again with a another writable device:<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big># mount \/dev\/sda \/mnt\/mnt2 <br \/> # btrfs device add \/dev\/sdc \/mnt\/mnt2 <br \/> # mount \u2212o remount,rw \/mnt\/mnt2 <br \/> # &#8230; \/mnt\/mnt2 is now writable<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The writable device (<i>\/dev\/sdb<\/i>) can be decoupled from the seeding device and used independently:<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big># btrfs device delete \/dev\/sda \/mnt\/mnt1<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>As the contents originated in the seeding device, it\u2019s possible to turn <i>\/dev\/sdb<\/i> to a seeding device again and repeat the whole process.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>A few things to note:<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 it\u2019s recommended to use only single device for the seeding device, it works for multiple devices but the <i>single<\/i> profile must be used in order to make the seeding device deletion work<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 block group profiles <i>single<\/i> and <i>dup<\/i> support the usecases above<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 the label is copied from the seeding device and can be changed by <b>btrfs filesystem label<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 each new mount of the seeding device gets a new random UUID<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>RAID56 STATUS AND RECOMMENDED PRACTICES <a name=\"RAID56 STATUS AND RECOMMENDED PRACTICES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The RAID56 feature provides striping and parity over several devices, same as the traditional RAID5\/6. There are some implementation and design deficiencies that make it unreliable for some corner cases and the feature <b>should not be used in production, only for evaluation or testing<\/b>. The power failure safety for metadata with RAID56 is not 100%.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>Metadata<\/b> <br \/> Do not use <i>raid5<\/i> nor <i>raid6<\/i> for metadata. Use <i>raid1<\/i> or <i>raid1c3<\/i> respectively.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The substitute profiles provide the same guarantees against loss of 1 or 2 devices, and in some respect can be an improvement. Recovering from one missing device will only need to access the remaining 1st or 2nd copy, that in general may be stored on some other devices due to the way RAID1 works on btrfs, unlike on a striped profile (similar to <i>raid0<\/i>) that would need all devices all the time.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The space allocation pattern and consumption is different (eg. on N devices): for <i>raid5<\/i> as an example, a 1GiB chunk is reserved on each device, while with <i>raid1<\/i> there\u2019s each 1GiB chunk stored on 2 devices. The consumption of each 1GiB of used metadata is then <i>N bodies manpages.csv script_extrae_body.sh script.sh usr 1GiB<\/i> for vs <i>2 bodies manpages.csv script_extrae_body.sh script.sh usr 1GiB<\/i>. Using <i>raid1<\/i> is also more convenient for balancing\/converting to other profile due to lower requirement on the available chunk space.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>Missing\/incomplete support<\/b> <br \/> When RAID56 is on the same filesystem with different raid profiles, the space reporting is inaccurate, eg. <i>df<\/i>, <i>btrfs filesystem df<\/i> or <i>btrfs filesystem usge<\/i>. When there\u2019s only a one profile per block group type (eg. raid5 for data) the reporting is accurate.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>When scrub is started on a RAID56 filesystem, it\u2019s started on all devices that degrade the performance. The workaround is to start it on each device separately. Due to that the device stats may not match the actual state and some errors might get reported multiple times.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The <i>write hole<\/i> problem.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>STORAGE MODEL <a name=\"STORAGE MODEL\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><i>A storage model is a model that captures key physical aspects of data structure in a data store. A filesystem is the logical structure organizing data on top of the storage device.<\/i><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The filesystem assumes several features or limitations of the storage device and utilizes them or applies measures to guarantee reliability. BTRFS in particular is based on a COW (copy on write) mode of writing, ie. not updating data in place but rather writing a new copy to a different location and then atomically switching the pointers.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>In an ideal world, the device does what it promises. The filesystem assumes that this may not be true so additional mechanisms are applied to either detect misbehaving hardware or get valid data by other means. The devices may (and do) apply their own detection and repair mechanisms but we won\u2019t assume any.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The following assumptions about storage devices are considered (sorted by importance, numbers are for further reference):<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>1. atomicity of reads and writes of blocks\/sectors (the smallest unit of data the device presents to the upper layers)<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>2. there\u2019s a flush command that instructs the device to forcibly order writes before and after the command; alternatively there\u2019s a barrier command that facilitates the ordering but may not flush the data<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>3. data sent to write to a given device offset will be written without further changes to the data and to the offset<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>4. writes can be reordered by the device, unless explicitly serialized by the flush command<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>5. reads and writes can be freely reordered and interleaved<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The consistency model of BTRFS builds on these assumptions. The logical data updates are grouped, into a generation, written on the device, serialized by the flush command and then the super block is written ending the generation. All logical links among metadata comprising a consistent view of the data may not cross the generation boundary.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>WHEN THINGS GO WRONG <br \/> No or partial atomicity of block reads\/writes (1)<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 <i>Problem<\/i>: a partial block contents is written (<i>torn write<\/i>), eg. due to a power glitch or other electronics failure during the read\/write<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 <i>Detection<\/i>: checksum mismatch on read<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 <i>Repair<\/i>: use another copy or rebuild from multiple blocks using some encoding scheme<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>The flush command does not flush (2)<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>This is perhaps the most serious problem and impossible to mitigate by filesystem without limitations and design restrictions. What could happen in the worst case is that writes from one generation bleed to another one, while still letting the filesystem consider the generations isolated. Crash at any point would leave data on the device in an inconsistent state without any hint what exactly got written, what is missing and leading to stale metadata link information.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Devices usually honor the flush command, but for performance reasons may do internal caching, where the flushed data are not yet persistently stored. A power failure could lead to a similar scenario as above, although it\u2019s less likely that later writes would be written before the cached ones. This is beyond what a filesystem can take into account. Devices or controllers are usually equipped with batteries or capacitors to write the cache contents even after power is cut. (<i>Battery backed write cache<\/i>)<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>Data get silently changed on write (3)<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Such thing should not happen frequently, but still can happen spuriously due the complex internal workings of devices or physical effects of the storage media itself.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 <i>Problem<\/i>: while the data are written atomically, the contents get changed<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 <i>Detection<\/i>: checksum mismatch on read<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022 <i>Repair<\/i>: use another copy or rebuild from multiple blocks using some encoding scheme<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>Data get silently written to another offset (3)<\/b><\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>This would be another serious problem as the filesystem has no information when it happens. For that reason the measures have to be done ahead of time. This problem is also commonly called <i>ghost write<\/i>.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The metadata blocks have the checksum embedded in the blocks, so a correct atomic write would not corrupt the checksum. It\u2019s likely that after reading such block the data inside would not be consistent with the rest. To rule that out there\u2019s embedded block number in the metadata block. It\u2019s the logical block number because this is what the logical structure expects and verifies.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>HARDWARE CONSIDERATIONS <a name=\"HARDWARE CONSIDERATIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>The following is based on information publicly available, user feedback, community discussions or bug report analyses. It\u2019s not complete and further research is encouraged when in doubt.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big><b>MAIN MEMORY<\/b> <br \/> The data structures and raw data blocks are temporarily stored in computer memory before they get written to the device. It is critical that memory is reliable because even simple bit flips can have vast consequences and lead to damaged structures, not only in the filesystem but in the whole operating system.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Based on experience in the community, memory bit flips are more common than one would think. When it happens, it\u2019s reported by the tree\u2212checker or by a checksum mismatch after reading blocks. There are some very obvious instances of bit flips that happen, e.g. in an ordered sequence of keys in metadata blocks. We can easily infer from the other data what values get damaged and how. However, fixing that is not straightforward and would require cross\u2212referencing data from the entire filesystem to see the scope.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>If available, ECC memory should lower the chances of bit flips, but this type of memory is not available in all cases. A memory test should be performed in case there\u2019s a visible bit flip pattern, though this may not detect a faulty memory module because the actual load of the system could be the factor making the problems appear. In recent years attacks on how the memory modules operate have been demonstrated (<i>rowhammer<\/i>) achieving specific bits to be flipped. While these were targeted, this shows that a series of reads or writes can affect unrelated parts of memory.<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>Further reading:<\/big><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><big>\u2022<\/big><\/font> <big><b><font color=\"#0000FF\">https:\/\/en.wikipedia.org\/wiki\/Row_hammer<\/font><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">What to do:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 run <i>memtest<\/i>, note that sometimes memory errors happen only when the system is under heavy load that the default memtest cannot trigger<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 memory errors may appear as filesystem going read\u2212only due to &#8220;pre write&#8221; check, that verify meta data before they get written but fail some basic consistency checks<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>DIRECT MEMORY ACCESS (DMA)<\/b> <br \/> Another class of errors is related to DMA (direct memory access) performed by device drivers. While this could be considered a software error, the data transfers that happen without CPU assistance may accidentally corrupt other pages. Storage devices utilize DMA for performance reasons, the filesystem structures and data pages are passed back and forth, making errors possible in case page life time is not properly tracked.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are lots of quirks (device\u2212specific workarounds) in Linux kernel drivers (regarding not only DMA) that are added when found. The quirks may avoid specific errors or disable some features to avoid worse problems.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">What to do:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 use up\u2212to\u2212date kernel (recent releases or maintained long term support versions)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 as this may be caused by faulty drivers, keep the systems up\u2212to\u2212date<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>ROTATIONAL DISKS (HDD)<\/b> <br \/> Rotational HDDs typically fail at the level of individual sectors or small clusters. Read failures are caught on the levels below the filesystem and are returned to the user as <i>EIO \u2212 Input\/output error<\/i>. Reading the blocks repeatedly may return the data eventually, but this is better done by specialized tools and filesystem takes the result of the lower layers. Rewriting the sectors may trigger internal remapping but this inevitably leads to data loss.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Disk firmware is technically software but from the filesystem perspective is part of the hardware. IO requests are processed, and caching or various other optimizations are performed, which may lead to bugs under high load or unexpected physical conditions or unsupported use cases.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Disks are connected by cables with two ends, both of which can cause problems when not attached properly. Data transfers are protected by checksums and the lower layers try hard to transfer the data correctly or not at all. The errors from badly\u2212connecting cables may manifest as large amount of failed read or write requests, or as short error bursts depending on physical conditions.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">What to do:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 check <i>smartctl<\/i> for potential issues<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>SOLID STATE DRIVES (SSD)<\/b> <br \/> The mechanism of information storage is different from HDDs and this affects the failure mode as well. The data are stored in cells grouped in large blocks with limited number of resets and other write constraints. The firmware tries to avoid unnecessary resets and performs optimizations to maximize the storage media lifetime. The known techniques are deduplication (blocks with same fingerprint\/hash are mapped to same physical block), compression or internal remapping and garbage collection of used memory cells. Due to the additional processing there are measures to verity the data e.g. by ECC codes.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">The observations of failing SSDs show that the whole electronic fails at once or affects a lot of data (eg. stored on one chip). Recovering such data may need specialized equipment and reading data repeatedly does not help as it\u2019s possible with HDDs.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are several technologies of the memory cells with different characteristics and price. The lifetime is directly affected by the type and frequency of data written. Writing &#8220;too much&#8221; distinct data (e.g. encrypted) may render the internal deduplication ineffective and lead to a lot of rewrites and increased wear of the memory cells.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are several technologies and manufacturers so it\u2019s hard to describe them but there are some that exhibit similar behaviour:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 expensive SSD will use more durable memory cells and is optimized for reliability and high load<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 cheap SSD is projected for a lower load (&#8220;desktop user&#8221;) and is optimized for cost, it may employ the optimizations and\/or extended error reporting partially or not at all<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">It\u2019s not possible to reliably determine the expected lifetime of an SSD due to lack of information about how it works or due to lack of reliable stats provided by the device.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Metadata writes tend to be the biggest component of lifetime writes to a SSD, so there is some value in reducing them. Depending on the device class (high end\/low end) the features like DUP block group profiles may affect the reliability in both ways:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 <i>high end<\/i> are typically more reliable and using <i>single<\/i> for data and metadata could be suitable to reduce device wear<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 <i>low end<\/i> could lack ability to identify errors so an additional redundancy at the filesystem level (checksums, <i>DUP<\/i>) could help<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Only users who consume 50 to 100% of the SSD\u2019s actual lifetime writes need to be concerned by the write amplification of btrfs DUP metadata. Most users will be far below 50% of the actual lifetime, or will write the drive to death and discover how many writes 100% of the actual lifetime was. SSD firmware often adds its own write multipliers that can be arbitrary and unpredictable and dependent on application behavior, and these will typically have far greater effect on SSD lifespan than DUP metadata. It\u2019s more or less impossible to predict when a SSD will run out of lifetime writes to within a factor of two, so it\u2019s hard to justify wear reduction as a benefit.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Further reading:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022<\/font> <b><font color=\"#0000FF\">https:\/\/www.snia.org\/educational\u2212library\/ssd\u2212and\u2212deduplication\u2212end\u2212spinning\u2212disk\u22122012<\/font><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022<\/font> <b><font color=\"#0000FF\">https:\/\/www.snia.org\/educational\u2212library\/realities\u2212solid\u2212state\u2212storage\u22122013\u22122013<\/font><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022<\/font> <b><font color=\"#0000FF\">https:\/\/www.snia.org\/educational\u2212library\/ssd\u2212performance\u2212primer\u22122013<\/font><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022<\/font> <b><font color=\"#0000FF\">https:\/\/www.snia.org\/educational\u2212library\/how\u2212controllers\u2212maximize\u2212ssd\u2212life\u22122013<\/font><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">What to do:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 run <i>smartctl<\/i> or self\u2212tests to look for potential issues<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 keep the firmware up\u2212to\u2212date<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>NVM EXPRESS, NON\u2212VOLATILE MEMORY (NVMe)<\/b> <br \/> NVMe is a type of persistent memory usually connected over a system bus (PCIe) or similar interface and the speeds are an order of magnitude faster than SSD. It is also a non\u2212rotating type of storage, and is not typically connected by a cable. It\u2019s not a SCSI type device either but rather a complete specification for logical device interface.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">In a way the errors could be compared to a combination of SSD class and regular memory. Errors may exhibit as random bit flips or IO failures. There are tools to access the internal log (<i>nvme log<\/i> and <i>nvme\u2212cli<\/i>) for a more detailed analysis.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">There are separate error detection and correction steps performed e.g. on the bus level and in most cases never making in to the filesystem level. Once this happens it could mean there\u2019s some systematic error like overheating or bad physical connection of the device. You may want to run self\u2212tests (using <i>smartctl<\/i>).<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022<\/font> <b><font color=\"#0000FF\">https:\/\/en.wikipedia.org\/wiki\/NVM_Express<\/font><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022<\/font> <b><font color=\"#0000FF\">https:\/\/www.smartmontools.org\/wiki\/NVMe_Support<\/font><\/b><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><b><font color=\"#000000\">DRIVE FIRMWARE<\/font><\/b> <font color=\"#000000\"><br \/> Firmware is technically still software but embedded into the hardware. As all software has bugs, so does firmware. Storage devices can update the firmware and fix known bugs. In some cases the it\u2019s possible to avoid certain bugs by quirks (device\u2212specific workarounds) in Linux kernel.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">A faulty firmware can cause wide range of corruptions from small and localized to large affecting lots of data. Self\u2212repair capabilities may not be sufficient.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">What to do:<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 check for firmware updates in case there are known problems, note that updating firmware can be risky on itself<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:17%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">\u2022 use up\u2212to\u2212date kernel (recent releases or maintained long term support versions)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>SD FLASH CARDS<\/b> <br \/> There are a lot of devices with low power consumption and thus using storage media based on low power consumption too, typically flash memory stored on a chip enclosed in a detachable card package. An improperly inserted card may be damaged by electrical spikes when the device is turned on or off. The chips storing data in turn may be damaged permanently. All types of flash memory have a limited number of rewrites, so the data are internally translated by FTL (flash translation layer). This is implemented in firmware (technically a software) and prone to bugs that manifest as hardware errors.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\">Adding redundancy like using DUP profiles for both data and metadata can help in some cases but a full backup might be the best option once problems appear and replacing the card could be required as well.<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>HARDWARE AS THE MAIN SOURCE OF FILESYSTEM CORRUPTIONS <br \/> If you use unreliable hardware and don\u2019t know about that, don\u2019t blame the filesystem when it tells you.<\/b><\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><big><font color=\"#000000\"><b>acl<\/b>(5), <b>btrfs<\/b>(8), <b>chattr<\/b>(1), <b>fstrim<\/b>(8), <b>ioctl<\/b>(2), <b>mkfs.btrfs<\/b>(8), <b>mount<\/b>(8), <b>swapon<\/b>(8)<\/font><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/big><\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  btrfs-man5 \u2212 topics about the BTRFS filesystem (mount options, supported file attributes and other) <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[959],"tags":[961,499,1291],"class_list":["post-4566","post","type-post","status-publish","format-standard","hentry","category-5-formatos-de-ficheros","tag-961","tag-btrfs","tag-man5"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4566","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4566"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4566\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4566"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4566"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4566"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}