mirror of
				https://github.com/bashclub/proxmox-zfs-postinstall.git
				synced 2025-11-04 08:32:28 +01:00 
			
		
		
		
	Added install.sh
This commit is contained in:
		
							
								
								
									
										45
									
								
								install.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								install.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,45 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Define basic tools to install
 | 
			
		||||
TOOLS="vim net-tools dnsutils ethtool git curl unzip screen iftop lshw smartmontools lsscsi sysstat zfs-auto-snapshot"
 | 
			
		||||
 | 
			
		||||
# Define zfs-auto-snapshot retention policy
 | 
			
		||||
SNAP_FREQUENT=8
 | 
			
		||||
SNAP_HOURLY=48
 | 
			
		||||
SNAP_DAILY=31
 | 
			
		||||
SNAP_WEEKLY=8
 | 
			
		||||
SNAP_MONTHLY=3
 | 
			
		||||
 | 
			
		||||
# Define zfs arcsize in Megabytes (MB)
 | 
			
		||||
ZFS_ARC_MIN=128
 | 
			
		||||
ZFS_ARC_MAX=256
 | 
			
		||||
 | 
			
		||||
# remove pve-enterprise repo and add pve-no-subscription repo
 | 
			
		||||
rm -f /etc/apt/sources.list.d/pve-enterprise.list
 | 
			
		||||
echo "deb http://download.proxmox.com/debian/pve buster pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
 | 
			
		||||
apt update
 | 
			
		||||
 | 
			
		||||
# update system and install basic tools
 | 
			
		||||
DEBIAN_FRONTEND=nonintercative DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade
 | 
			
		||||
DEBIAN_FRONTEND=nonintercative DEBIAN_PRIORITY=critical apt -y -qq install $TOOLS
 | 
			
		||||
 | 
			
		||||
# configure zfs-auto-snapshot
 | 
			
		||||
sed -i 's/keep=4/keep=$SNAP_FREQUENT/g' /etc/cron.d/zfs-auto-snapshot
 | 
			
		||||
sed -i 's/keep=24/keep=$SNAP_HOURLY/g' /etc/cron.hourly/zfs-auto-snapshot
 | 
			
		||||
sed -i 's/keep=31/keep=$SNAP_DAILY/g' /etc/cron.hourly/zfs-auto-snapshot
 | 
			
		||||
sed -i 's/keep=8/keep=$SNAP_WEEKLY/g' /etc/cron.weekly/zfs-auto-snapshot
 | 
			
		||||
sed -i 's/keep=8/keep=$SNAP_MONTHLY/g' /etc/cron.monthly/zfs-auto-snapshot
 | 
			
		||||
 | 
			
		||||
# set zfs_arc_limits
 | 
			
		||||
ZFS_ARC_MIN_BYTES=$(($ZFS_ARC_MIN+1024*1024))
 | 
			
		||||
ZFS_ARC_MAX_BYTES=$(($ZFS_ARC_MAX+1024*1024))
 | 
			
		||||
 | 
			
		||||
echo $ZFS_ARC_MIN_BYTES > /sys/module/zfs/parameters/zfs_arc_min
 | 
			
		||||
echo $ZFS_ARC_MAX_BYTES > /sys/module/zfs/parameters/zfs_arc_max
 | 
			
		||||
 | 
			
		||||
cat << EOF > /etc/modprobe.d/zfs.conf
 | 
			
		||||
options zfs zfs_arc_min=$ZFS_ARC_MIN_BYTES
 | 
			
		||||
options zfs zfs_arc_min=$ZFS_ARC_MAX_BYTES
 | 
			
		||||
EOF
 | 
			
		||||
update-initramfs -u -k all
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user