Btrfs distribute files equally across multiple devices

I have a btrfs volume across two devices that has metadata RAID1 and data RAID0. In the event one drive would fail, practically all files above the 64KB default stripe size would be corrupted. As this partition isn’t performance critical, but should be space-efficient, I’ve thought about re-balancing the filesystem to distribute files equally across disks, but something like that doesn’t seem to exist. The ultimate goal would be to be able to still read some of the files in the event of a drive failure.

AFAIK, using “single”/linear data allocation just fills up drives one by one.


Write two 128KB files (file0, file1) to two devices (dev0, dev1):


  • file0/chunk0 (64KB): dev0
  • file0/chunk1 (64KB): dev1
  • file1/chunk0 (64KB): dev0
  • file1/chunk1 (64KB): dev1


  • file0 (128KB): dev0
  • file1 (128KB): dev0

distribute files:

  • file0 (128KB): dev0
  • file1 (128KB): dev1

Does anyone have an idea on how to achieve something like that or if it is planned by btrfs-devs?

edit: Zooming out of the RAIDesque thinking calling it “Distribute files equally across multiple devices” is better than “‘RAID 0’ stripe per file”, because it doesn’t imply “per file device switch”, but rather “fill devices about equally”. (e.g. 1G on dev0, two 512MB on dev1)

Asked By: johnp


Hugo Mills provided an answer on the btrfs mailing-list:

Basically "single" mode distributes 1GiB chunks, which is good enough for my use case.

Answered By: johnp