bcachefs
Manage and create Bcachefs filesystems
TLDR
Format a partition with bcachefs
Mount a bcachefs filesystem
Create a RAID 0 filesystem where an SSD acts as a cache and an HDD acts as a long-term storage
Mount a multidevice filesystem
Display disk usage
Set replicas after formatting and mounting
Force bcachefs to ensure all files are replicated
Create a snapshot of a particular directory
SYNOPSIS
bcachefs subcommand [options] [arguments]
PARAMETERS
format
Create a new bcachefs filesystem on one or more devices.
Example: bcachefs format /dev/sda1 /dev/sdb1
fs
Manage general filesystem properties and internal components.
Example: bcachefs fs set /mnt/myfs compression=zstd
device
Manage individual devices within a bcachefs filesystem (e.g., add, remove, resize).
Example: bcachefs device add /mnt/myfs /dev/sdc1
snapshot
Create, list, or delete snapshots of a bcachefs filesystem.
Example: bcachefs snapshot create /mnt/myfs /mnt/myfs/.snapshots/today
quota
Manage and display disk usage quotas for users or groups.
Example: bcachefs quota enable /mnt/myfs
repair
Attempt to repair a damaged bcachefs filesystem, often used after unclean shutdowns.
Example: bcachefs repair /dev/sdd1
scrub
Initiate a background scrub (checksum validation and repair) of the filesystem data.
Example: bcachefs scrub start /mnt/myfs
balance
Rebalance data across devices in a bcachefs filesystem, useful after adding or removing devices.
Example: bcachefs balance start /mnt/myfs
status
Display information and status of bcachefs filesystems, including device health and usage.
Example: bcachefs status
mount
Mount a bcachefs filesystem.
Note: Typically, the standard mount(8)
command is used for this, but `bcachefs mount` can also be used for convenience.
help
Display help for `bcachefs` or a specific subcommand.
Example: bcachefs help format
DESCRIPTION
bcachefs is a modern, copy-on-write (COW) Linux filesystem that aims to combine the best features of btrfs and ZFS with high performance. It's built on the bcache block layer caching technology, expanding it into a full-fledged filesystem. It supports advanced features such as snapshots, data integrity (checksumming), data replication/erasure coding, caching (multiple tiers of storage), and online resizing. bcachefs is designed to be highly scalable and robust, suitable for various workloads from desktop to server environments, offering both flexibility and resilience.
The `bcachefs` command-line utility serves as the primary interface for managing and interacting with bcachefs filesystems. It provides a comprehensive set of subcommands to perform tasks like filesystem creation, device management (adding/removing devices), snapshot administration, setting filesystem properties (e.g., compression, caching policies), initiating data scrubs, balancing data, and checking the overall status of bcachefs pools. This integrated command simplifies the administration of complex bcachefs setups.
CAVEATS
bcachefs, while robust and feature-rich, is a relatively new filesystem in the Linux kernel mainline (merged in 6.7). Its development is ongoing, and while generally stable, it might still have bugs or design changes. Users should exercise caution and ensure proper backups for critical data, especially in early adoption scenarios. Recovery tools and extensive long-term stability data may be less mature compared to older, more established filesystems like Ext4 or XFS.
KEY FEATURES
bcachefs boasts a comprehensive set of features including:
- Copy-on-Write (COW) architecture for data integrity and snapshots.
- Multiple device support, allowing creation of filesystems spanning multiple disks.
- Data checksumming (CRC64) for detecting corruption.
- Flexible caching tiers for performance optimization (e.g., SSD for cache, HDD for bulk storage).
- Data replication and erasure coding for redundancy.
- Compression support (zstd, lz4).
- Snapshots and subvolumes.
- Online resizing and rebalancing.
- Quotas for users and groups.
PERFORMANCE CHARACTERISTICS
Designed from the ground up for performance, bcachefs leverages its underlying `bcache` technology for efficient metadata and data handling. It aims to offer high I/O throughput and low latency, making it suitable for demanding workloads. Its multi-tier caching capabilities allow users to optimize performance by utilizing faster storage devices for hot data.
HISTORY
bcachefs was developed by Kent Overstreet, the creator of the original `bcache` block layer caching system. Development began around 2012, aiming to build a full-fledged filesystem on top of the efficient `bcache` B+tree implementation. It represents a significant effort to combine the advanced features of copy-on-write filesystems like btrfs and ZFS with high performance and scalability. After years of development and testing, bcachefs was officially merged into the Linux kernel mainline in version 6.7 in late 2023 / early 2024, marking its readiness for wider adoption.