From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 378E79BD1A for ; Tue, 21 Nov 2023 14:11:31 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0F6359D1E for ; Tue, 21 Nov 2023 14:11:31 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 21 Nov 2023 14:11:30 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 35C654105E for ; Tue, 21 Nov 2023 14:11:30 +0100 (CET) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Tue, 21 Nov 2023 14:11:18 +0100 Message-Id: <20231121131118.717293-1-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.061 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 POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH installer v2] zfs: create dataset var-lib-vz for /var/lib/vz X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Nov 2023 13:11:31 -0000 Creating rpool/var/lib/vz and all intermediate datasets causes a service-failure of `var.mount` upon shutdown. creating the dataset for /var/lib/vz directly at the rpool and setting its mountpoint property seems the most robust way to address this. The alternative approach of setting `canmount=off` on the `var` dataset seems a bit dangerous (users setting a zfs property and suddenly hiding their /var contents). The only small downside to this approach is that the setting of the mountpoint happens quite a bit after extracting the data - but this would probably be better addressed with a refactoring of the lowlevel-installer code (setting the zfs-pool up under /target and getting rid of a few special cases) Fixes: dd19d40ceac179ba18652f1d6c3e4c23f246af00 Suggested-by: Fabian Grünbichler Signed-off-by: Stoiko Ivanov --- huge Thanks to Fabian - for the feedback and patiently walking me through the potential pitfalls! Proxmox/Install.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm index 811db8c..1ed38c1 100644 --- a/Proxmox/Install.pm +++ b/Proxmox/Install.pm @@ -187,8 +187,8 @@ sub zfs_create_rpool { if ($iso_env->{product} eq 'pve') { syscmd("zfs create $pool_name/data") == 0 || die "unable to create zfs $pool_name/data volume\n"; - syscmd("zfs create -p $pool_name/ROOT/$root_volume_name/var/lib/vz") == 0 || - die "unable to create zfs $pool_name/ROOT/$root_volume_name/var/lib/vz volume\n"; + syscmd("zfs create -o mountpoint=/$pool_name/ROOT/$root_volume_name/var/lib/vz $pool_name/var-lib-vz") == 0 || + die "unable to create zfs $pool_name/var-lib-vz volume\n"; } # default to `relatime` on, fast enough for the installer and production @@ -1335,6 +1335,11 @@ _EOD syscmd("zfs set mountpoint=/ $zfs_pool_name/ROOT/$zfs_root_volume_name") == 0 || die "zfs set mountpoint failed\n"; + if ($iso_env->{product} eq 'pve') { + syscmd("zfs set mountpoint=/var/lib/vz $zfs_pool_name/var-lib-vz") == 0 || + die "zfs set mountpoint for var-lib-vz failed\n"; + } + syscmd("zpool set bootfs=$zfs_pool_name/ROOT/$zfs_root_volume_name $zfs_pool_name") == 0 || die "zpool set bootfs failed\n"; syscmd("zpool export $zfs_pool_name"); -- 2.39.2