Use the btrfs filesystem show command to list all the btrfs file systems and which devices they include.
The btrfs device add command is used to add new devices to a mounted file system.
The btrfs filesystem balance command balances (restripes) the allocated extents across all existing devices.
An example of all these commands together to add a new device is as follows:

Add a new device t o an btrfs f ile system

First, create and mount a btrfs file system.

# mkfs.btrfs /dev/device1
# mount /dev/device1

Next, add a second device to the mounted btrfs file system.

# btrfs device add /dev/device2 /mount-point

Balance btrfs on across devices

The metadata and data on these devices are still stored only on /dev/device1. It must now be balanced to spread across all devices.

# btrfs filesystem balance /mount-point

Balancing a file system will take some time as it reads all of the file system's data and metadata and rewrites it across the new device.

 Delete a device from a btrfs filesystem

 Use the btrfs device delete command to remove an online device. It redistributes any extents in use to other devices in the file system in order to be safely removed. No manual action needed.
First create and mount a few btrfs file systems.

# mkfs.btrfs /dev/sdb /dev/sdc /dev/sdd /dev/sde
# mount /dev/sdb /mnt

Add some data to the file system.
Finally, remove the required device.

# btrfs device delete /dev/sdc /mnt


Comments powered by CComment