LinuxCommandLibrary

bcachefs-device

Register/unregister devices with a bcachefs filesystem

TLDR

Format and add a new device to an existing filesystem.

$ sudo bcachefs device add --label=[group].[name] [path/to/mountpoint] [path/to/device]
copy

Migrate data off a device to prepare for removal
$ bcachefs device evacuate [path/to/device]
copy

Permanently remove a device from a filesystem
$ bcachefs device remove [path/to/device]
copy

SYNOPSIS

bcachefs device [options]

PARAMETERS

add
    Adds a device to the bcachefs filesystem.

remove
    Removes a device from the bcachefs filesystem. Requires the filesystem to have sufficient redundancy

format
    Formats a device for use with bcachefs.

set-roles
    Sets roles for the device. Roles could be data or metadata.

show
    Shows information about the device.

--uuid=
    Operates on a specific bcachefs filesystem by UUID. Required when multiple filesystems are present.

--foreground
    Run in foreground, useful for debugging.

--journal_sync
    Forces the journal to be synced before exiting. It is a debugging option.

DESCRIPTION

The bcachefs-device command is a utility within the Bcachefs filesystem suite used for creating, managing, and inspecting devices that are part of a Bcachefs filesystem. It allows users to add or remove devices from the Bcachefs filesystem, check device status, and perform other device-related operations. Unlike traditional block device formatting tools, bcachefs-device operates within the context of an existing Bcachefs filesystem, allowing flexible capacity changes.

It supports operations such as promoting/demoting devices to specific tiers(data,metadata), examining device characteristics, and controlling writeback behaviour. It's a crucial tool for managing the underlying storage configuration of a Bcachefs filesystem, enabling the administrator to tune performance and reliability according to needs. It is designed to be safe and performant, relying on Bcachefs's own safety features to avoid catastrophic filesystem corruption when adding or removing drives. It's often used in conjunction with other Bcachefs management tools like bcachefs-format and mount.bcachefs.

ERROR HANDLING

The command returns error codes when operations fail, allowing for scripting and automation. Proper handling of these codes is crucial for reliable Bcachefs management.

DEVICE IDENTIFICATION

Devices are commonly specified by their path in `/dev/`, such as `/dev/sda`.

It is highly recommended to use a persistent identification methods such as UUID or symlinks.

SAFETY

Removing the last device from a bcachefs filesystem can cause data loss. Make sure the filesystem redundancy is sufficient before removing devices.

SEE ALSO

bcachefs(8), bcachefs-format(8), mount.bcachefs(8)

Copied to clipboard