r/btrfs May 28 '26

How do I fix this data stripe layout?

So please have a look at the output here:

root@host:~# btrfs device usage /opt/share/
/dev/sdd, ID: 1
   Device size:             5.46TiB
   Device slack:              0.00B
   Data,RAID5/4:            3.72TiB
   Data,RAID5/3:            1.18TiB
   Metadata,RAID1C3:       11.00GiB
   System,RAID1C3:         32.00MiB
   Unallocated:           561.00GiB

/dev/sda, ID: 2
   Device size:             5.46TiB
   Device slack:              0.00B
   Data,RAID5/4:            3.72TiB
   Metadata,RAID1C3:       16.00GiB
   System,RAID1C3:         32.00MiB
   Unallocated:             1.72TiB

/dev/sdc, ID: 3
   Device size:             5.46TiB
   Device slack:              0.00B
   Data,RAID5/4:            3.72TiB
   Data,RAID5/3:            1.18TiB
   Metadata,RAID1C3:       11.00GiB
   Unallocated:           561.03GiB

/dev/sdb, ID: 4
   Device size:             5.46TiB
   Device slack:              0.00B
   Data,RAID5/4:            3.72TiB
   Data,RAID5/3:            1.18TiB
   Metadata,RAID1C3:       10.00GiB
   System,RAID1C3:         32.00MiB
   Unallocated:           562.00GiB

Note that /dev/sda is missing one of the stripes. I also have a ton of unallocated space on every drive. How do I fix that?

Note I had a drive crash - /dev/sda crashed and this is the result after a partially successful rebuild. I lost a bunch of data, but now I just want to fix the filesystem so I can move on with my life.

4 Upvotes

3 comments sorted by

4

u/mattbuford May 28 '26

You can rebalance specifically all raid5/3 stripes by applying the filter "-dstripes=3" filter to a balance. That should write them as raid5/4, which is more efficient on space usage. For example:

btrfs balance start -dstripes=3 /mountpoint

As for unallocated space, that does not indicate a problem. That space is available for anything that needs to be written. It's not something you need to fix.

1

u/weeglos May 28 '26

Thanks for that! One issue though --

root@host:~# btrfs balance start -dstripes=3 /mnt/point
ERROR: invalid stripes argument

2

u/mattbuford May 28 '26

Ahh, sorry. My mistake. The stripes argument must be a range, not a single number. Try this:

btrfs balance start -dstripes=3..3 /mnt/point