I have a BTRFS filesystem with a HDDs of various sizes. I thought adding an SSD might allow BTRFS to use it as a caching layer or just another much-faster drive (the docs are a little sparse on this: https://btrfs.wiki.kernel.org/index.php/FAQ#Is_Btrfs_optimized_for_SSD.3F ). However when I run btrfs fi show /data it shows the SSD as unused:

Total devices 8 FS bytes used 4.29TiB

// SSD moved to the top of the list for easier reading
devid    9 size 223.57GiB used 0.00B path /dev/sda
devid    1 size 2.73TiB used 1.28TiB path /dev/sdb1
devid    5 size 0.00B used 356.00GiB path /dev/sdi1
devid    6 size 1.82TiB used 379.00GiB path /dev/sde1
devid    7 size 4.55TiB used 3.09TiB path /dev/sdh
devid    8 size 3.64TiB used 2.19TiB path /dev/sdc
devid   10 size 2.73TiB used 1.28TiB path /dev/sdf
devid   11 size 1.82TiB used 24.00GiB path /dev/sdg

Also if I run btrfs device usage /data it also reports the SSD as unused:

/dev/sda, ID: 9
Device size:           223.57GiB
Unallocated:           223.57GiB

So I thought I'd check my fstab mount options:

# Mount BTRFS array
UUID=587d228b-5dc3-44e6-b9d9-83df5682d50d       /data   btrfs   defaults,noatime,space_cache,discard    0       0

As far as I can tell these are all pretty standard.

Is this normal, how can I tell if BTRFS is actually using the drive at all? (I may be totally mistaken and BTRFS might not even support this use case at all)

  • 1
    I don't see any operations in the btrfs tool that would allow you to specify how to use a device. What you can do is control the RAID level to specify how the data is spread out across the device pool. As for the device usage, did you already re-balance the filesystem? – Emmanuel Rosa Mar 29 '17 at 18:24
  • The filesystem has been rebalanced, seemingly to no effect. I'm tempted to add another identical SSD to see if it needs two SSDs before trying to utilise them in a RAID 1 array. This is total guesswork though. I should probably just read the code. – Foritus Mar 29 '17 at 19:12

Just adding a device to a BTRFS pool doesn't automatically move any data to it, you have to write new data to the pool and the balancer will decide which device it puts the data on.
The next chunk is very likely to be created on a newly added device though since it's 0% allocated (the balancer tries to fill up all devices equally).

If you want to make already written data go through the balancer again, you need to use the btrfs balance command.

All data that is put on the SSD will be faster than the data on the HDDs but there is no speed aware balancing in place, so which data is fast and which isn't is pretty much random and cannot be manually controlled either.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.