* [pve-devel] [PATCH installer v2] zfs: create dataset var-lib-vz for /var/lib/vz
@ 2023-11-21 13:11 Stoiko Ivanov
2023-11-21 13:22 ` [pve-devel] applied: " Thomas Lamprecht
0 siblings, 1 reply; 2+ messages in thread
From: Stoiko Ivanov @ 2023-11-21 13:11 UTC (permalink / raw)
To: pve-devel
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 <f.gruenbichler@proxmox.com>
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [pve-devel] applied: [PATCH installer v2] zfs: create dataset var-lib-vz for /var/lib/vz
2023-11-21 13:11 [pve-devel] [PATCH installer v2] zfs: create dataset var-lib-vz for /var/lib/vz Stoiko Ivanov
@ 2023-11-21 13:22 ` Thomas Lamprecht
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2023-11-21 13:22 UTC (permalink / raw)
To: Proxmox VE development discussion, Stoiko Ivanov
Am 21/11/2023 um 14:11 schrieb Stoiko Ivanov:
> 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 <f.gruenbichler@proxmox.com>
> Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
> ---
> 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(-)
>
>
applied, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-21 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-21 13:11 [pve-devel] [PATCH installer v2] zfs: create dataset var-lib-vz for /var/lib/vz Stoiko Ivanov
2023-11-21 13:22 ` [pve-devel] applied: " Thomas Lamprecht
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal