From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH 2/2] common: btrfs: lower minimum amount of disks for raid10 to 2
Date: Fri, 10 Jan 2025 18:00:40 +0100 [thread overview]
Message-ID: <20250110170040.201474-2-d.kral@proxmox.com> (raw)
In-Reply-To: <20250110170040.201474-1-d.kral@proxmox.com>
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 <d.kral@proxmox.com>
---
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
prev parent reply other threads:[~2025-01-10 17:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 17:00 [pve-devel] [RFC PATCH 1/2] install: btrfs: fix raid level falling back to single mode Daniel Kral
2025-01-10 17:00 ` Daniel Kral [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250110170040.201474-2-d.kral@proxmox.com \
--to=d.kral@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox