2

I have a btrfs filesystem for which the output of btrfs fi usage /mnt is:

Overall:
    Device size:          60.00GiB
    Device allocated:         40.00GiB
    Device unallocated:       20.00GiB
    Device missing:          0.00B
    Used:             38.03GiB
    Free (estimated):         10.00GiB  (min: 10.00GiB)
    Data ratio:               2.00
    Metadata ratio:           2.00
    Global reserve:       22.00MiB  (used: 0.00B)

Data,RAID1: Size:18.99GiB, Used:18.99GiB
   /dev/sdb   18.99GiB
   /dev/sdc   18.99GiB

Metadata,RAID1: Size:1.00GiB, Used:22.11MiB
   /dev/sdb    1.00GiB
   /dev/sdc    1.00GiB

System,RAID1: Size:8.00MiB, Used:16.00KiB
   /dev/sdb    8.00MiB
   /dev/sdc    8.00MiB

Unallocated:
   /dev/sdb    1.00MiB
   /dev/sdc    1.00MiB
   /dev/sdd   20.00GiB

As you can see, all allocated data chunks are completely full. btrfs balance start /mnt fails with:

ERROR: error during balancing '/mnt': No space left on device
There may be more info in syslog - try dmesg | tail

This is not a duplicate of this question, which is about metadata chunks being full. My question is how do I get btrfs to allocate some chunks on /dev/sdd

jl6
  • 1,455
  • 2
  • 14
  • 29
  • There is a RAID1 (mirror) defined with the disks sda and sdc. To use the space on sdd, you'ld have to convert to some other RAID level (RAID5, e.g.). See https://superuser.com/questions/901067/btrfs-convert-from-raid1-to-raid5. – ridgy May 10 '17 at 14:34

1 Answers1

0

It looks like you've got a filesystem which is using the raid1 profile, which means you'll need to add a fourth device temporarily so that BTRFS can allocate new chunks.

Each profile has a minimum number of devices needed to allocate a chunk, and if there aren't that many devices with free space, you can't allocate a new chunk. For raid1 and raid0, the minimum is 2, for raid10 it's 4, and for raid5 and raid6 it's 3 and 4 respectively. The quick option if you've got lots of RAM and a reliable power supply is to temporarily add a 2-4 GB ramdisk to the filesystem, run a full balance, then remove the ramdisk from the filesystem. A USB flash drive works too, but you may have reliability issues with that.

Alternatively, you might be able to get this working without needing to add another device if you start a balance with -mconvert=single, -dconvert=single, -f, let that run for a while, then kill it and rerun the balance with -mconvert=raid1 -dconvert=raid1, but that will mean some of your data will temporarily be at risk.