Changing Btrfs File System Devices
You can use the btrfs device
command to add, remove, or replace
devices, and the btrfs rebalance
command to rebalance the layout of the file
system data and metadata across devices. The following table describes each of the commands that
can use to perform these tasks.
Command | Description |
---|---|
|
Add a device to the file system that's mounted on the specified mount point, for example:
|
|
Remove a device from a mounted file system, for example:
|
|
Remove a failed device from the file system that's mounted in degraded mode, for example:
To mount a file system in degraded mode, specify the
For a RAID configuration, if the number of devices would become less than the minimum number that are required, you must add the replacement device before removing the failed device. |
btrfs device replace start
source_dev
target_dev
mountpoint
|
Replace devices on a live file system without unmounting the file system or stopping any tasks that are using the file system, for example:
If the system crashes or loses power while the replacement is taking place, the operation resumes when the system next mounts the file system. The target device must be the same size or larger than the source device. If the
source device is no longer available, or you specify the The source device is removed from the file system when the operation is complete. Use the |
|
After adding or removing devices, redistribute the file system data and metadata across the available devices. |