From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 64AD81FF189
	for <inbox@lore.proxmox.com>; Fri,  4 Apr 2025 14:47:21 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 716A71EF4D;
	Fri,  4 Apr 2025 14:47:00 +0200 (CEST)
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Fri,  4 Apr 2025 14:46:48 +0200
Message-ID: <20250404124651.1283950-4-c.heiss@proxmox.com>
X-Mailer: git-send-email 2.48.1
In-Reply-To: <20250404124651.1283950-1-c.heiss@proxmox.com>
References: <20250404124651.1283950-1-c.heiss@proxmox.com>
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.030 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
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [install.pm, proxmox.com]
Subject: [pve-devel] [PATCH installer 3/3] fix #6285: install: always set up
 zfs modprobe configuration
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

Fixes #6285 [0].

Came up a few times now in the forum (most recently [0], german) and is
a potential source of confusion for users, if the file does not exist on
(new) installations.

It makes indeed sense to just unconditionally write to
/etc/modprobe.d/zfs.conf. Often users create a separate ZFS pool after
installation, on separate disks, where it still makes sense to have a
more sensible zfs_arc_max default, at least on PVE.

It has been also exposed for all products, with sensible defaults each,
for some time now [1][2].

[0] https://bugzilla.proxmox.com/show_bug.cgi?id=6285
[1] https://forum.proxmox.com/threads/ram-auslastung-nimmt-%C3%BCber-die-zeit-drastisch-zu.164527/#post-760989
[2] https://git.proxmox.com/?p=pve-installer.git;a=commitdiff;h=a42a9db20976fbc0abb35d53416cee926b6efafe
[3] https://git.proxmox.com/?p=pve-installer.git;a=commitdiff;h=8772ebc35a7f43b97f5433c4d328ea784eaf902c

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 Proxmox/Install.pm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 57fd899..2e9b131 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -340,9 +340,7 @@ my sub zfs_setup_module_conf {
     my $arc_max_mib = Proxmox::Install::Config::get_zfs_opt('arc_max');
     my $arc_max = Proxmox::Install::RunEnv::clamp_zfs_arc_max($arc_max_mib) * 1024 * 1024;
 
-    if ($arc_max > 0) {
-	file_write_all("$targetdir/etc/modprobe.d/zfs.conf", "options zfs zfs_arc_max=$arc_max\n")
-    }
+    file_write_all("$targetdir/etc/modprobe.d/zfs.conf", "options zfs zfs_arc_max=$arc_max\n");
 }
 
 sub get_btrfs_raid_setup {
@@ -1329,10 +1327,13 @@ _EOD
 	    file_write_all("$targetdir/etc/default/grub.d/zfs.cfg", $zfs_snippet);
 
 	    file_write_all("$targetdir/etc/kernel/cmdline", "root=ZFS=$zfs_pool_name/ROOT/$zfs_root_volume_name boot=zfs $target_cmdline\n");
-
-	    zfs_setup_module_conf($targetdir);
 	}
 
+	# Always write zfs module parameter - even if the user did not select ZFS-on-root.
+	# It still makes sense to provide a sensible default for zfs_arc_max, in case a
+	# separate zfs pool is created afterwards.
+	zfs_setup_module_conf($targetdir);
+
 	diversion_remove($targetdir, "/usr/sbin/update-grub");
 	diversion_remove($targetdir, "/usr/sbin/update-initramfs");
 
-- 
2.48.1



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