meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
linux:fs:btrfs_multidisk [2017/02/07 09:53] niziak [Grub] |
linux:fs:btrfs_multidisk [2021/02/16 21:07] (current) niziak |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== BTRFS on multiple devices ====== | ====== BTRFS on multiple devices ====== | ||
+ | |||
+ | [[https://serverfault.com/questions/814546/how-to-obtain-read-speeds-of-two-disks-using-mdadm-btrfs-raid1-or-zfs-mirror]] | ||
+ | |||
+ | ===== Encryption layout ===== | ||
+ | |||
+ | ==== BTRFS on crypted devices ==== | ||
+ | | btrfs raid1 || | ||
+ | | crypt | crypt | | ||
+ | | sda1 | sdb1 | | ||
+ | |||
+ | * (-) Encryption has to be performed twice (no problem for modern CPUs) | ||
+ | * (+) Bit-flips can be detected immediately and corrected by BTRFS | ||
+ | * (-) not possible to get benefit from hybrid RAID1 (mixed disc HDD & SSD) | ||
+ | |||
+ | |||
+ | ==== BTRFS on crypted devices with LVM ==== | ||
+ | |||
+ | | btrfs raid1 || | ||
+ | | crypt | crypt | | ||
+ | | LVM | LVM | | ||
+ | | (DM-Cache on fast SSD) || | ||
+ | | sda1 | sdb1 | | | ||
+ | |||
+ | * (-) Encryption has to be performed twice (no problem for modern CPUs) | ||
+ | * (+) Bit-flips can be detected immediately and corrected by BTRFS | ||
+ | * (-) not possible to get benefit from hybrid RAID1 (mixed disc HDD & SSD) | ||
+ | * (-) small overhead from LVM but | ||
+ | * (+) DM-cache with SSD disc can be used: [[https://www.redhat.com/en/blog/improving-read-performance-dm-cache]] | ||
+ | |||
+ | ==== BTRFS on soft RAID1 ==== | ||
+ | | btrfs || | ||
+ | | crypt || | ||
+ | | raid1 || | ||
+ | | sda1 | sdb1 | | ||
+ | |||
+ | * (+) encryption performed only once (less CPU consumption) | ||
+ | * (-) Bit-flips detected only during RAID1 scan. | ||
+ | * (+) Benefits from hybrid RAID1 (SSH & HHD) using "writemostly" feature). See [[http://tansi.info/hybrid/]] | ||
+ | |||
+ | |||
===== Prepare 2nd disc ===== | ===== Prepare 2nd disc ===== | ||
Line 18: | Line 58: | ||
===== btrfs 2nd disk ===== | ===== btrfs 2nd disk ===== | ||
- | Add 2nd disc to btrfs: | + | ==== Add 2nd disc to btrfs ==== |
<code bash> | <code bash> | ||
btrfs device add /dev/disc1/btrfs1 / | btrfs device add /dev/disc1/btrfs1 / | ||
btrfs device usage / | btrfs device usage / | ||
- | btrfs balance start -v -dconvert=raid1 -mconvert=raid1 / | + | nice ionice -c3 btrfs balance start -v -dconvert=raid1 -mconvert=raid1 -dsoft -msoft / |
btrfs device usage / | btrfs device usage / | ||
</code> | </code> | ||
+ | Note: "soft" filter will convert only chunks which are not already converted (usefull when previous balance was incomplete) | ||
+ | |||
Make sure that data on both disc are the same. Especially system data are on both disc in RAID1 mode. | Make sure that data on both disc are the same. Especially system data are on both disc in RAID1 mode. | ||
Line 46: | Line 88: | ||
</code> | </code> | ||
+ | |||
+ | OR | ||
+ | |||
+ | ==== Create blank 2nd disc ==== | ||
+ | NOT POSSIBLE: | ||
+ | |||
+ | <del>Create degraded RAID1 with single disc (to add 2nd later)</del> | ||
+ | <code bash> | ||
+ | mkfs.btrfs -d raid1 -m raid1 -L btrfs_pool2 /dev/mapper/pool2 | ||
+ | </code> | ||
+ | |||
==== Balance command ==== | ==== Balance command ==== | ||
Line 141: | Line 194: | ||
WORKS! | WORKS! | ||
- | ==== Grub ==== | + | ==== Grub wrong root= ==== |
=== PROBLEM === | === PROBLEM === | ||
**''grub-pc'' 2.02~beta2-22+deb8u1 0** incorrectly handle multiple roots. Internal variable ${GRUB_DEVICE} which is used to generate ''root='' parameter include newline character, so grub menuconfig entry is broken: | **''grub-pc'' 2.02~beta2-22+deb8u1 0** incorrectly handle multiple roots. Internal variable ${GRUB_DEVICE} which is used to generate ''root='' parameter include newline character, so grub menuconfig entry is broken: | ||
Line 151: | Line 204: | ||
* [[https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1238347]] | * [[https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1238347]] | ||
* [[https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1582811]] | * [[https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1582811]] | ||
+ | |||
=== SOLUTION === | === SOLUTION === | ||
Fixed in Debian Stretch (testing) version **grub-pc_2.02~beta3-3** | Fixed in Debian Stretch (testing) version **grub-pc_2.02~beta3-3** |