From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id AC2FA1FF173 for ; Mon, 13 Jan 2025 13:15:52 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7172A2DD75; Mon, 13 Jan 2025 13:15:34 +0100 (CET) Date: Mon, 13 Jan 2025 13:15:23 +0100 To: Proxmox VE development discussion , Daniel Kral References: <20250110170040.201474-1-d.kral@proxmox.com> In-Reply-To: <20250110170040.201474-1-d.kral@proxmox.com> MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Fabio Fantoni via pve-devel Precedence: list Cc: Fabio Fantoni X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: Re: [pve-devel] [RFC PATCH 1/2] install: btrfs: fix raid level falling back to single mode Content-Type: multipart/mixed; boundary="===============7987464813613640524==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============7987464813613640524== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id CB5FCCC3F8 for ; Mon, 13 Jan 2025 13:15:32 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AAE642DD4F for ; Mon, 13 Jan 2025 13:15:32 +0100 (CET) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 13 Jan 2025 13:15:32 +0100 (CET) Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-aab925654d9so92904066b.2 for ; Mon, 13 Jan 2025 04:15:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=m2r-biz.20230601.gappssmtp.com; s=20230601; t=1736770525; x=1737375325; darn=lists.proxmox.com; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=gULsF7diJtkpfjk8sdaKKyTUutlaxCXhJjVQSha6Z68=; b=m5VbeK/PZBLzG6VlXURQ8vhXjL0KSB8gIJrzc03H0d46zetjtAINtAQLtGRgf8DSOR wL4ZT2RvozWmzCBKLmGIdV09kBadgGZ8BCxgJFFPXr7FznyR7NWfECTkzcxFXBz3tGZq u+T5DKOUHHIcQGhRwOueovegLe1rwqt2ltj8g27sLP7xB8doA0LQBGF/sUVdS4/4Qrij de7xm/54yTh8J4MKcHhEMNvycM3SN61+F/yl9Y3yrsQQDkTsuRdBVwZxQJd6c4Uc6A7V 3DTg4lffmkoCiTIlrE784WNN6oQ8HlZl7k0+8z15rcidSt6MFpLsXkbWwzLGBrJLw8Ig f9ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736770525; x=1737375325; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=gULsF7diJtkpfjk8sdaKKyTUutlaxCXhJjVQSha6Z68=; b=CDr5JfYkuZwjHSa4hZkuFrDj7fDVbgoZ0zFJMyUTyYUiNz5XdFULt+kjuUBEcDti7a GnvWf6KkjroCwnyJLTrCqEZafeiGxz8xv3jou8WPgIk7hXGkII9D3JDW12L3odD2jOzq guB6KdYo7RV6Yx/0o//Y2BUyyfjDEz9rQGqyvBKlc7ZOuVHu6A+12ZRzhkV6M6eEtVud /mOuJnZXdvZunxpkFvIxGmMIvidBnZO1T/1/iUK4efyvE5EWFyrHa5UoLtVyEyutqccD tCc3hBcE0fwJGqGuWOsIGFtbl51T80xcB4xYvN5rJTG3bQCA+uhBV05eQzRw6Qqn3AN7 xHMA== X-Gm-Message-State: AOJu0YztPUnQLZ1X34/UYfNSL+HFuOYVGCLMRtY4shDYgCDUPoTeG358 6otu21fWAVFpAUkUHrJ0OwmQIvDIupSVRuAEjrgjLCokJzNCC2H09k/60pAq2ZRSOIdyPckneTY W X-Gm-Gg: ASbGncu0OS83GfgV3VxUgISspby+m9maq/lK/gFEzzXvZM6AXLbL3mec87t8nrTlPdI yNdIGvOt2YNRZs7oKKjrj1ZvMTUA7wlV6+jYyO9ZM7zGQPIZaQ6aBqYuc2hpNAN9Du+j65cJeY0 eqPclauPy40RN51P6V12n5/KZvapaDWuF7BXfLfrl6H0g/qynTggQO4VDMqGXLBxAZiB6a+9j5K E2YjRcip53aFxAWAUw2Vc3QZ557PiaWJLDJQobAzT/wpISM2B5hHeaikJr0AccNB+bzqZoYdXVi aHfdtUqH4Ihoo2U8WOdoHsIu49yLpvdWVHcKk+OgKI/QoIs= X-Google-Smtp-Source: AGHT+IHqreJUAd1fCK9nkaMCOjFWwYzVB+gPZjMyE0Arrqj7i5vTMa5TYzt0Ji3g5ZEPspLQfvZyKg== X-Received: by 2002:a17:906:ef0b:b0:aa6:8096:204d with SMTP id a640c23a62f3a-ab2ab6a8e78mr2049828966b.3.1736770525402; Mon, 13 Jan 2025 04:15:25 -0800 (PST) Received: from [192.168.178.27] (host-79-16-223-149.retail.telecomitalia.it. [79.16.223.149]) by smtp.googlemail.com with ESMTPSA id a640c23a62f3a-ab2c95647efsm493110366b.117.2025.01.13.04.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2025 04:15:24 -0800 (PST) Message-ID: Date: Mon, 13 Jan 2025 13:15:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [pve-devel] [RFC PATCH 1/2] install: btrfs: fix raid level falling back to single mode Content-Language: it To: Proxmox VE development discussion , Daniel Kral References: <20250110170040.201474-1-d.kral@proxmox.com> From: Fabio Fantoni In-Reply-To: <20250110170040.201474-1-d.kral@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Antivirus: Avast (VPS 250113-2, 13/1/2025), Outbound message X-Antivirus-Status: Clean X-SPAM-LEVEL: Spam detection results: 0 BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DMARC_PASS -0.1 DMARC pass policy JMQ_SPF_NEUTRAL 0.5 SPF set to ?all KAM_INFOUSMEBIZ 0.75 Prevalent use of .info|.us|.me|.me.uk|.biz|xyz|id|rocks|life domains in spam/malware RCVD_IN_DNSWL_NONE -0.0001 Sender listed at https://www.dnswl.org/, no trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Il 10/01/2025 18:00, Daniel Kral ha scritto: > From a user's perspective, the BTRFS single mode has been removed since > d85180e ("tui: rename raid levels 0/1 to align with GUI installer"). The > user can now only select at least the "RAID0" level, but if a user > selects any raid level with only one disk configured on the system, > BTRFS will be setup in 'single' mode instead of the chosen raid level. > > The TUI installer has a separate check for this, but the GUI installer > as well as the auto installer will silently fallback to single mode, > which could be confusing for and unwanted by the user. > > Therefore, remove the BTRFS single mode from being selected when > configuring disks in the GUI installer and during the installation in > general, which makes the auto installer fail if the wrong amount of > disks are selected for the specified raid level. This makes btrfs' raid > disk count validation align with the one from zfs. > > Signed-off-by: Daniel Kral > --- > > Discussion > > BTRFS didn't allow a single-disk RAID0 configuration before kernel 5.15 > and AFAIK also silently used the single profile for that case, but this > has changed since then. > > If we want users to still be able to create a BTRFS filesystem in single > mode (which seems very reasonable), I can do a v2 or followup to add a > "btrfs (single)" entry to the disk setup. Hi, I think is better to add also "single" mode > > Testing > > I have tested this by the usual installer test procedure (debug shell, > patch files, launch target installer manually) and the GUI installer > disallows creating a btrfs raid1 or raid10 with only one disk, but > allows it with at least the correct amount of disks. The same applies to > the autoinstaller with the same test cases. > > Unpatched a single-disk RAID0 install resulted in: > > ``` > root@pve:~# btrfs filesystem usage -T . > [ ... ] > Data Metadata System > Id Path single single single Unallocated Total Slack > -- --------- ------ --------- -------- ----------- -------- ------- > 1 /dev/sda3 4.01GB 520.00MiB 4.00MiB 26.98GiB 31.50GiB 3.50KiB > [ ... ] > ``` > > and patched a single-disk RAID0 install results in: > > ``` > ``` > root@pve:~# btrfs filesystem usage -T . > [ ... ] > Data Metadata System > Id Path RAID0 RAID0 RAID0 Unallocated Total Slack > -- --------- ------ --------- -------- ----------- -------- ------- > 1 /dev/sda3 4.00GB 512.00MiB 8.00MiB 26.99GiB 31.50GiB 3.50KiB > [ ... ] > ``` > ``` > > Proxmox/Install.pm | 22 +++++++++------------- > 1 file changed, 9 insertions(+), 13 deletions(-) > > diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm > index c0a17b2..b72a83e 100644 > --- a/Proxmox/Install.pm > +++ b/Proxmox/Install.pm > @@ -359,20 +359,16 @@ sub get_btrfs_raid_setup { > > my $mode; > > - if ($diskcount =3D=3D 1) { > - $mode =3D 'single'; > + if ($filesys eq 'btrfs (RAID0)') { > + $mode =3D 'raid0'; > + } elsif ($filesys eq 'btrfs (RAID1)') { > + die "btrfs (RAID1) needs at least 2 devices\n" if $diskcount < 2; > + $mode =3D 'raid1'; > + } elsif ($filesys eq 'btrfs (RAID10)') { > + die "btrfs (RAID10) needs at least 4 devices\n" if $diskcount < 4; > + $mode =3D 'raid10'; > } else { > - if ($filesys eq 'btrfs (RAID0)') { > - $mode =3D 'raid0'; > - } elsif ($filesys eq 'btrfs (RAID1)') { > - die "btrfs (RAID1) needs at least 2 devices\n" if $diskcount < 2; > - $mode =3D 'raid1'; > - } elsif ($filesys eq 'btrfs (RAID10)') { > - die "btrfs (RAID10) needs at least 4 devices\n" if $diskcount < 4; > - $mode =3D 'raid10'; > - } else { > - die "unknown btrfs mode '$filesys'\n"; > - } > + die "unknown btrfs mode '$filesys'\n"; > } > > return ($devlist, $mode); -- Questa email =C3=A8 stata esaminata alla ricerca di virus dal software anti= virus Avast. www.avast.com --===============7987464813613640524== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============7987464813613640524==--