[pve-devel] [RFC/PATCH v2 installer 3/3] do not create a swap zvol

Stoiko Ivanov s.ivanov at proxmox.com
Thu Nov 15 18:02:03 CET 2018


Using zvols as swap devices does create deadlocks for users, as of zfs 0.7.9.
As the discussion of the issue [0] shows, fixing this is involved, and probably
won't be happening anytime soon (before zfs 0.8).

Not creating swap as a zvol seems like the better default setting for now.

Users needing swap can either leave unpartitioned space, by setting minfree,
or create the zvol quite easily after installation

[0] https://github.com/zfsonlinux/zfs/issues/7734

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 proxinstall | 33 ---------------------------------
 1 file changed, 33 deletions(-)

diff --git a/proxinstall b/proxinstall
index 420da8a..e6e67f3 100755
--- a/proxinstall
+++ b/proxinstall
@@ -814,36 +814,6 @@ sub zfs_create_rpool {
         if defined($value) && $value != 1;
 }
 
-sub zfs_create_swap {
-    my ($swapsize) = @_;
-
-    my $cmd = "zfs create -V ${swapsize}K -b 4K";
-
-    $cmd .= " -o com.sun:auto-snapshot=false";
-
-    # copies for swap does not make sense
-    $cmd .= " -o copies=1";
-
-    # reduces memory pressure
-    $cmd .= " -o sync=always";
-
-    # cheapest compression to drop zero pages
-    $cmd .= " -o compression=zle";
-
-    # skip log devices
-    $cmd .= " -o logbias=throughput";
-    # only cache metadata in RAM (caching swap content does not make sense)
-    $cmd .= " -o primarycache=metadata";
-    # don't cache anything in L2ARC
-    $cmd .= " -o secondarycache=none";
-
-    $cmd .= " $zfspoolname/swap";
-    syscmd ($cmd)  == 0 ||
-	die "unable to create zfs swap device\n";
-
-    return "/dev/zvol/$zfspoolname/swap";
-}
-
 my $udevadm_trigger_block = sub {
     my ($nowait) = @_;
 
@@ -1226,9 +1196,6 @@ sub extract_data {
 
 	    zfs_create_rpool($vdev);
 
-	    my $swap_size = compute_swapsize($disksize);
-	    $swapfile = zfs_create_swap($swap_size) if $swap_size;
-
 	} else {
 
 	    die "target '$target_hd' is not a valid block device\n" if ! -b $target_hd;
-- 
2.11.0





More information about the pve-devel mailing list