- Warning:
- Add the device or partition
- Verify that the disk / partition has been added to the pool
- Convert pool data and metadata into BTRFS RAID1
I have two disks, disk one is 109.29GiB in size and disk two is 223.57GiB in size. They are both Solid State Drives.
Currently disk one is the only disk that BTRFS knows about. To change this I need to add the second disk with this command which will create a BTRFS filesystem on the second disk and also add it to BTRFS.
Warning:
Add the device or partition
In this example:
-
/dev/sda
is the device name of the first disk. -
/dev/sdb
is the device name of the second disk.
1
$ sudo btrfs device add -f /dev/sdb /
I need to specify -f
so that BTRFS will automatically create the filesystem on the second disk (which will erase all data on it).
Note
If you are using a BTRFS formatted partition as the second device, make sure to instead use this command without the -f
flag:
1
$ sudo btrfs device add /dev/sdb<partnum> /
Verify that the disk / partition has been added to the pool
I have added the second disk to BTRFS and to verify that it knows about it I can run $ sudo btrfs filesystem show
which will return:
1
2
3
4
Label: none uuid: a9e30ccf-329b-4483-ab4a-57065f38c808
Total devices 2 FS bytes used 78.66GiB
devid 1 size 109.29GiB used 81.03GiB path /dev/sda2
devid 2 size 223.57GiB used 0GiB path /dev/sdb
Convert pool data and metadata into BTRFS RAID1
RAID1 is not configured yet and we need to balance the data and metadata between both disks.
To convert the disks to RAID1 we need to run this command:
1
$ sudo btrfs balance start -mconvert=raid1 -dconvert=raid1 /
This will balance the metadata and data between both disks otherwise known as mirroring. It will take a while (for me it took around half an hour).
After the balance operation is completed, you can run $ sudo btrfs fi df /
to verify that BTRFS is running in RAID1 mode, it should return:
1
2
3
4
Data, RAID1: total=78.00GiB, used=76.61GiB
System, RAID1: total=32.00MiB, used=16.00KiB
Metadata, RAID1: total=3.00GiB, used=2.05GiB
GlobalReserve, single: total=175.19MiB, used=0.00B