fix #6285: install: always set up zfs modprobe configuration

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>
This commit is contained in:
Christoph Heiss 2025-04-04 14:46:48 +02:00 committed by Thomas Lamprecht
parent 8e25640574
commit 7ac398a4b9

View File

@ -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");