Scroll to navigation

BCACHEFS(8) System Manager's Manual (smm) BCACHEFS(8)

NAME

bcachefsmanage bcachefs filesystems/devices

SYNOPSIS

bcachefs command [options] [arguments]

DESCRIPTION

The bcachefs utility supports the following subcommands, which are documented in detail below:

Superblock commands

Format one or a list of devices with bcachefs data structures.
Dump superblock information to stdout.
Set a filesystem option

Mount commands

Mount a filesystem.

Repair commands

Check an existing filesystem for errors.

Commands for managing a running filesystem

Show disk usage

Commands for managing devices within a running filesystem

Add a new device to an existing filesystem
Remove a device from an existing filesystem
Re-add an existing member to a filesystem
Take a device offline, without removing it
Migrate data off of a specific device
Mark a device as failed
Resize filesystem on a device
Resize journal on a device

Commands for managing subvolumes and snapshots

Create a new subvolume
Delete an existing subvolume
Create a snapshot

Commands for managing filesystem data

Rereplicate degraded data
Kick off low level data jobs

Commands for encryption

Unlock an encrypted filesystem prior to running/mounting
Change passphrase on an existing (unmounted) filesystem
Remove passphrase on an existing (unmounted) filesystem

Commands for migration

Migrate an existing filesystem to bcachefs, in place
Add default superblock, after bcachefs migrate

Commands for operating on files in a bcachefs filesystem

Set various per file attributes

Commands for debugging

Dump filesystem metadata to a qcow2 image
List filesystem metadata in textual form
List contents of journal

FUSE commands

 

Miscellaneous commands

Display the version of the invoked bcachefs tool
Generate shell completions

Superblock commands

bcachefs format [options] devices ...
Format one or a list of devices with bcachefs data structures. You need to do this before you create a volume.

Device specific options must come before corresponding devices, e.g.

bcachefs format --label=ssd /dev/sda --label=hdd /dev/sdb
=size
block size, in bytes (e.g. 4k)
=size
Btree node size, default 256k
=(continue | | )
Action to take on filesystem error
=number
Number of data replicas
=number
Number of metadata replicas
=number

=number

=size
Maximum size of checksummed/compressed extents
=(none | | | )
Set metadata checksum type (default: crc32c).
=(none | | | )
Set data checksum type (default: crc32c).
=(none | | | )
Set compression type (default: none).
=(none | | | )

=(crc32c | | )
Hash function for directory entries and xattrs
=target
Device or label for metadata writes
=target
Device or label for foreground writes
=target
Device or label to move data to in the background
=target
Device or label to promote data to on read
Enable erasure coding (DO NOT USE YET)
Constrain inode numbers to 32 bits
Shared new inode numbers by CPU id
Use the btree key cache for the inodes btree
=percentage
Percentage of disk space to reserve for copygc
=percentage
Amount of disk space to reserve for copygc

This takes precedence over gc_reserve_percent if set

=percentage
Percentage of disk space to reserve for superuser
Store full 128bits of cryptographic MACS, instead of 80
Enable POSIX acls
Enable user quotas
Enable group quotas
Enable project quotas
Log transaction function names in journal
Nocow mode: Writes will be done in place when possible.

Snapshots and reflink will still caused writes to be COW.

This flag implicitly disables data checksumming, compression and encryption.

=number
Sets both data and metadata replicas
Enable whole filesystem encryption (chacha20/poly1305); passphrase will be prompted for.
Don't encrypt master encryption key
, --fs_label=label
Create the filesystem with the specified label
, --uuid=uuid
Create the filesystem with the specified uuid
=size

Device specific options:

Enable discard/TRIM support
=size
Create the filesystem using size bytes on the subsequent device.
=size
Specifies the bucket size; must be greater than the btree node size
=n
Data written to this device will be considered to have already been replicated n times
, --label
Disk label
, --force
Force the filesystem to be created, even if the device already contains a filesystem.
, --quiet
Only print errors
, --verbose
Verbose filesystem initialization
bcachefs show-super [options] device
Dump superblock information to stdout.
, --fields=fields
List of sections to print
, --layout
Print superblock layout
bcachefs set-option [options] device
=(continue | | )
Action to take on filesystem error
=number
Number of metadata replicas
=number
Number of data replicas
=number

=number

=(none | | | )
Set metadata checksum type (default: crc32c).
=(none | | | )
Set data checksum type (default: crc32c).
=(none | | | )
Set compression type (default: none).
=(none | | | )

=(crc32c | | )
Hash function for directory entries and xattrs
=target
Device or label for metadata writes
=target
Device or label for foreground writes
=target
Device or label to move data to in the background
=target
Device or label to promote data to on read
Enable erasure coding (DO NOT USE YET)
Constrain inode numbers to 32 bits
Shared new inode numbers by CPU id
Use the btree key cache for the inodes btree
=percentage
Percentage of disk space to reserve for copygc
=percentage
Amount of disk space to reserve for copygc

This takes precedence over gc_reserve_percent if set

=percentage
Percentage of disk space to reserve for superuser
Store full 128bits of cryptographic MACS, instead of 80
Enable POSIX acls
Enable user quotas
Enable group quotas
Enable project quotas
Allow mounting in degraded mode
Allow mounting in when data will be missing
Enable discard/TRIM support
Extra debugging information during mount/recovery
=ms
Delay in milliseconds before automatic journal commits
Disable journal flush on sync/fsync

If enabled, writes can be lost, but only since the last journal write (default 1 second)

