mkfs.bcachefs
Create a new bcachefs filesystem
TLDR
Create a bcachefs filesystem inside partition Y on a device X
Create a bcachefs filesystem with a volume label
SYNOPSIS
mkfs.bcachefs [options] device...
PARAMETERS
--label=
Set the label for the filesystem. It must be unique.
--data_replicas=
Set the number of data replicas.
1: RAID0-like.
2: RAID1-like.
3: RAID1E-like.
--metadata_replicas=
Set the number of metadata replicas (default: 3).
--compression=
Enable compression with specified algorithm (e.g., lz4, zstd).
--encryption=
Enable encryption with specified algorithm (e.g., aes-xts).
--inodes=
Specify the number of inodes to create.
--background_gc
Enables the bcachefs background garbage collector.
device...
One or more block devices to include in the new filesystem.
--sectorsize=
Set the sector size for the filesystem.
DESCRIPTION
mkfs.bcachefs is a tool used to create a bcachefs filesystem on a device or set of devices.
Bcachefs is a copy-on-write (CoW) filesystem designed for performance and advanced features such as compression, encryption, and multiple device support, including tiering. It enables users to combine fast storage devices (like SSDs) with slower, higher-capacity devices (like HDDs) to create a storage system that balances speed and capacity efficiently. mkfs.bcachefs handles the initial formatting of the devices, setting up the necessary metadata structures and enabling the filesystem to be mounted and used.
It is used primarily for initial setup or when wiping and re-creating a filesystem. It is able to configure various parameters of the bcachefs filesystem, to optimize it to its specific intended use case.
CAVEATS
Formatting a device will destroy all existing data on it. Make sure to backup any important data before running mkfs.bcachefs.
EXAMPLE USAGE
To create a bcachefs filesystem on /dev/sda and /dev/sdb with RAID1 and lz4 compression:
mkfs.bcachefs --data_replicas=2 --compression=lz4 /dev/sda /dev/sdb
ERROR REPORTING
Errors encountered during filesystem creation are typically printed to standard error. Consult system logs for more detailed information.
HISTORY
Bcachefs is a relatively new filesystem designed to address the limitations of older filesystems with modern storage devices. It has been under development for several years, focusing on performance, reliability, and advanced features. The mkfs.bcachefs command is a crucial part of its ecosystem, enabling users to create and manage bcachefs filesystems.