BTRFS
RAID
Commands
Run as user |
Instruction number |
|
* |
These examples assume that a RAID 1 BTRFS array (not BTRFS over mdadm RAID)
is mounted on /data
.
Note
After creating, adding or removing devices from an array always run the balance operation. You may want to use GNU screen to put the process in background, like this
apt-get install screen
screen btrfs balance start /data
Create
Run as user |
Instruction number |
|
* |
crate the array
mkfs.btrfs -m raid1 -d raid1 /dev/sda1 /dev/sdb1
mount normally
mount /dev/sdb1 /data
To add new partitions, for example
/dev/sdc1
and/dev/sdd1
, runbtrfs device add /dev/sdc1 /dev/sdd1 /data
run the balance operation
Removing devices
Run as user |
Instruction number |
|
* |
remove two devices at the same time
btrfs device delete /dev/sdc1 /dev/sdd1 /data
run the balance operation
Replace a device
Run as user |
Instruction number |
|
* |
replace
/dev/old
with/dev/new
. This operation should run in backgroundbtrfs replace start /dev/old /dev/new /data
check
btrfs replace status /data
Convert metadata profile
You can clone partitions with dd
from HDDs to SSDs. After that run:
screen btrfs balance start -v -mconvert=single /data
Check usage
Run as user |
Instruction number |
|
* |
btrfs filesystem usage /data
btrfs filesystem df /data
Footnotes
- 1
https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices unknown license
- 2
https://wiki.archlinux.org/index.php/Btrfs GNU Free Documentation License 1.3 or later, Copyright (c) ArchWiki contributors