19.4 Modifying a Btrfs File System

The following table shows how you can use the btrfs command to add or remove devices, and to rebalance the layout of the file system data and metadata across the devices.

Command

Description

btrfs device add device mountpoint

Add a device to the file system that is mounted on the specified mount point. For example:

btrfs device add /dev/sdd /myfs

btrfs device delete device mountpoint

Remove a device from a mounted file system. For example:

btrfs device delete /dev/sde /myfs

btrfs device delete missing mountpoint

Remove a failed device from the file system that is mounted in degraded mode. For example:

btrfs device remove missing /myfs

To mount a file system in degraded mode, specify the -o degraded option to the mount command.

For a RAID configuration, if the number of devices would fall below the minimum number that are required, you must add the replacement device before removing the failed device.

btrfs filesystem balance mountpoint

After adding or removing devices, redistribute the file system data and metadata across the available devices.