[pve-devel] [PATCH installer 1/2] zfs: set canmount=off on /var/lib

Stoiko Ivanov s.ivanov at proxmox.com
Tue Nov 21 12:09:58 CET 2023


as explained in zfsprops(4) setting canmount to off is similar to
setting mountpoint to none - except that you can still use the dataset
for storing properties to be inherited to children (and we want
/var/lib/vz to have a mountpoint set)

Follows recommendations from upstreams ZFS on / guide:
https://openzfs.github.io/openzfs-docs/Getting%20Started/Debian/Debian%20Bookworm%20Root%20on%20ZFS.html

Fixes: dd19d40ceac179ba18652f1d6c3e4c23f246af00
Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 Proxmox/Install.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 1a4ee93..fd9bf84 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -189,6 +189,10 @@ sub zfs_create_rpool {
 	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 set canmount=off $pool_name/ROOT/$root_volume_name/var/lib")  == 0 ||
+	    die "unable to set canmount property on $pool_name/ROOT/$root_volume_name/var/lib\n";
+	syscmd("zfs set canmount=off $pool_name/ROOT/$root_volume_name/var")  == 0 ||
+	    die "unable to set canmount property on $pool_name/ROOT/$root_volume_name/var\n";
     }
 
     # default to `relatime` on, fast enough for the installer and production
-- 
2.39.2






More information about the pve-devel mailing list