mirror of
				https://github.com/bashclub/proxmox-zfs-postinstall.git
				synced 2025-11-04 00:32:26 +01:00 
			
		
		
		
	Added swappiness configuration
This commit is contained in:
		@@ -95,6 +95,19 @@ if [[ "$(echo $RESULT | awk '{print tolower($0)}')" == "n" ]]; then
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#### SWAPPINESS ####
 | 
			
		||||
 | 
			
		||||
echo -e "######## CONFIGURE SWAPPINESS ########\n"
 | 
			
		||||
SWAPPINESS=$(cat /proc/sys/vm/swappiness)
 | 
			
		||||
echo "The current swappiness is configured to '$SWAPPINESS %' of free memory until using swap."
 | 
			
		||||
read -p "If you want to change the swappiness, please type in the percentage as number (0 = diasbled):" user_input
 | 
			
		||||
if echo "$user_input" | grep -qE '^[0-9]+$'; then
 | 
			
		||||
    echo "Changing swappiness from '$SWAPPINESS %' to '$user_input %'"
 | 
			
		||||
    SWAPPINESS=$user_input
 | 
			
		||||
else
 | 
			
		||||
    echo "No input - swappiness unchanged at '$SWAPPINESS %'."
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#### ZFS AUTO SNAPSHOT CONFIGURATION ####
 | 
			
		||||
 | 
			
		||||
# get information about zfs-auto-snapshot and ask for snapshot retention
 | 
			
		||||
@@ -158,6 +171,10 @@ for interval in "${!auto_snap_keep[@]}"; do
 | 
			
		||||
    fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
echo "Configuring swappiness"
 | 
			
		||||
echo "vm.swappiness=$SWAPPINESS" > /etc/sysctl.d/swappiness.conf
 | 
			
		||||
sysctl -w vm.swappiness=$SWAPPINESS
 | 
			
		||||
 | 
			
		||||
echo "Configuring pve-conf-backup"
 | 
			
		||||
# create backup jobs of /etc
 | 
			
		||||
zfs list $PVE_CONF_BACKUP_TARGET > /dev/null 2>&1
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user