[pve-devel] [PATCH installer] gui: don't assume 'single' btrfs mode if user selects exactely 1 disk
Shannon Sterz
s.sterz at proxmox.com
Wed Jul 16 15:25:57 CEST 2025
assuming 'single' mode if the user selects exactely one disk can lead
to unexpected results. for example, if a user sets up a raid10 with
one disk, the installer will happily install it as a 'single' install.
doing the same with two disks fails with an error that for raid10 at
least 4 disks are required.
this is also inconsistent with the tui installer that will always
complain about the amount of disks not being correct.
Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
Proxmox/Install.pm | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 1689097..3159dcc 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -363,20 +363,16 @@ sub get_btrfs_raid_setup {
my $mode;
- if ($diskcount == 1) {
- $mode = 'single';
+ if ($filesys eq 'btrfs (RAID0)') {
+ $mode = 'raid0';
+ } elsif ($filesys eq 'btrfs (RAID1)') {
+ die "$filesys: need at least 2 devices\n" if $diskcount < 2;
+ $mode = 'raid1';
+ } elsif ($filesys eq 'btrfs (RAID10)') {
+ die "$filesys: need at least 4 devices\n" if $diskcount < 4;
+ $mode = 'raid10';
} else {
- if ($filesys eq 'btrfs (RAID0)') {
- $mode = 'raid0';
- } elsif ($filesys eq 'btrfs (RAID1)') {
- die "$filesys: need at least 2 devices\n" if $diskcount < 2;
- $mode = 'raid1';
- } elsif ($filesys eq 'btrfs (RAID10)') {
- die "$filesys: need at least 4 devices\n" if $diskcount < 4;
- $mode = 'raid10';
- } else {
- die "unknown btrfs mode '$filesys'\n";
- }
+ die "unknown btrfs mode '$filesys'\n";
}
return ($devlist, $mode);
--
2.39.5
More information about the pve-devel
mailing list