From 53c4e289c237e4f1008fdec54256e81c24c8882a Mon Sep 17 00:00:00 2001 From: Qu Wenruo Date: Tue, 6 Sep 2016 17:35:06 +0200 Subject: [PATCH] btrfs-progs: mkfs: Warn user for minimal RAID5/6 devices setup For RAID5, 2 devices setup is just RAID1 with more overhead. For RAID6, 3 devices setup is RAID1 with 3 copies, not what most user want. So warn user at mkfs time for such case, and add explain in man pages. Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- Documentation/mkfs.btrfs.asciidoc | 16 ++++++++++++---- utils.c | 10 ++++++++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Documentation/mkfs.btrfs.asciidoc b/Documentation/mkfs.btrfs.asciidoc index 98fe694b..7d19a146 100644 --- a/Documentation/mkfs.btrfs.asciidoc +++ b/Documentation/mkfs.btrfs.asciidoc @@ -263,18 +263,26 @@ There are the following block group types available: .2+^. 1 && - ((metadata_profile | data_profile) & BTRFS_BLOCK_GROUP_DUP)) { + if (dev_cnt > 1 && profile & BTRFS_BLOCK_GROUP_DUP) { warning("DUP is not recommended on filesystem with multiple devices"); } if (metadata_profile & ~allowed) { @@ -3315,6 +3315,12 @@ int test_num_disk_vs_raid(u64 metadata_profile, u64 data_profile, return 1; } + if (dev_cnt == 3 && profile & BTRFS_BLOCK_GROUP_RAID6) { + warning("RAID6 is not recommended on filesystem with 3 devices only"); + } + if (dev_cnt == 2 && profile & BTRFS_BLOCK_GROUP_RAID5) { + warning("RAID5 is not recommended on filesystem with 2 devices only"); + } warning_on(!mixed && (data_profile & BTRFS_BLOCK_GROUP_DUP) && ssd, "DUP may not actually lead to 2 copies on the device, see manual page");