[pve-devel] [PATCH installer] fix #1239: enhance swap on ZFS setup
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Jan 25 16:03:50 CET 2017
set properties according to upstream documentation
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
proxinstall | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/proxinstall b/proxinstall
index 18df7bb..0642098 100755
--- a/proxinstall
+++ b/proxinstall
@@ -762,19 +762,26 @@ sub zfs_create_rpool {
sub zfs_create_swap {
my ($swapsize) = @_;
- syscmd ("zfs create -V ${swapsize}K -b 4K $zfspoolname/swap") == 0 ||
- die "unable to create zfs swap device\n";
+ my $cmd = "zfs create -V ${swapsize}K -b 4K";
- syscmd ("zfs set com.sun:auto-snapshot=false $zfspoolname/swap") == 0 ||
- die "unable to set zfs properties\n";
+ $cmd .= " -o com.sun:auto-snapshot=false";
# reduces memory pressure
- syscmd ("zfs set sync=always $zfspoolname/swap") == 0 ||
- die "unable to set zfs properties\n";
+ $cmd .= " -o sync=always";
- # copies for swap does not make sense
- syscmd ("zfs set copies=1 $zfspoolname/swap") == 0 ||
- die "unable to set zfs properties\n";
+ # 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";
}
--
2.1.4
More information about the pve-devel
mailing list