[pve-devel] [PATCH installer 3/3] fix #6285: install: always set up zfs modprobe configuration

Christoph Heiss c.heiss at proxmox.com
Fri Apr 4 14:46:48 CEST 2025


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 at 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





More information about the pve-devel mailing list