2

How would I convert an existing RAID5 (single parity) btrfs setup to a dual parity RAID6 configuration given enough free available disk space, using the same disks, without swapping out data ?

Basically that should just be removing a disk and retaining a redundancy drive so that btrfs redistributes everything on the remaining drives and re-adding that removed disk ?

So what is the recommended process ?

I was thinking something along the lines

btrfs device delete /dev/sdx /mnt/fs
btrfs balance start -dconvert=raid6 -mconvert=raid6 /mnt/fs
btrfs device add /dev/sdx /mnt/fs

Do I even need to delete and add the disk, or can I just convert the setup directly ? I.e.

btrfs balance start -dconvert=raid6 -mconvert=raid6 /mnt/fs

2 Answers 2

1

https://www.howtoforge.com/a-beginners-guide-to-btrfs-p2

This claims that you can change the raid level on a running array assuming you have enough free space. Make sure you're running the latest stable Linux kernel.

Example (from link): btrfs balance start -dconvert=raid1 -mconvert=raid1 /mnt

-dconvert is for the data

-mconvert is for the meta file (you want this duplicated, trust me)

the /mnt is where the BTRFS volume is mounted. You can do this unmounted, but I haven't tried and I want to remain honest.

You have raid0, raid1, raid5, and raid6. If you have enough free space, I believe it's n-2 or number of drives [free space] minus 2 for raid6. Though with BTRFS you can get away with less and instead use the data to do the measuring. It's possible to have raid6 like features with less than the acceptable number of drives if you're storing a small amount of data. Possible, but not recommended.

Also note that this will take a while depending on how much data you have on the drives. There is also a small chance of the balance failing and either outright killing the array or putting it into an unstable read only mode. As always, keep backups.

0
0

RAID6 - wikipedia

  • RAID5 requires 3+ Drives(n) with 1-1/n space efficiency
  • RAID6 requires 4+ Drives(n) with 1-2/n space efficiency

Total space (approximate) of a 1 TiB array and change (%) from RAID5 -> RAID6:

  • 4 x 250GiB ~ 1 TiB -> RAID5 ~ 768 GiB -> RAID6 ~ 512 GiB -> -50%
  • 5 x 200GiB ~ 1 TiB -> RAID5 ~ 819.2 GiB -> RAID6 ~ 614.4 GiB -> -25%
  • 6 x 170GiB ~ 1 TiB -> RAID5 ~ 853.3 GiB -> RAID6 ~ 682.6 GiB -> -20%

You can change the raid level on a running array assuming you have enough free space and drives.

  • do not delete or remove any drives you want in the final array
  • by deleting -> adding -> converting you would be "double" balancing
    • during the remove/delete, metadata and data chunks are redistributed to the remaining drives then you are adding a drive, which will need to balance again when you convert to RAID6.

If you need to add a drive(s) add them all before balance/convert.

btrfs device add /dev/sdc /mnt
btrfs device add /dev/sdd /mnt

Balance Filters - btrfs.wiki.kernel.org

btrfs balance "convert" example from link (updated):

btrfs balance start -dusage=90 -dconvert=raid6 -mconvert=raid6 /mnt

-dusage is the usage threshold for your data chunk balancing.

-dconvert is for the data

-mconvert is for the metadata

the /mnt is where the BTRFS volume is mounted. You cannot do this unmounted.

btrfs data and/or metadata can be:

  1. single
  2. raid0
  3. raid01
  4. raid1
  5. raid5
  6. raid6
  7. raid1c3
  8. raid1c4

Commands to pause, resume, cancel or get status can be used.

btrfs balance pause /mnt
btrfs balance resume /mnt
btrfs balance cancel /mnt
btrfs balance status -v /mnt

Caveats

  1. Depending on how much data you have on the drives the balance takes time.
  2. There is a chance of the balance failing and corrupting the array and/or putting it into an unstable read only mode.
  3. Backup data before converting.
  4. Make sure you're running the latest stable Linux kernel.

You must log in to answer this question.

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