BCACHEFS(8)
π BCACHEFS β the manual, but make it a group chat π
okay bestie, so you've met bcachefs (it's the command-line tool for the bcachefs filesystem, and it is lowkey iconic) and now you need the actual manual. This is that. Every command, every category, nothing skipped, everything explained like I actually want you to get it. Periodt. π
πΈ SYNOPSIS πΈ
bcachefs command [options] [arguments]
That's the whole vibe: you pick a command, you toss it some options, you hand it some arguments. Slay.
β¨ DESCRIPTION β¨
The bcachefs utility supports all of these subcommands, and every single one of them gets documented in detail below. Buckle in, bestie, there's a lot and it's all here. π¦
π Superblock commands
These are the "before anything else exists" commands. Superblock girlies, rise.
formatβ Format one device, or a whole list of devices, with bcachefs data structures. Fresh start energy. β¨show-superβ Dump superblock information to stdout. Just, like, reading the superblock's diary. πset-fs-optionβ Set a filesystem option. Tweak it, bestie.
π Mount commands
mountβ Mount a filesystem. Yeah, that one. The main character.
π©Ή Repair commands
fsckβ Check an existing filesystem for errors. It's giving doctor's appointment. π
π§ Commands for managing a running filesystem
For when the filesystem is already up and living its life:
fs usageβ Show disk usage. How much room do we have, fr fr? πfs topβ Show runtime performance information. It's literallytopbut for your fs.
π Commands for managing devices within a running filesystem
Devices coming and going, no drama (hopefully):
device addβ Add a new device to an existing filesystem. Welcome to the family π«Άdevice removeβ Remove a device from an existing filesystem. It's not you, it's capacity planning.device onlineβ Re-add an existing member to a filesystem. She's back πdevice offlineβ Take a device offline, without removing it. Pause, not delete.device evacuateβ Migrate data off of a specific device. Empty her out, gently.device set-stateβ Change the state of a device. Vibe check, but make it stateful.device resizeβ Resize filesystem on a device. Grow up πdevice resize-journalβ Resize journal on a device. The journal also gets to grow.
π Commands for managing subvolumes and snapshots
subvolume createβ Create a new subvolume. Baby subvolume, born today π£subvolume deleteβ Delete an existing subvolume. Bye bestie πsubvolume snapshotβ Create a snapshot. Freeze frame, iconic β¨
π Commands for managing filesystem data
data rereplicateβ Rereplicate degraded data. Fixing what got sad. π₯data jobβ Kick off low level data jobs. Get in, we're going low level.
π Commands for encryption
Locked down, keys out, no cap:
unlockβ Unlock an encrypted filesystem prior to running/mounting it. The key moment (literally). πset-passphraseβ Change passphrase on an existing (unmounted) filesystem. Note: unmounted, bestie.remove-passphraseβ Remove passphrase on an existing (unmounted) filesystem. Again: unmounted. π
π Commands for migration
migrateβ Migrate an existing filesystem to bcachefs, in place. No copy-paste, just glow-up in position.migrate-superblockβ Add default superblock, afterbcachefs migrate. The little follow-up step.
π Commands for operating on files in a bcachefs filesystem
set-file-optionβ Set various per file attributes. Yes, per file. So specific. So cute.
π Commands for debugging
For when you're in your detective era:
dumpβ Dump filesystem metadata to a qcow2 image. πΌοΈlistβ List filesystem metadata in textual form. Words, not images.list_journalβ List contents of journal. Yes, with the underscore, exactly like that.
π¦ FUSE commands
fusemountβ Mount a filesystem via FUSE.
β Miscellaneous commands
The catch-all bin, and honestly both of these ate:
versionβ Display the version of the invokedbcachefstool.completionsβ Generate shell completions. Tab-tab-tab supremacy π
okay that's part one!! more parts coming, don't go anywhere bestie π«Ά
ποΈ Superblock commands ποΈ
ok so this is where the actual β¨doing stuffβ¨ happens, bestie. buckle up π
bcachefs format [options] devices ...
this is the glow-up moment for your disks π it formats one device, or a whole lil squad of them, with bcachefs data structures. you gotta do this before you can create a volume. it's like the primer before the foundation, no cap.
device-specific options have to come BEFORE their corresponding device, like this:
bcachefs format --label=ssd /dev/sda --label=hdd /dev/sdb
so yeah, order matters here fr fr π
--block_size=sizeβ the block size, in bytes (so like,4k)--btree_node_size=sizeβ btree node size, defaults to256k--errors=(continue | ro | panic)β what it does when the filesystem hits an error--data_replicas=numberβ how many copies of your data you want floating around--metadata_replicas=numberβ how many copies of your metadata--data_replicas_required=numberβ the minimum data replicas you need to keep the thing happy--metadata_replicas_required=numberβ same energy, but for metadata--encoded_extent_max=sizeβ maximum size of checksummed/compressed extents--metadata_checksum=(none | crc32c | crc64 | xxhash)β pick your metadata checksum type (default:crc32c)--data_checksum=(none | crc32c | crc64 | xxhash)β pick your data checksum type (default:crc32c)--compression=(none | lz4 | gzip | zstd)β set the compression type (default:none)--background_compression=(none | lz4 | gzip | zstd)β compression for the background stuff π«Ά--str_hash=(crc32c | crc64 | siphash)β the hash function for directory entries and xattrs--metadata_target=targetβ which device or label gets the metadata writes--foreground_target=targetβ which device or label gets the foreground writes--background_target=targetβ which device or label data gets moved to in the background--promote_target=targetβ which device or label data gets promoted to on read--erasure_codeβ enable erasure coding (DO NOT USE YET, seriously, do not, it's giving β οΈ)--inodes_32bitβ keep inode numbers squished into 32 bits--shared_inode_numbersβ share new inode numbers by CPU id--inodes_use_key_cacheβ use the btree key cache for the inodes btree--gc_reserve_percent=percentageβ percentage of disk space reserved for copygc--gc_reserve_bytes=percentageβ amount of disk space reserved for copygc. heads up: this one takes precedence overgc_reserve_percentif it's set π--root_reserve_percent=percentageβ percentage of disk space reserved for the superuser--wide_macsβ store the full 128bits of cryptographic MACS, instead of 80--aclβ enable POSIX acls--usrquotaβ enable user quotas--grpquotaβ enable group quotas--prjquotaβ enable project quotas--journal_transaction_namesβ log transaction function names in the journal--nocowβ nocow mode: writes get done in place when possible. but lowkey, snapshots and reflink will still cause writes to be COW. and this flag implicitly disables data checksumming, compression and encryption π«--replicas=numberβ sets both data and metadata replicas at once, slay--encryptedβ enable whole filesystem encryption (chacha20/poly1305); it'll prompt you for a passphrase--no_passphraseβ don't encrypt the master encryption key-L,--fs_label=labelβ create the filesystem with the label you specify-U,--uuid=uuidβ create the filesystem with the uuid you specify--superblock_size=sizeβ sets the superblock size
π§ Device specific options:
these ones are per-device, so remember β they go before the device they belong to π
--discardβ enable discard/TRIM support--fs_size=sizeβ create the filesystem usingsizebytes on the device that comes next--bucket=sizeβ specifies the bucket size; it's gotta be greater than the btree node size--durability=nβ data written to this device counts as already having been replicatedntimes-l,--labelβ disk label-f,--forceβ force the filesystem to be created, even if the device already has a filesystem on it π³-q,--quietβ only print errors-v,--verboseβ verbose filesystem initialization
bcachefs show-super [options] device
dumps superblock info straight to stdout. it's the β¨look at meβ¨ command, we love a peek behind the curtain π¦
-f,--fields=fieldsβ list of sections to print-l,--layoutβ print the superblock layout
bcachefs set-fs-option [options] device
ok so this one tweaks your filesystem options after the fact. huge main character energy π
--errors=(continue | ro | panic)β action to take on filesystem error--metadata_replicas=numberβ number of metadata replicas--data_replicas=numberβ number of data replicas--metadata_replicas_required=numberβ minimum metadata replicas required--data_replicas_required=numberβ minimum data replicas required--metadata_checksum=(none | crc32c | crc64 | xxhash)β set metadata checksum type (default:crc32c)--data_checksum=(none | crc32c | crc64 | xxhash)β set data checksum type (default:crc32c)--compression=(none | lz4 | gzip | zstd)β set compression type (default:none)--background_compression=(none | lz4 | gzip | zstd)β compression for background writes--str_hash=(crc32c | crc64 | siphash)β hash function for directory entries and xattrs--metadata_target=targetβ device or label for metadata writes--foreground_target=targetβ device or label for foreground writes--background_target=targetβ device or label to move data to in the background--promote_target=targetβ device or label to promote data to on read--erasure_codeβ enable erasure coding (DO NOT USE YET π)--inodes_32bitβ constrain inode numbers to 32 bits--shared_inode_numbersβ shared new inode numbers by CPU id--inodes_use_key_cacheβ use the btree key cache for the inodes btree--gc_reserve_percent=percentageβ percentage of disk space to reserve for copygc--gc_reserve_bytes=percentageβ amount of disk space to reserve for copygc. this takes precedence overgc_reserve_percentif it's set β¨--root_reserve_percent=percentageβ percentage of disk space to reserve for superuser--wide_macsβ store full 128bits of cryptographic MACS, instead of 80--aclβ enable POSIX acls--usrquotaβ enable user quotas--grpquotaβ enable group quotas--prjquotaβ enable project quotas--degradedβ allow mounting in degraded mode--very_degradedβ allow mounting when data will be missing π--discardβ enable discard/TRIM support--verboseβ extra debugging information during mount/recovery--journal_flush_delay=msβ delay in milliseconds before automatic journal commits--journal_flush_disabledβ disable journal flush on sync/fsync. if enabled, writes can be lost, but only since the last journal write (default 1 second) π¬--journal_reclaim_delay=msβ delay in milliseconds before automatic journal reclaim--move_bytes_in_flight=bytesβ maximum amount of IO to keep in flight by the move path--move_ios_in_flight=numberβ maximum number of IOs to keep in flight by the move path--fsckβ run fsck on mount--fix_errors=errorβ fix errors during fsck without asking--ratelimit_errorsβ ratelimit error messages during fsck--nochangesβ super read only mode: no writes at all will be issued, even if we have to replay the journal--norecoveryβ don't replay the journal--journal_transaction_namesβ log transaction function names in journal--noexclβ don't open device in exclusive mode--direct_ioβ useO_DIRECT(userspace only)--sb=offsetβ sector offset of superblock--reconstruct_allocβ reconstruct alloc btree--version_upgrade=(compatible | incompatible | none)β set superblock to latest version, allowing any new features to be used--nocowβ nocow mode: writes will be done in place when possible. snapshots and reflink will still cause writes to be COW. this flag implicitly disables data checksumming, compression and encryption π--nocow_enabledβ enable nocow mode: enables runtime locking in data move path needed if nocow will ever be in use--no_data_ioβ skipsubmit_bio()for data reads and writes, for performance testing purposes
ngl bestie, a couple of these are straight up "do not touch yet" territory and a couple will quietly turn off your checksumming/compression/encryption. read before you yeet a flag at your disk, iykyk π
ποΈ Mount commands
bcachefs mount [options] device mountpoint
Okay bestie, this is THE one. Mounting a filesystem, the main character moment. π
The device can be a single device, a colon-separated list of devices, or UUID=<UUID>. The mountpoint is where it's gonna live in your file tree. And here's a lil plot twist β if you don't set a mountpoint, the filesystem doesn't actually get mounted, but everything before the mounting still happens (like, say, asking you for your passphrase). So it's a rehearsal. A dress rehearsal. π
-ooptions β mount options as a comma-separated list, fr. The user guide has the complete list, but here are the hits:degradedβ allow mounting with data degraded (some copies missing, she's still standing π«Ά)verboseβ extra debugging info during mount/recoveryfsckβ run fsck during mountfix_errorsβ fix errors without asking during fsckread_onlyβ mount in read only modeversion_upgrade
-k,--key-location=(fail | wait | ask)β where the password would be loaded from. Default isask.failβ don't ask for a password, just fail if the filesystem is encryptedwaitβ wait for the password to become available before mountingaskβ prompt the user for a password
-c,--colorize=(true | false)β force color on or off. Default: auto-detect TTY.-vβ be verbose. Can be specified more than once, so go off. π’
π§ Repair commands
bcachefs fsck [options] devices ...
Check an existing filesystem for errors. The glow-up check-up. β¨
-pβ automatic repair (no questions)-nβ don't repair, only check for errors-yβ assume "yes" to all questions-fβ force checking even if the filesystem is marked clean-r,--ratelimit_errorsβ don't display more than 10 errors of a given type-R,--reconstruct_allocβ reconstruct the alloc btree-vβ be verbose
π Commands for managing a running filesystem
bcachefs fs usage [options] [filesystem]
Show disk usage. The "how much room do I have left" vibe check. π
-h,--human-readableβ print human readable sizes
πΎ Commands for managing devices within a running filesystem
bcachefs device add [options] device
Add a device to an existing filesystem. New friend joining the group chat. π«Ά
--fs_size=sizeβ size of filesystem on device--bucket=sizeβ set bucket size--discardβ enable discards-l,--label=labelβ disk label-f,--forceβ use device even if it appears to already be formatted
bcachefs device remove [options] device
Remove a device from a filesystem. Bestie is leaving, we're sad. π
-f,--forceβ force removal, even if some data couldn't be migrated-F,--force-metadataβ force removal, even if some metadata couldn't be migrated
ngl those two are the "I know what I'm doing" buttons. Read them twice, babes.
bcachefs device online device
Re-add a device to a running filesystem. She's back!! π
bcachefs device offline device
Take a device offline, without removing it. A lil nap, not a goodbye. π€
-f,--forceβ force, if data redundancy will be degraded
bcachefs device evacuate device
Move data off of a given device. Everybody out, we're relocating. π
bcachefs device set-state [options] new-state device
- new-state =
rw|ro|failed|spare -f,--forceβ force, if data redundancy will be degraded--force-if-data-lostβ force, if data will be lost-o,--offlineβ set state of an offline device
--force-if-data-lost is literally what it says on the tin. Data. Lost. Be so fr with yourself before typing that.
bcachefs device resize device [size]
Resize filesystem on a device. β¨glow upβ¨
bcachefs device resize-journal device [size]
Resize journal on a device.
πΈ Commands for managing subvolumes and snapshots
subvolume create [options] path
Create a new subvolume. New baby subvolume, welcome to the world π
subvolume delete [options] path
Delete an existing subvolume.
subvolume snapshot [options] source dest
Create a snapshot of source at dest. If source is specified, it must be a subvolume; if it's not specified, the snapshot will be of the subvolume containing dest.
-rβ make snapshot read-only
ποΈ Commands for managing filesystem data
bcachefs data rereplicate filesystem
Walks existing data in a filesystem, writing additional copies of any degraded data. She's out here restoring the missing copies, doing the work nobody asked her to do but she showed up anyway. πͺ
bcachefs data job job filesystem
Kick off a data job and report progress.
job is one of (scrub | rereplicate | migrate | rewrite_old_nodes)
-bbtree β btree to operate on-sinode:offset β start position-einode:offset β end position
π Commands for encryption
bcachefs unlock device
Unlock an encrypted filesystem prior to running/mounting. Speak the magic word, bestie ποΈ
-cβ check if a device is encrypted-k=(session | user | user_session)β keyring to add to (default:user)
bcachefs set-passphrase devices ...
Change passphrase on an existing (unmounted) filesystem.
bcachefs remove-passphrase devices ...
Remove passphrase on an existing (unmounted) filesystem.
π Commands for migration
bcachefs migrate [options] device
Migrate an existing filesystem to bcachefs. The rebrand. The era change. π¦
-ffs β root of filesystem to migrate--encryptedβ enable whole filesystem encryption (chacha20/poly1305)--no_passphraseβ don't encrypt master encryption key-Fβ force, even if metadata file already exists
bcachefs migrate-superblock [options] device
Create default superblock after migrating.
-ddevice β device to create superblock for-ooffset β offset of existing superblock
π― Commands for operating on files in a bcachefs filesystem
bcachefs set-file-option [options] [files|folders] ...
Set various per-file attributes on files and directories in a bcachefs filesystem. And the cute part β when you apply it to directories, the attributes propagate recursively to all files and subdirectories within. It's giving generational inheritance. πΈ
--data_replicas=numberβ number of data replicas--data_checksum=(none | crc32c | crc64 | xxhash)β set data checksum type (default:crc32c).--compression=(none | lz4 | gzip | zstd)β set compression type (default:none).--background_compression=(none | lz4 | gzip | zstd)--metadata_target=targetβ device or label for metadata writes--foreground_target=targetβ device or label for foreground writes--background_target=targetβ device or label to move data to in the background--promote_target=targetβ device or label to promote data to on read--erasure_codeβ enable erasure coding (DO NOT USE YET)
bestie. It literally says DO NOT USE YET. In caps. Respect the caps. π
--project--nocowβ nocow mode: writes will be done in place when possible.--remove-allβ remove all file options from the specified files/directories
To remove specific options, use --option=-
Options can be chained together to perform multiple operations in a single command, for example:
bcachefs set-file-option --remove-all --compression=lz4.
bcachefs set-file-option --compression=- --background_compression=zstd:10 --data_replicas=- file.txt
π Commands for debugging
These commands work on offline, unmounted filesystems. Like, filesystem is asleep, but we're still snooping. π€«
bcachefs dump [options] device
Dump filesystem metadata.
-ooutput β required flag: output qcow2 image(s)-f,--forceβ force; overwrite when needed--nojournalβ don't dump entire journal, just dirty entries
bcachefs list [options] devices ...
List filesystem metadata to stdout.
-b(extents | inodes | dirents | xattrs)β btree to list from. (default:extents)-l,--levelβ btree depth to descend to. (0 == leaves; default:0)-sinode:offset β start position to list from-einode:offset β end position-m,--mode(keys | formats | nodes | nodes-ondisk)β (default:keys)-fβ check (fsck) the filesystem first-c,--colorize=(true | false)β force color on/off. Default: auto-detect TTY-vβ verbose mode
bcachefs list_journal [options] devices ...
-aβ read entire journal, not just dirty entries-n,--nr-entries=nrβ number of journal entries to print, starting from the most recent-s,--seq=seq[..seq]β journal entry sequence or range to print (e.g.,123,100..200,100..,..200)-t,--transaction-filter=bbposβ filter transactions not updating bbpos-k,--key-filter=btreeβ filter keys not updating btree-v,--verboseβ verbose mode
πͺ FUSE commands
bcachefs fusemount
Mount a filesystem via FUSE. Userspace said "I'll do it myself." π«
π² Miscellaneous commands
bcachefs completions shell
Generate shell completions. Quality of life upgrade, we love to see it. β¨
bcachefs version
Display the version of the invoked bcachefs tool.
π¦ EXIT STATUS
The bcachefs utility exits 0 on success, and >0 if an error occurs. Zero means we ate, anything else means something went sideways. π
And that's the whole page, bestie!! π This was the Debian build of the bcachefs(8) manual, dated November 17, 2023 β go forth and mount responsibly. Mwah. π
π¦ where this page comes from
- alpine 3.24: bcachefs-tools-doc 1.38.0-r0 Β· GPL-2.0-or-later
- fedora 43: bcachefs-tools 1.38.6-1.fc43 Β· GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-only AND BSD-3-Clause AND (Apache-2.0 AND (Apache-2.0 OR MIT) AND (Apache-2.0 with LLVM-exception OR Apache-2.0 OR MIT) AND MIT AND MPL-2.0 AND (Unlicense OR MIT))
- fedora 44: bcachefs-tools 1.37.3-1.fc44 Β· GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-only AND BSD-3-Clause AND (Apache-2.0 AND (Apache-2.0 OR MIT) AND (Apache-2.0 with LLVM-exception OR Apache-2.0 OR MIT) AND MIT AND MPL-2.0 AND (Unlicense OR MIT))
- fedora 44: bcachefs-tools 1.38.6-1.fc44 Β· GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-only AND BSD-3-Clause AND (Apache-2.0 AND (Apache-2.0 OR MIT) AND (Apache-2.0 with LLVM-exception OR Apache-2.0 OR MIT) AND MIT AND MPL-2.0 AND (Unlicense OR MIT))
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms