[PATCH 1/2] zfs_create_rpool: add support for native encryption

Gregor Michels hirnpfirsich at brainpeach.de
Thu Mar 31 00:22:08 CEST 2022


---
 proxinstall | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index 8ec7d2c..7dd22b7 100755
--- a/proxinstall
+++ b/proxinstall
@@ -886,7 +886,14 @@ sub zfs_create_rpool {
     $cmd .= " -o ashift=$config_options->{ashift}"
         if defined($config_options->{ashift});
 
-    syscmd("$cmd $zfspoolname $vdev") == 0 ||
+    $cmd .= " -O encryption=on -O keylocation=prompt -O keyformat=passphrase"
+        if (defined($config_options->{zfs_passphrase}) && $config_options->{zfs_passphrase} ne '');
+
+    my $stdin = undef;
+    $stdin = $config_options->{zfs_passphrase}
+        if (defined($config_options->{zfs_passphrase}) && $config_options->{zfs_passphrase} ne '');
+
+    run_command("$cmd $zfspoolname $vdev", undef, $stdin, 1) == 0 ||
 	die "unable to create zfs root pool\n";
 
     syscmd("zfs create $zfspoolname/ROOT")  == 0 ||
-- 
2.20.1





More information about the pve-devel mailing list