3

I created a single-device btrfs filesystem. According to the btrfs wiki article on using multiple devices, I should be able to convert that to RAID1 using:

btrfs balance start -dconvert=raid1 -mconvert=raid1 /path

I started that on Linux 3.16, and it failed (kernel panic). Upgraded to Linux 4.0, after mounting the filesystem it continued and finished. But it only did the data, not the metadata or system (according to btrfs fi df). I grabbed the latest btrfs-progs from git (just to make sure it wasn't due to an old version), and did:

Watt:/home/anthony/src/btrfs-progs# ./btrfs balance start -v -mconvert=raid1 /path
Dumping filters: flags 0x6, state 0x0, force is off
  METADATA (flags 0x100): converting, target=16, soft is off
  SYSTEM (flags 0x100): converting, target=16, soft is off
Done, had to relocate 6 out of 1411 chunks

But that didn't actually mirror it, apparently. Right now, I have:

Watt:/home/anthony/src/btrfs-progs# ./btrfs fi usage /path
Overall:
    Device size:                   7.28TiB
    Device allocated:              2.75TiB
    Device unallocated:            4.53TiB
    Device missing:                  0.00B
    Used:                          2.74TiB
    Free (estimated):              2.26TiB      (min: 2.26TiB)
    Data ratio:                       2.00
    Metadata ratio:                   2.00
    Global reserve:              512.00MiB      (used: 0.00B)

Data,RAID1: Size:1.37TiB, Used:1.37TiB
   /dev/mapper/luks-562e4e2f-2894-415a-aaf1-7c94a11c33b9           1.37TiB
   /dev/mapper/luks-ec97c1ad-21d8-41bb-9072-e5a74f68e416           1.37TiB

Metadata,DUP: Size:2.50GiB, Used:1.58GiB
   /dev/mapper/luks-562e4e2f-2894-415a-aaf1-7c94a11c33b9           5.00GiB

System,DUP: Size:32.00MiB, Used:224.00KiB
   /dev/mapper/luks-562e4e2f-2894-415a-aaf1-7c94a11c33b9          64.00MiB

Unallocated:
   /dev/mapper/luks-562e4e2f-2894-415a-aaf1-7c94a11c33b9           3.17TiB
   /dev/mapper/luks-ec97c1ad-21d8-41bb-9072-e5a74f68e416           1.36TiB

I tried the full balance again (with both -dconvert=raid1 and -mconvert=raid1) and that didn't do it, either.

NOTE: The larger disk (56…b9) is the one I added.

How can I get the metadata and system mirrored?

  • That should do it.. are you sure you let it finish? iirc, the command returns immediately while the balance goes on in the background. – psusi May 1 '15 at 22:29
  • 1
    @psusi yes, I checked it was finished with btrfs balance status ... and here it doesn't run in the background. btrfs balance start is sitting waiting for it. – derobert May 1 '15 at 22:30
3

This is a regression in kernel 4.0, causing conversion filters in balance to have no effect; it looks like all conversions are affected (not just single->raid1 or raid1->raid5). See a recent mailing list thread, where there's currently no official fix. If you're up to patching your kernel, there's an easy patch to apply as a temporary fix.

This is a known bug in v4.0. I sent in a patch [1] to revert the commit that caused the regression, but it didn't get any response. You could apply that or just revert 2f0810880f08 ("btrfs: delete chunk allocation attemp when setting block group ro") to fix your problem for now.

[1]: https://patchwork.kernel.org/patch/6238111/

  • Thank you, that appears to be it. thread.gmane.org/gmane.comp.file-systems.btrfs/43117 seems to be the original thread. Compiling a patched kernel now. – derobert May 3 '15 at 17:09
  • I only recently started looking at BTRFS. Having converted an ext4 filesystem, I wanted to upgrade the metadata to DUP, and spent some time trying to figure out what I was doing wrong and why it stubbornly stayed as SINGLE! Now I know. – StarNamer May 19 '15 at 23:23
  • I don't think you said which distro you're using. In Fedora, this is tracked in bug bugzilla.redhat.com/show_bug.cgi?id=1217191 and apparently fixed in an updated kernel package that is built but not yet pushed to the updates repository. – amcnabb Jun 26 '15 at 19:11

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.