--- Begin Message ---
Il 10/01/2025 18:00, Daniel Kral ha scritto:
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.

btrfs profiles work differently but other hardware or software raids,
many users may not inform themselves well beforehand but even in the
case of informed users even if technically now btrfs allows lower limits
with the creation of raid 0 (and raid10) I think it would be better to
keep them at the base at the creation and then it must be the user who
consciously makes any subsequent conversions.

regarding btrfs profiles at creation, one thing that could be useful is
to always put duplicate metadata (dup with single disk or raid 1 in the
case of raid0), if you don't want it by default maybe put it as an
additional option, and if you don't want that either at least add it to
the documentation (as a suggestion if you want greater resilience of the
filesystem without consuming excessive space)


[0] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=b2f78e88052bc0bee56bbf646d245fcfb431a873

Signed-off-by: Daniel Kral <d.k...@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());
      }




--
Questa email รจ stata esaminata alla ricerca di virus dal software antivirus 
Avast.
www.avast.com


--- End Message ---
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to