.Dd November 17, 2023 .Dt BCACHEFS 8 SMM .Os .Sh NAME .Nm bcachefs .Nd manage bcachefs filesystems/devices .Sh SYNOPSIS .Nm .Ar command .Op Ar options .Op Ar arguments .Sh DESCRIPTION The .Nm utility supports the following subcommands, which are documented in detail below: .Ss Superblock commands .Bl -tag -width 18n -compact .It Ic format Format one or a list of devices with bcachefs data structures. .It Ic show-super Dump superblock information to stdout. .It Ic set-fs-option Set a filesystem option .El .Ss Mount commands .Bl -tag -width 18n -compact .It Ic mount Mount a filesystem. .El .Ss Repair commands .Bl -tag -width 18n -compact .It Ic fsck Check an existing filesystem for errors. .El .Ss Commands for managing a running filesystem .Bl -tag -width 18n -compact .It Ic fs usage Show disk usage .It Ic fs top Show runtime performance information .El .Ss Commands for managing devices within a running filesystem .Bl -tag -width 22n -compact .It Ic device add Add a new device to an existing filesystem .It Ic device remove Remove a device from an existing filesystem .It Ic device online Re-add an existing member to a filesystem .It Ic device offline Take a device offline, without removing it .It Ic device evacuate Migrate data off of a specific device .It Ic device set-state Set a device state .It Ic device resize Resize filesystem on a device .It Ic device resize-journal Resize journal on a device .El .Ss Commands for managing subvolumes and snapshots .Bl -tag -width 18n -compact .It Ic subvolume create Create a new subvolume .It Ic subvolume delete Delete an existing subvolume .It Ic subvolume snapshot Create a snapshot .It Ic subvolume list List subvolumes .It Ic subvolume list-snapshots List snapshots and their disk usage .El .Ss Commands for managing filesystem data .Bl -tag -width 18n -compact .It Ic reconcile Query or wait for background data reconciliation .It Ic scrub Verify data checksums .El .Ss Commands for encryption .Bl -tag -width 18n -compact .It Ic unlock Unlock an encrypted filesystem prior to running/mounting .It Ic set-passphrase Change passphrase on an existing (unmounted) filesystem .It Ic remove-passphrase Remove passphrase on an existing (unmounted) filesystem .El .Ss Commands for migration .Bl -tag -width 18n -compact .It Ic migrate Migrate an existing filesystem to bcachefs, in place .It Ic migrate-superblock Add default superblock, after bcachefs migrate .El .Ss Commands for operating on files in a bcachefs filesystem .Bl -tag -width 18n -compact .It Ic set-file-option Set various per file attributes .El .Ss Commands for debugging .Bl -tag -width 18n -compact .It Ic dump Dump filesystem metadata to a qcow2 image .It Ic list List filesystem metadata in textual form .It Ic list_journal List contents of journal .El .Ss FUSE commands .Bl -tag -width 18n -compact .It Ic fusemount Mount a filesystem via FUSE .El .Ss Miscellaneous commands .Bl -tag -width 18n -compact .It Ic version Display the version of the invoked bcachefs tool .It Ic completions Generate shell completions .El .Sh Superblock commands .Bl -tag -width Ds .It Nm Ic format Oo Ar options Oc Ar devices\ ... Format one or a list of devices with bcachefs data structures. You need to do this before you create a volume. .Pp Device specific options must come before corresponding devices, e.g. .Dl bcachefs format --label=ssd /dev/sda --label=hdd /dev/sdb .Bl -tag -width Ds .It Fl -block_size Ns = Ns Ar size block size, in bytes (e.g. 4k) .It Fl -btree_node_size Ns = Ns Ar size Btree node size, default 256k .It Fl -errors Ns = Ns ( Cm continue | ro | panic ) Action to take on filesystem error .It Fl -data_replicas Ns = Ns Ar number Number of data replicas. With erasure coding enabled, this is currently capped at .Ar 3 .Pq RAID6 . .It Fl -metadata_replicas Ns = Ns Ar number Number of metadata replicas .It Fl -encoded_extent_max Ns = Ns Ar size Maximum size of checksummed/compressed extents .It Fl -metadata_checksum Ns = Ns ( Cm none | crc32c | crc64 | xxhash ) Set metadata checksum type (default: .Cm crc32c ) . .It Fl -data_checksum Ns = Ns ( Cm none | crc32c | crc64 | xxhash ) Set data checksum type (default: .Cm crc32c ) . .It Fl -compression Ns = Ns ( Cm none | lz4 | gzip | zstd ) Set compression type (default: .Cm none ) . .It Fl -background_compression Ns = Ns ( Cm none | lz4 | gzip | zstd ) .It Fl -str_hash Ns = Ns ( Cm crc32c | crc64 | siphash ) Hash function for directory entries and xattrs .It Fl -metadata_target Ns = Ns Ar target Device or label for metadata writes .It Fl -foreground_target Ns = Ns Ar target Device or label for foreground writes .It Fl -background_target Ns = Ns Ar target Device or label to move data to in the background .It Fl -promote_target Ns = Ns Ar target Device or label to promote data to on read .It Fl -erasure_code Enable erasure coding (RAID5/6; data replicas are capped at 3) .It Fl -inodes_32bit Constrain inode numbers to 32 bits .It Fl -shared_inode_numbers Shared new inode numbers by CPU id .It Fl -inodes_use_key_cache Use the btree key cache for the inodes btree .It Fl -gc_reserve_percent Ns = Ns Ar percentage Percentage of disk space to reserve for copygc .It Fl -gc_reserve_bytes Ns = Ns Ar percentage Amount of disk space to reserve for copygc .sp This takes precedence over .Cm gc_reserve_percent if set .It Fl -root_reserve_percent Ns = Ns Ar percentage Percentage of disk space to reserve for superuser .It Fl -wide_macs Store full 128bits of cryptographic MACS, instead of 80 .It Fl -acl Enable POSIX acls .It Fl -usrquota Enable user quotas .It Fl -grpquota Enable group quotas .It Fl -prjquota Enable project quotas .It Fl -journal_transaction_names Log transaction function names in journal .It Fl -nocow Nocow mode: Writes will be done in place when possible. .sp Snapshots and reflink will still cause writes to be COW. .sp This flag implicitly disables data checksumming, compression and encryption. .It Fl -replicas Ns = Ns Ar number Sets both data and metadata replicas. .It Fl -encrypted Enable whole filesystem encryption (chacha20/poly1305); passphrase will be prompted for. .It Fl -no_passphrase Store master encryption key unencrypted in superblock .It Fl L , Fl -fs_label Ns = Ns Ar label Create the filesystem with the specified .Ar label This is the filesystem label, distinct from per-device labels used for target selection. On a mounted filesystem it can be changed by tools that issue the standard Linux .Dv FS_IOC_SETFSLABEL ioctl. .It Fl U , Fl -uuid Ns = Ns Ar uuid Create the filesystem with the specified .Ar uuid .It Fl -superblock_size Ns = Ns Ar size .El .Pp Device specific options: .Bl -tag -width Ds .It Fl -discard Enable discard/TRIM support .It Fl -fs_size Ns = Ns Ar size Create the filesystem using .Ar size bytes on the subsequent device. .It Fl -bucket Ns = Ns Ar size Specifies the bucket size; must be greater than the btree node size .It Fl -durability Ns = Ns Ar n Data written to this device will be considered to have already been replicated .Ar n times .It Fl l , Fl -label Disk label .It Fl f , Fl -force Force the filesystem to be created, even if the device already contains a filesystem. .It Fl q , Fl -quiet Only print errors .It Fl v , Fl -verbose Verbose filesystem initialization .El .It Nm Ic show-super Oo Ar options Oc Ar device Dump superblock information to stdout. .Bl -tag -width Ds .It Fl f , Fl -fields Ns = Ns Ar fields List of sections to print .It Fl l , Fl -layout Print superblock layout .El .It Nm Ic set-fs-option Oo Ar options Oc Ar device .Bl -tag -width Ds .It Fl -errors Ns = Ns ( Cm continue | ro | panic ) Action to take on filesystem error .It Fl -metadata_replicas Ns = Ns Ar number Number of metadata replicas .It Fl -data_replicas Ns = Ns Ar number Number of data replicas. With erasure coding enabled, this is currently capped at .Ar 3 .Pq RAID6 . .It Fl -metadata_checksum Ns = Ns ( Cm none | crc32c | crc64 | xxhash ) Set metadata checksum type (default: .Cm crc32c ) . .It Fl -data_checksum Ns = Ns ( Cm none | crc32c | crc64 | xxhash ) Set data checksum type (default: .Cm crc32c ) . .It Fl -compression Ns = Ns ( Cm none | lz4 | gzip | zstd ) Set compression type (default: .Cm none ) . .It Fl -background_compression Ns = Ns ( Cm none | lz4 | gzip | zstd ) .It Fl -str_hash Ns = Ns ( Cm crc32c | crc64 | siphash ) Hash function for directory entries and xattrs .It Fl -metadata_target Ns = Ns Ar target Device or label for metadata writes .It Fl -foreground_target Ns = Ns Ar target Device or label for foreground writes .It Fl -background_target Ns = Ns Ar target Device or label to move data to in the background .It Fl -promote_target Ns = Ns Ar target Device or label to promote data to on read .It Fl -erasure_code Enable erasure coding (RAID5/6; data replicas are capped at 3) .It Fl -inodes_32bit Constrain inode numbers to 32 bits .It Fl -shared_inode_numbers Shared new inode numbers by CPU id .It Fl -inodes_use_key_cache Use the btree key cache for the inodes btree .It Fl -gc_reserve_percent Ns = Ns Ar percentage Percentage of disk space to reserve for copygc .It Fl -gc_reserve_bytes Ns = Ns Ar percentage Amount of disk space to reserve for copygc .sp This takes precedence over .Cm gc_reserve_percent if set .It Fl -root_reserve_percent Ns = Ns Ar percentage Percentage of disk space to reserve for superuser .It Fl -wide_macs Store full 128bits of cryptographic MACS, instead of 80 .It Fl -acl Enable POSIX acls .It Fl -usrquota Enable user quotas .It Fl -grpquota Enable group quotas .It Fl -prjquota Enable project quotas .It Fl -degraded Allow mounting in degraded mode .It Fl -very_degraded Allow mounting in when data will be missing .It Fl -discard Enable discard/TRIM support .It Fl -verbose Extra debugging information during mount/recovery .It Fl -journal_flush_delay Ns = Ns Ar ms Delay in milliseconds before automatic journal commits .It Fl -journal_flush_disabled Disable journal flush on sync/fsync .sp If enabled, writes can be lost, but only since the last journal write (default 1 second) .It Fl -journal_reclaim_delay Ns = Ns Ar ms Delay in milliseconds before automatic journal reclaim .It Fl -move_bytes_in_flight Ns = Ns Ar bytes Maximum Amount of IO to keep in flight by the move path .It Fl -move_ios_in_flight Ns = Ns Ar number Maximum number of IOs to keep in flight by the move path .It Fl -fsck Run fsck on mount .It Fl -fix_errors Ns = Ns Ar error Fix errors during fsck without asking .It Fl -ratelimit_errors Ratelimit error messages during fsck .It Fl -nochanges Super read only mode - no writes at all will be issued, even if we have to replay the journal .It Fl -norecovery Don't replay the journal .It Fl -journal_transaction_names Log transaction function names in journal .It Fl -noexcl Don't open device in exclusive mode .It Fl -direct_io Use O_DIRECT (userspace only) .It Fl -sb Ns = Ns Ar offset Sector offset of superblock .It Fl -reconstruct_alloc Reconstruct alloc btree .It Fl -version_upgrade Ns = Ns ( Cm compatible | incompatible | none ) Set superblock to latest version, allowing any new features to be used .Pp .Cm compatible is the default: compatible metadata upgrades may be applied automatically, and the filesystem may still downgrade those compatible version fields when mounted by an older kernel. Use .Cm incompatible only for an intentional one-way metadata upgrade that may prevent mounting with older kernels, and use .Cm none to avoid optional version upgrades. .It Fl -nocow Nocow mode: Writes will be done in place when possible. .sp Snapshots and reflink will still cause writes to be COW. .sp This flag implicitly disables data checksumming, compression and encryption. .It Fl -nocow_enabled Enable nocow mode: enables runtime locking in data move path needed if nocow will ever be in use .It Fl -no_data_io Skip submit_bio() for data reads and writes, for performance testing purposes .El .El .Sh Mount commands .Bl -tag -width Ds .It Nm Ic mount Oo Ar options Oc Ar device mountpoint The .Ic mount Fl t Cm bcachefs path invokes the installed .Nm mount.bcachefs helper; this is the same mount path exposed as .Nm Ic mount . .Pp Mount a filesystem. The .Ar device can be a device, a colon-separated list of devices, UUID=, OLD_BLKID_UUID=, or LABEL=