I've added a device to my existing Btrfs file system recently, but it doesn't report the new device as having even allocated any space for the data. Take a look:
Before I started:
# btrfs fi show /
Label: 'LINUX' uuid: f0b4d012-91d8-43bd-90b5-e398a012ccff
Total devices 1 FS bytes used 126.72GiB
devid 1 size 272.40GiB used 128.03GiB path /dev/sda3
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 273.4G 0 disk
├─sda1 8:1 0 1M 0 part
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 272.4G 0 part /pool
sdb 8:16 0 68.3G 0 disk
So now I want to add /dev/sdb
:
# btrfs device add /dev/sdb /
# btrfs balance start --full-balance /
< an hour or so later ... >
# btrfs fi usage /
Overall:
Device size: 340.73GiB
Device allocated: 128.03GiB
Device unallocated: 212.70GiB
Device missing: 0.00B
Used: 126.68GiB
Free (estimated): 213.10GiB (min: 213.10GiB)
Data ratio: 1.00
Metadata ratio: 1.00
Global reserve: 338.14MiB (used: 0.00B)
Data,single: Size:126.00GiB, Used:125.60GiB
/dev/sda3 126.00GiB
Metadata,single: Size:2.00GiB, Used:1.08GiB
/dev/sda3 2.00GiB
System,single: Size:32.00MiB, Used:16.00KiB
/dev/sda3 32.00MiB
Unallocated:
/dev/sda3 144.37GiB
/dev/sdb 68.33GiB
Huh, I thought that was supposed to do it, lets try this:
# btrfs balance start -dconvert=single -mconvert=raid1 /
< an hour or so later ... >
# btrfs fi show /
Label: 'LINUX' uuid: f0b4d012-91d8-43bd-90b5-e398a012ccff
Total devices 2 FS bytes used 126.72GiB
devid 1 size 272.40GiB used 128.03GiB path /dev/sda3
devid 2 size 68.33GiB used 2.03GiB path /dev/sdb
# btrfs fi usage /
Overall:
Device size: 340.73GiB
Device allocated: 130.06GiB
Device unallocated: 210.67GiB
Device missing: 0.00B
Used: 127.80GiB
Free (estimated): 211.03GiB (min: 105.69GiB)
Data ratio: 1.00
Metadata ratio: 2.00
Global reserve: 338.47MiB (used: 0.00B)
Data,single: Size:126.00GiB, Used:125.64GiB
/dev/sda3 126.00GiB
Metadata,RAID1: Size:2.00GiB, Used:1.08GiB
/dev/sda3 2.00GiB
/dev/sdb 2.00GiB
System,RAID1: Size:32.00MiB, Used:16.00KiB
/dev/sda3 32.00MiB
/dev/sdb 32.00MiB
Unallocated:
/dev/sda3 144.37GiB
/dev/sdb 66.30GiB
What the heck?
Kernel said anything during balance? Just a whole lot of this:
Feb 13 21:55:06 localhost kernel: BTRFS info (device sda3): found 7541 extents
Feb 13 21:55:06 localhost kernel: BTRFS info (device sda3): relocating block group 621927202816 f
Feb 13 21:55:18 localhost kernel: BTRFS info (device sda3): found 7020 extents
Feb 13 21:55:28 localhost kernel: BTRFS info (device sda3): found 7020 extents
Feb 13 21:55:28 localhost kernel: BTRFS info (device sda3): relocating block group 620853460992 f
Feb 13 21:55:39 localhost kernel: BTRFS info (device sda3): found 2540 extents
Feb 13 21:55:48 localhost kernel: BTRFS info (device sda3): found 2540 extents
Feb 13 21:55:48 localhost kernel: BTRFS info (device sda3): relocating block group 619779719168 f
Feb 13 21:55:58 localhost kernel: BTRFS info (device sda3): found 3971 extents
Actually,
-dconvert=single
will balance data (as you may expect) between devices without striping it. But documentation says that allocation is "linear". I don't really know what it means but it could be that one device will be used only when the other one is full.If you go to this page : https://btrfs.wiki.kernel.org/index.php/Using_Btrfs_with_Multiple_Devices#Filesystem_creation , you may read this…
(the important part is "full capacity")
As far as I'm concerned, I have two PCs with this configuration (single data, raid1 metadata). The first one makes use of 3 drives for data whereas the second PC only uses one drive for data and 3 drives for metadata. I still don't know why but I hope it will be documented in the futur.