=ms
Delay in milliseconds before automatic journal reclaim
=bytes
Maximum Amount of IO to keep in flight by the move path
=number
Maximum number of IOs to keep in flight by the move path
Run fsck on mount
=error
Fix errors during fsck without asking
Ratelimit error messages during fsck
Super read only mode - no writes at all will be issued, even if we have to replay the journal
Don't replay the journal
Log transaction function names in journal
Don't open device in exclusive mode
Use O_DIRECT (userspace only)
=offset
Sector offset of superblock
Reconstruct alloc btree
=(compatible | | )
Set superblock to latest version, allowing any new features to be used
Nocow mode: Writes will be done in place when possible.

Snapshots and reflink will still caused writes to be COW.

This flag implicitly disables data checksumming, compression and encryption.

Enable nocow mode: enables runtime locking in data move path needed if nocow will ever be in use
Skip submit_bio() for data reads and writes, for performance testing purposes

Mount commands

bcachefs mount [options] device mountpoint
Mount a filesystem. The device can be a device, a colon-separated list of devices, or UUID=<UUID>. The mountpoint is the path where the filesystem should be mounted. If not set, then the filesystem won't actually be mounted but all steps preceding mounting the filesystem (e.g. asking for passphrase) will still be performed.
options
Mount options provided as a comma-separated list. See user guide for complete list.
Allow mounting with data degraded
Extra debugging info during mount/recovery
Run fsck during mount
Fix errors without asking during fsck
Mount in read only mode
 
, --key-location=(fail | | )
Where the password would be loaded from. (default: ask).
don't ask for password, fail if filesystem is encrypted.
wait for password to become available before mounting.
prompt the user for password.
, --colorize=(true | )
Force color on/off. Default: auto-detect TTY
Be verbose. Can be specified more than once.

Repair commands

bcachefs fsck [options] devices ...
Check an existing filesystem for errors.
Automatic repair (no questions)
Don't repair, only check for errors
Assume "yes" to all questions
Force checking even if filesystem is marked clean
, --ratelimit_errors
Don't display more than 10 errors of a given type
, --reconstruct_alloc
Reconstruct the alloc btree
Be verbose

Commands for managing a running filesystem

bcachefs fs usage [options] [filesystem]
Show disk usage.
, --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.
=size
Size of filesystem on device
=size
Set bucket size
Enable discards
, --label=label
Disk label
, --force
Use device even if it appears to already be formatted
bcachefs device remove [options] device
Remove a device from a filesystem
, --force
Force removal, even if some data couldn't be migrated
, --force-metadata
Force removal, even if some metadata couldn't be migrated
bcachefs device online device
Re-add a device to a running filesystem
bcachefs device offline device
Take a device offline, without removing it
, --force
Force, if data redundancy will be degraded
bcachefs device evacuate device
Move data off of a given device
bcachefs device set-state [options] new-state device
new-state=(rw | ro | failed | spare)
 
, --force
Force, if data redundancy will be degraded
Force, if data will be lost
, --offline
Set state of an offline device
bcachefs device resize device [size]
Resize filesystem on a device
bcachefs device resize-journal device [size]
Resize journal on a device

Commands for managing subvolumes and snapshots

[options] path
Create a new subvolume
[options] path
Delete an existing subvolume
[options] source dest
Create a snapshot of source at dest. If specified, source must be a subvolume; if not specified the snapshot will be of the subvolume containing dest.
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.
bcachefs data job job filesystem
Kick off a data job and report progress

job is one of ( scrub | | | )

btree
Btree to operate on
inode:offset
Start position
inode:offset
End position

Commands for encryption

bcachefs unlock device
Unlock an encrypted filesystem prior to running/mounting.
Check if a device is encrypted
=(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
fs
Root of filesystem to migrate
Enable whole filesystem encryption (chacha20/poly1305)
Don't encrypt master encryption key
Force, even if metadata file already exists
bcachefs migrate-superblock [options] device
Create default superblock after migrating
device
Device to create superblock for
offset
Offset of existing superblock

Commands for operating on files in a bcachefs filesystem

bcachefs setattr [options] devices ...
=number
Number of data replicas
=(none | | | )
Set data checksum type (default: crc32c).
=(none | | | )
Set compression type (default: none).
=(none | | | )

=target
Device or label for metadata writes
=target
Device or label for foreground writes
=target
Device or label to move data to in the background
=target
Device or label to promote data to on read
Enable erasure coding (DO NOT USE YET)

Nocow mode: Writes will be done in place when possible.

Commands for debugging

These commands work on offline, unmounted filesystems.

bcachefs dump [options] device
Dump filesystem metadata
output
Required flag: Output qcow2 image(s)
, --force
Force; overwrite when needed
Don't dump entire journal, just dirty entries
bcachefs list [options] devices ...
List filesystem metadata to stdout
(extents | | | )
Btree to list from. (default: extents)
, --level
Btree depth to descend to. ( 0 == leaves; default: 0)
inode:offset
Start position to list from
inode:offset
End position
, --mode (keys | | | )
(default: keys)
Check (fsck) the filesystem first
, --colorize=(true | )
Force color on/off. Default: auto-detect TTY
Verbose mode
bcachefs list_journal [options] devices ...
Read entire journal, not just dirty entries
, --nr-entries=nr
Number of journal entries to print, starting from the most recent
, --transaction-filter=bbpos
Filter transactions not updating bbpos
, --key-filter=btree
Filter keys not updating btree
, --verbose
Verbose mode

FUSE commands

bcachefs fusemount
Mount a filesystem via FUSE

Miscellaneous commands

bcachefs completions shell
Generate shell completions
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.

November 17, 2023 Linux 6.4.0-150600.23.25-default