Announcement

Collapse
No announcement yet.

RAID1 and JBOD

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    RAID1 and JBOD

    Btrfs RAID1 is not exactly like the traditional RAID1. In traditional mdadm based RAID if you have two 1 TB disks configured to mirror each other in RAID1 mode, and you want to expand this setup, you basically need to install two more disks, and they need to be of equal size. In btrfs, life is much more flexible.

    To expand an array, you can add a disk of any size and btrfs will automatically adjust to the sitation. So if you have two 1 TB disks, and you add a 2 TB disk to the array, then all 4 TB would be utilised and you will have 2 TB of usable storage. Btrfs will make sure that as RAID 1 mandates, each file will exist in two copies and those copies are stored on physically different disks. If you would expand the two 1 TB array with one 1 TB disk, then btrfs would give you 1,5 TB of usable disk space in total while still satisfying the RAID 1 replicate requirements. IOW, if you want a traditional RAID1 in Btrfs you will need to use THREE HDs, not just two.


    Assume you have two internal HDs, each about the same size. You've installed Kubuntu or Neon on sda1 and now you are going to add sdb1 in order to double your pool space. This does not create a RAID1 configuration.

    sudo -i
    btrfs device add /dev/sdb1 /


    Now you need to balance the data across both drives:
    btrfs balance /
    Depending on how much data was on sda1 this balance operation may take a long time. This is RAID0 ("stripping"), which can be thought of as a way of concatenating multiple physical disks together into a single, larger virtual drive. A strict striping implementation distributes data across the drives in a well-defined set of "stripes"; as a result, all of the drives must be the same size, and the total capacity is simply the product of the number of drives and the capacity of any individual drive in the array. Btrfs can be a bit more flexible than this, though, supporting a concatenation mode (called "single") which can work with unequally sized drives. In theory, any number of drives can be combined into a RAID 0 or "single" array.

    When you open a Konsole and sudo -i to root you can mount that pool to /mnt using
    mount /dev/device/by-uuid/uuidofsda1orsdb1 /mnt

    You decide to convert that two disk pool into a Btrfs RAID1 configuration.
    btrfs balance start -dconvert=raid1 -mconvert=raid1 -sconvert=raid1 /
    -d is data, -m is metadata and -s is system
    You'll then need to balance the system.

    That operation created a two disk Btrfs RAID1 configuration. For true RAID1 add a 3rd HD and balance again.

    You can convert RAID1 back to RAID0 by reversing the balance operation:
    btrfs balance start -dconvert=single -mconvert=single -sconvert=single /
    IF you want to mirror the metadata in RAID0 then use -mconvert=raid1 instead.
    More information is given here.
    Last edited by GreyGeek; Jul 18, 2018, 09:46 PM.
    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
    – John F. Kennedy, February 26, 1962.
Working...
X