1

Is it possible to easily convert a btrfs raid1 to a raid5. I mean at the end of the day. Its really just two mirrored drives. So I would think this should be easy to do. I want to now have 3 3TB drives for 6TB of storage instead of 2 3TB for 3TB. I have also been looking at raid5 support for btrfs and its still marked as experimental, but is it really that bad for a home nas set up? I don't want to lose all my media, but I still want space.

7
  • check your question. are you converting from raid0 or raid1? Apr 13, 2015 at 17:38
  • as to your question, raid 5 introduces parity. Not only that, but it is DISTRIBUTED parity. That means a large amount of data needs to be moved around your disks. As for how easy the process is to actually perform, I can't help you there. Apr 13, 2015 at 17:42
  • @RussellUhl sorry I fixed it. Apr 13, 2015 at 20:59
  • 1
    lol tfw reading it after june 2016 when btrfs RAID5 implementation turned out to be fatally flawed and unable to rebuild array properly after disk failure...
    – Lapsio
    Sep 19, 2016 at 11:24
  • @user2111737 Good thing I was to lazy and poor to buy a 3rd hard drive. Sep 19, 2016 at 13:46

2 Answers 2

3

I haven't converted from RAID 1 to RAID 5 in BTRFS, but I have done other BTRFS conversions, and according to the documentation they are all equally easy.

It is as simple as

btrfs balance start -dconvert=raid5 -mconvert=raid5 /mnt

It is not difficult, but it will take some time (many hours).

Yes, RAID5 is still marked as experimental. Per the most recent documentation I can find, scrub still doesn't work with RAID5, so any data errors can't be corrected.

One other approach to consider: with BTRFS RAID1, you can use three 3TB drives to get 4.5TB usable space. Yes, you can do mirroring with an odd number of drives. BTRFS doesn't mirror disks, it mirrors blocks. So, for example, some files will be mirrored on drives 1 and 2, some on 2 and 3, and some on 1 and 3.

You can even have different size drives with BTRFS RAID1. I have a set with one 2TB drive and three 1TB drives, giving 2.5TB usable space.

BTRFS RAID1 is really cool.

3
  • I never marked this as the answer ... my bad. I still never did update to raid 5. I'm still waiting for the right moment to buy drives. (cursed money lol) Feb 1, 2016 at 19:24
  • I personally buy drives by picking the most reliable drives from backblaze.com/blog/hard-drive-reliability-stats-for-q2-2015 and buying them on EBay. I recently bought several 2TB Hitachi/HGST 7K2000 for about USD $40 each.
    – Grunthos
    Feb 3, 2016 at 1:51
  • 2
    It's safer to use raid1 for metadata. btrfs balance start -dconvert=raid5 -mconvert=raid1 /mnt
    – lunarfyre
    Jun 9, 2020 at 20:45
1

Yes, it is possible to convert from RAID-1 to RAID-5 or (better RAID-6). For example, you could convert a single btrfs filesystem (one drive) to RAID-1 (2+ drives), then to RAID-5 (3+ drives) and to RAID-6 (4+ drives). In every case, you have to add the new drive first (btrfs device add drive /mnt/point), then rebalance and convert (btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt/point).

However, as useless as this may sound to some people who are used to other technologies that do not offer this feature (after all, why would anyone keep converting raid levels back and forth), this actually offers a huge advantage over other technologies like ZFS: It's possible to add a single drive to an existing RAID-6 volume to increase its capacity by that of this drive. So you could scale up, depending on your storage needs.

It should also be mentioned that RAID-5/RAID-6 should not be used before (kernel) 3.19, as there was no support for error detection/correction back then. Always stick to the latest version when using btrfs. Many will say that the RAID-5/RAID-6 implementation in btrfs is still experimental in some ways, but as long as you take care of your system (scrub every now and then to detect silent corruption), monitor your drives and replace bad drives (btrfs replace, straight forward), you'll end up with a very stable filesystem. (Of course, you should have backups anyway.)

As mentioned earlier, converting to RAID-5 or RAID-6 is done by converting both data and metadata.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .