Main Page

From btrfs Wiki
(Difference between revisions)
Jump to: navigation, search
(Major Features Currently Implemented: link to rtd)
(Documentation: irc link)
(18 intermediate revisions by one user not shown)
Line 43: Line 43:
 
* Extent based file storage
 
* Extent based file storage
 
* 2^64 byte == 16 EiB maximum file size (practical limit is 8 EiB due to Linux VFS)
 
* 2^64 byte == 16 EiB maximum file size (practical limit is 8 EiB due to Linux VFS)
* Space-efficient packing of small files
+
* [https://btrfs.readthedocs.io/en/latest/Inline-files.html Space-efficient packing of small files]
 
* Space-efficient indexed directories
 
* Space-efficient indexed directories
 
* Dynamic inode allocation
 
* Dynamic inode allocation
Line 49: Line 49:
 
* [https://btrfs.readthedocs.io/en/latest/Subvolumes.html Subvolumes] (separate internal filesystem roots)
 
* [https://btrfs.readthedocs.io/en/latest/Subvolumes.html Subvolumes] (separate internal filesystem roots)
 
* [https://btrfs.readthedocs.io/en/latest/Checksumming.html Checksums on data and metadata] (crc32c, xxhash, sha256, blake2b)
 
* [https://btrfs.readthedocs.io/en/latest/Checksumming.html Checksums on data and metadata] (crc32c, xxhash, sha256, blake2b)
* [[Compression]] (ZLIB, LZO, ZSTD), heuristics
+
* [https://btrfs.readthedocs.io/en/latest/Compression.html Compression] (ZLIB, LZO, ZSTD), heuristics
 
* Integrated [[Multiple_Device_Support|multiple device support]]
 
* Integrated [[Multiple_Device_Support|multiple device support]]
 
** File Striping
 
** File Striping
Line 55: Line 55:
 
** File Striping+Mirroring
 
** File Striping+Mirroring
 
** Single and Dual Parity implementations (experimental, not production-ready)
 
** Single and Dual Parity implementations (experimental, not production-ready)
* SSD (flash storage) awareness (TRIM/Discard for reporting free blocks for reuse) and optimizations (e.g. avoiding unnecessary seek optimizations, sending writes in clusters, even if they are from unrelated files. This results in larger write operations and faster write throughput)
+
* SSD (flash storage) awareness
* Background scrub process for finding and repairing errors of files with redundant copies
+
** [https://btrfs.readthedocs.io/en/latest/Trim.html TRIM/Discard] for reporting free blocks for reuse
 +
** Optimizations (e.g. avoiding unnecessary seek optimizations, sending writes in clusters, even if they are from unrelated files. This results in larger write operations and faster write throughput)
 +
* Background [https://btrfs.readthedocs.io/en/latest/Scrub.html scrub] process for finding and repairing errors of files with redundant copies
 
* Online filesystem [https://btrfs.readthedocs.io/en/latest/Defragmentation.html defragmentation]
 
* Online filesystem [https://btrfs.readthedocs.io/en/latest/Defragmentation.html defragmentation]
* [[btrfsck|Offline filesystem check]]
+
* [https://btrfs.readthedocs.io/en/latest/btrfs-check.html Offline filesystem check]
 
* In-place [[Conversion_from_Ext3|conversion]] of existing ext2/3/4 and reiserfs file systems
 
* In-place [[Conversion_from_Ext3|conversion]] of existing ext2/3/4 and reiserfs file systems
* [[Seed-device|Seed devices]]. Create a (readonly) filesystem that acts as a template to seed other Btrfs filesystems. The original filesystem and devices are included as a readonly starting point for the new filesystem. Using copy on write, all modifications are stored on different devices; the original is unchanged.
+
* [https://btrfs.readthedocs.io/en/latest/Seeding-device.html Seeding devices]. Create a (readonly) filesystem that acts as a template to seed other Btrfs filesystems. The original filesystem and devices are included as a readonly starting point for the new filesystem. Using copy on write, all modifications are stored on different devices; the original is unchanged.
* Subvolume-aware [[quota support]]
+
* Subvolume-aware [https://btrfs.readthedocs.io/en/latest/Qgroups.html quota support]
* [file:///home/ds/x/g/btrfs-progs/Documentation/_build/html/Send-receive.html Send/receive] of subvolume changes, efficient incremental filesystem mirroring and [[Incremental_Backup|backup]]
+
* [https://btrfs.readthedocs.io/en/latest/Send-receive.html Send/receive] of subvolume changes, efficient incremental filesystem mirroring and [[Incremental_Backup|backup]]
 
* Batch, or out-of-band [[deduplication]] (happens after writes, not during)
 
* Batch, or out-of-band [[deduplication]] (happens after writes, not during)
 
* [https://btrfs.readthedocs.io/en/latest/Swapfile.html Swapfile] support
 
* [https://btrfs.readthedocs.io/en/latest/Swapfile.html Swapfile] support
* [[Tree-checker]], post-read and pre-write metadata verification
+
* [https://btrfs.readthedocs.io/en/latest/Tree-checker.html Tree-checker], post-read and pre-write metadata verification
 
* [[Zoned]] mode support (SMR/ZBC/ZNS friendly allocation)
 
* [[Zoned]] mode support (SMR/ZBC/ZNS friendly allocation)
 
* fsverity integration
 
* fsverity integration
Line 81: Line 83:
  
 
* https://btrfs.readthedocs.org or https://btrfs.rtfd.io
 
* https://btrfs.readthedocs.org or https://btrfs.rtfd.io
 +
* the #btrfs channel is at [https://libera.chat libera.chat], matrix.org bridge works (persistent room #btrfs:matrix.org).
  
 
</div>
 
</div>
Line 100: Line 103:
 
* [[Problem FAQ]] — Commonly-encountered problems and solutions.
 
* [[Problem FAQ]] — Commonly-encountered problems and solutions.
 
** [[Gotchas]] — lists known bugs and issues, but not necessarily solutions.
 
** [[Gotchas]] — lists known bugs and issues, but not necessarily solutions.
 
=== External Btrfs Documentation / Guides ===
 
 
Links to Btrfs documentation of various Linux distributions:
 
 
* "[https://docs.oracle.com/cd/E37670_01/E37355/html/ol_btrfs.html The Btrfs File System]" chapter in the [https://docs.oracle.com/cd/E37670_01/E37355/html/index.html Oracle Linux 6 Administrator's Solutions Guide]
 
* [https://documentation.suse.com/sles/15-GA/single-html/SLES-storage/#sec-filesystems-major-btrfs Major File Systems in Linux] chapter in the [https://documentation.suse.com/en-us/sles/15-GA/single-html/SLES-storage/ SLES 15 Storage Administration Guide]
 
* [https://help.ubuntu.com/community/btrfs Btrfs Wiki page] on the [https://help.ubuntu.com/community Ubuntu Community Help Wiki]
 
* [https://wiki.archlinux.org/index.php/Btrfs Btrfs Wiki page] on the [https://wiki.archlinux.org/ Arch Linux Wiki]
 
* [http://marc.merlins.org/perso/btrfs/post_2014-05-21_My-Btrfs-Talk-at-Linuxcon-JP-2014.html Marc MERLIN's Btrfs talk at Linuxcon JP 2014] which gives an overview of Btrfs, best practices, and its more interesting features.
 
  
 
=== Manual pages ===
 
=== Manual pages ===
Line 158: Line 151:
 
== News ==
 
== News ==
  
''' New location for documentation '''
+
''' btrfs-progs v5.17 (Apr 2022) '''
  
The new place for documentation will be at https://btrfs.readthedocs.org or https://btrfs.rtfd.io , wiki contents is going to be migrated
+
* check:
 +
** repair wrong num_devices in superblock
 +
** recognize overly long xattr names
 +
** fix wrong total bytes check for seed device
 +
* auto-repair on read on RAID56
 +
* property set: unify handling of empty value to mean default, changed meaning for property 'compression' to allow reset to default and to set NOCOMPRESS, since kernel 5.14
 +
* fixes:
 +
** dump-tree: print fs-verity items
 +
** fix location of system chunk on zoned filesystem
 +
** do not allow setting seeding flag on a filesystem with dirty log
 +
** mkfs and subpage support: use sectorsize as nodesize fallback for mixed profiles
 +
* preparatory work for extent tree v2, global roots
 +
* experimental feature (unstable interface, not built by default, do not use for production): btrfstune: option --csum to switch checksum algorithm
 +
* other:
 +
** update documentation build, remove asciidocs leftovers
 +
** update fssum to consider xattrs
  
''' IRC channel at libera.chat '''
+
''' util-linux v2.38 (Apr 2022) '''
  
The #btrfs channel is at [https://libera.chat libera.chat], matrix.org bridge works (persistent room #btrfs:matrix.org).
+
blk* utilities and libraries finally recognize btrfs formatted with zoned mode
  
''' btrfs-progs v5.16 (Jan 2022) '''
+
''' linux v5.17 (Mar 2022) '''
* rescue: new subcommand clear-uuid-tree to fix failed mount due to bad uuid subvolume keys, caught by tree-checker                                                                                                                                                                           
+
* fi du: skip inaccessible files
+
* prop: properly resolve to symlink targets
+
* send, receive: fix crash after parent subvolume lookup errors
+
* build:
+
** fix build on 5.12+ kernels due to changes in linux/kernel.h
+
** fix build on musl with old kernel headers
+
* other:
+
** error handling fixes, cleanups, refactoring
+
** extent tree v2 preparatory work
+
** lots of RST documentation updates (last release with asciidoc sources), https://btrfs.readthedocs.io
+
  
''' linux v5.16 (Jan 2022) '''
+
Features:
 +
* make send work with concurrent block group relocation
 +
* new exclusive operation 'balance paused' to allow adding a device to filesystem with paused balance
 +
* new sysfs file for fsid stored in the per-device directory to help distinguish devices when seeding is enabled
  
Related projects: kernel port of zstd 1.4.10 also [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c8c109546a19613d323a319d0c921cb1f317e629 released] in 5.16
+
Performance:
 +
* less metadata needed for directory logging, directory deletion is 20-40% faster
 +
* in zoned mode, cache zone information during mount to speed up repeated queries (about 50% speedup)
 +
* free space tree entries get indexed and searched by size (latency -30%, search run time -30%)
 +
* less contention in tree node locking when inserting a key and no splits are needed (files/sec in fsmark improves by 1-20%)
  
Performance related:
+
Fixes:
* misc small inode logging improvements (+3% throughput, -11% latency on sample dbench workload)
+
* defrag rewrite from 5.16 fixed
* more efficient directory logging: bulk item insertion, less tree searches and locking
+
* get rid of warning when mounted with flushoncommit
* speed up bulk insertion of items into a b-tree, which is used when logging directories, when running delayed items for directories (fsync and transaction commits) and when running the slow path (full sync) of an fsync (bulk creation run time -4%, deletion -12%)
+
  
 
Core:
 
Core:
* continued subpage support
+
* global reserve stealing got simplified and cleaned up in evict
** make defragmentation work
+
* more preparatory work for extent tree v2
** make compression write work
+
* remove readahead framework
* zoned mode
+
** support ZNS (zoned namespaces), zone capacity is number of usable blocks in each zone
+
** add dedicated block group (zoned) for relocation, to prevent out of order writes in some cases
+
** greedy block group reclaim, pick the ones with least usable space first
+
* preparatory work for send protocol updates
+
 
* error handling improvements
 
* error handling improvements
* cleanups and refactoring
 
  
 
</div>
 
</div>
Line 253: Line 250:
 
=== Articles, presentations, podcasts ===
 
=== Articles, presentations, podcasts ===
  
 +
* [http://marc.merlins.org/perso/btrfs/post_2014-05-21_My-Btrfs-Talk-at-Linuxcon-JP-2014.html Marc MERLIN's Btrfs talk at Linuxcon JP 2014] which gives an overview of Btrfs, best practices, and its more interesting features.
 
* '''Article:''' [http://www.howtoforge.com/a-beginners-guide-to-btrfs A Beginner's Guide To Btrfs] (2012-11-26)
 
* '''Article:''' [http://www.howtoforge.com/a-beginners-guide-to-btrfs A Beginner's Guide To Btrfs] (2012-11-26)
 
* '''Article:''' [http://www.oracle.com/technetwork/articles/servers-storage-admin/advanced-btrfs-1734952.html How I Use the Advanced Capabilities of Btrfs] by Margaret Bierman with Lenz Grimmer (2012-08-11)
 
* '''Article:''' [http://www.oracle.com/technetwork/articles/servers-storage-admin/advanced-btrfs-1734952.html How I Use the Advanced Capabilities of Btrfs] by Margaret Bierman with Lenz Grimmer (2012-08-11)
Line 269: Line 267:
 
<!-- Project Block -->
 
<!-- Project Block -->
 
<div style="margin:0; margin-top:10px; border:1px solid #dfdfdf; padding: 0em 1em 1em 1em; background-color:#dfefdf; align:left; margin-top:10px">
 
<div style="margin:0; margin-top:10px; border:1px solid #dfdfdf; padding: 0em 1em 1em 1em; background-color:#dfefdf; align:left; margin-top:10px">
 +
 
== Project information/Contact ==
 
== Project information/Contact ==
  

Revision as of 14:30, 13 May 2022

btrfs

btrfs is a modern copy on write (CoW) filesystem for Linux aimed at implementing advanced features while also focusing on fault tolerance, repair and easy administration. Its main features and benefits are:

  • Snapshots which do not make the full copy of files
  • RAID - support for software-based RAID 0, RAID 1, RAID 10
  • Self-healing - checksums for data and metadata, automatic detection of silent data corruptions

Development of Btrfs started in 2007. Since that time, Btrfs is a part of the Linux kernel and is under active development.

Jointly developed at multiple companies, Btrfs is licensed under the GPL and open for contribution from anyone.

List of companies using btrfs in production.

Development and Issue Reporting

For feature status, please refer to the Status page.

The Btrfs code base is stable. However, new features are still under development. Every effort is made to ensure that it remains stable and fast at each and every commit. This rapid pace of development means that the filesystem improves noticeably with every new Linux release so it's highly recommended that users run the most modern kernel possible.

For benchmarks, it's recommended to test the latest stable Linux version, and not any older, as well as the latest Linux development versions. Also, it's recommended to test the various mount options such as different compression options.

If you find any behavior you suspect to be caused by a bug, performance issues, or have any questions about using Btrfs, please email the Btrfs mailing list (no subscription required). Please report bugs on Bugzilla.

Features

Linux has a wealth of filesystems from which to choose, but we are facing a number of challenges with scaling to the large storage subsystems that are becoming common in today's data centers. Filesystems need to scale in their ability to address and manage large storage, and also in their ability to detect, repair and tolerate errors in the data stored on disk.

Major Features Currently Implemented

  • Extent based file storage
  • 2^64 byte == 16 EiB maximum file size (practical limit is 8 EiB due to Linux VFS)
  • Space-efficient packing of small files
  • Space-efficient indexed directories
  • Dynamic inode allocation
  • Writable snapshots, read-only snapshots
  • Subvolumes (separate internal filesystem roots)
  • Checksums on data and metadata (crc32c, xxhash, sha256, blake2b)
  • Compression (ZLIB, LZO, ZSTD), heuristics
  • Integrated multiple device support
    • File Striping
    • File Mirroring
    • File Striping+Mirroring
    • Single and Dual Parity implementations (experimental, not production-ready)
  • SSD (flash storage) awareness
    • TRIM/Discard for reporting free blocks for reuse
    • Optimizations (e.g. avoiding unnecessary seek optimizations, sending writes in clusters, even if they are from unrelated files. This results in larger write operations and faster write throughput)
  • Background scrub process for finding and repairing errors of files with redundant copies
  • Online filesystem defragmentation
  • Offline filesystem check
  • In-place conversion of existing ext2/3/4 and reiserfs file systems
  • Seeding devices. Create a (readonly) filesystem that acts as a template to seed other Btrfs filesystems. The original filesystem and devices are included as a readonly starting point for the new filesystem. Using copy on write, all modifications are stored on different devices; the original is unchanged.
  • Subvolume-aware quota support
  • Send/receive of subvolume changes, efficient incremental filesystem mirroring and backup
  • Batch, or out-of-band deduplication (happens after writes, not during)
  • Swapfile support
  • Tree-checker, post-read and pre-write metadata verification
  • Zoned mode support (SMR/ZBC/ZNS friendly allocation)
  • fsverity integration

Features by kernel version

Features Currently in Development or Planned for Future Implementation

  • DAX/persistent memory support
  • The file/directory -level encryption support (fscrypt)

Documentation

Documentation

Guides and usage information

Manual pages

  • Original wiki documentation (obsolete, will be removed)

Developer documentation

  • Development setup - how to build btrfs from sources and prepare a development environment
  • Original COW B-tree: Source code in C that implements the COW B-tree algorithms repository. Written by Ohad Rodeh at IBM Research in 2006, and released under a BSD license. This is a reference implementation, that works in user space.
  • Unmerged features
    • In-band (write) time deduplication

News

btrfs-progs v5.17 (Apr 2022)

  • check:
    • repair wrong num_devices in superblock
    • recognize overly long xattr names
    • fix wrong total bytes check for seed device
  • auto-repair on read on RAID56
  • property set: unify handling of empty value to mean default, changed meaning for property 'compression' to allow reset to default and to set NOCOMPRESS, since kernel 5.14
  • fixes:
    • dump-tree: print fs-verity items
    • fix location of system chunk on zoned filesystem
    • do not allow setting seeding flag on a filesystem with dirty log
    • mkfs and subpage support: use sectorsize as nodesize fallback for mixed profiles
  • preparatory work for extent tree v2, global roots
  • experimental feature (unstable interface, not built by default, do not use for production): btrfstune: option --csum to switch checksum algorithm
  • other:
    • update documentation build, remove asciidocs leftovers
    • update fssum to consider xattrs

util-linux v2.38 (Apr 2022)

blk* utilities and libraries finally recognize btrfs formatted with zoned mode

linux v5.17 (Mar 2022)

Features:

  • make send work with concurrent block group relocation
  • new exclusive operation 'balance paused' to allow adding a device to filesystem with paused balance
  • new sysfs file for fsid stored in the per-device directory to help distinguish devices when seeding is enabled

Performance:

  • less metadata needed for directory logging, directory deletion is 20-40% faster
  • in zoned mode, cache zone information during mount to speed up repeated queries (about 50% speedup)
  • free space tree entries get indexed and searched by size (latency -30%, search run time -30%)
  • less contention in tree node locking when inserting a key and no splits are needed (files/sec in fsmark improves by 1-20%)

Fixes:

  • defrag rewrite from 5.16 fixed
  • get rid of warning when mounted with flushoncommit

Core:

  • global reserve stealing got simplified and cleaned up in evict
  • more preparatory work for extent tree v2
  • remove readahead framework
  • error handling improvements

Source code download

Btrfs source repositories describes purpose and contents, here are a few quick links:

Articles, presentations, podcasts

Historical resources

Links to old or obsolete documentation, articles. Kept for historical reasons. Stuff that's more than 3 years old.

Articles, presentations, podcasts

Project information/Contact

Wiki accounts, editing

The wiki contributions are welcome! Please create an account and wait for approval (this is a necessary spam protection and we cannot remove it). You can try to catch some of the wiki admins on IRC (or ping user 'kdave' in a query) to expedite the account creation.

The registration requires full name for account but it's not mandatory from our perspective. The wiki User and User talk pages are created automatically but removed after account is approved. If you want to use the pages, create them manually, they won't be deleted.

Personal tools