From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 7D9D71FF190 for ; Fri, 10 Jan 2025 18:01:05 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9CD08239; Fri, 10 Jan 2025 18:00:51 +0100 (CET) From: Daniel Kral To: pve-devel@lists.proxmox.com Date: Fri, 10 Jan 2025 18:00:40 +0100 Message-Id: <20250110170040.201474-2-d.kral@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250110170040.201474-1-d.kral@proxmox.com> References: <20250110170040.201474-1-d.kral@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.241 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [RFC PATCH 2/2] common: btrfs: lower minimum amount of disks for raid10 to 2 X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" As the installer allows single-disk RAID0 configurations and BTRFS allows to create a filesystem with the RAID10 profile with only two disks since kernel version 5.15 [0], lower the minimum amount of disks the installer requires for a BTRFS RAID10 setup. The motiviation for this is to allow users to create a BTRFS RAID10 configuration even though they do not have the necessary disks ready at setup time itself without needing to convert the profile afterwards. [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b2f78e88052bc0bee56bbf646d245fcfb431a873 Signed-off-by: Daniel Kral --- Discussion If this patch seems like something worthwile, I think it would be necessary to have some sort of warning popup for 2 <= $diskcount < 4 in RAID10, and maybe also the same for $diskcount == 1 in RAID0, that there's no advantage to create a degenerate RAID0/10 without planning to add at least 1/2 disks later. I would add this in a v2 or followup if this gets ACKed. Proxmox/Install.pm | 2 +- proxmox-installer-common/src/disk_checks.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm index b72a83e..d52d17b 100644 --- a/Proxmox/Install.pm +++ b/Proxmox/Install.pm @@ -365,7 +365,7 @@ sub get_btrfs_raid_setup { die "btrfs (RAID1) needs at least 2 devices\n" if $diskcount < 2; $mode = 'raid1'; } elsif ($filesys eq 'btrfs (RAID10)') { - die "btrfs (RAID10) needs at least 4 devices\n" if $diskcount < 4; + die "btrfs (RAID10) needs at least 2 devices\n" if $diskcount < 2; $mode = 'raid10'; } else { die "unknown btrfs mode '$filesys'\n"; diff --git a/proxmox-installer-common/src/disk_checks.rs b/proxmox-installer-common/src/disk_checks.rs index ecc43bd..bd1c54c 100644 --- a/proxmox-installer-common/src/disk_checks.rs +++ b/proxmox-installer-common/src/disk_checks.rs @@ -129,7 +129,7 @@ pub fn check_btrfs_raid_config(level: BtrfsRaidLevel, disks: &[Disk]) -> Result< match level { BtrfsRaidLevel::Raid0 => check_raid_min_disks(disks, 1)?, BtrfsRaidLevel::Raid1 => check_raid_min_disks(disks, 2)?, - BtrfsRaidLevel::Raid10 => check_raid_min_disks(disks, 4)?, + BtrfsRaidLevel::Raid10 => check_raid_min_disks(disks, 2)?, } Ok(()) @@ -204,8 +204,8 @@ mod tests { assert!(check_btrfs_raid_config(BtrfsRaidLevel::Raid1, &disks).is_ok()); assert!(check_btrfs_raid_config(BtrfsRaidLevel::Raid10, &[]).is_err()); - assert!(check_btrfs_raid_config(BtrfsRaidLevel::Raid10, &disks[..3]).is_err()); - assert!(check_btrfs_raid_config(BtrfsRaidLevel::Raid10, &disks[..4]).is_ok()); + assert!(check_btrfs_raid_config(BtrfsRaidLevel::Raid10, &disks[..1]).is_err()); + assert!(check_btrfs_raid_config(BtrfsRaidLevel::Raid10, &disks[..2]).is_ok()); assert!(check_btrfs_raid_config(BtrfsRaidLevel::Raid10, &disks).is_ok()); } -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel