[pve-devel] applied: [PATCH installer] fix #1239: enhance swap on ZFS setup

Dietmar Maurer dietmar at proxmox.com
Wed Mar 8 09:25:52 CET 2017


applied, but re-added copies=1

> On January 25, 2017 at 4:03 PM Fabian Grünbichler <f.gruenbichler at proxmox.com>
> wrote:
> 
> 
> 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
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list