Skip to content

Instantly share code, notes, and snippets.

@reitermarkus
Last active November 23, 2021 07:50
Show Gist options
  • Save reitermarkus/937117c4c9105c01a85a78f1d85b42e9 to your computer and use it in GitHub Desktop.
Save reitermarkus/937117c4c9105c01a85a78f1d85b42e9 to your computer and use it in GitHub Desktop.
Proxmox Setup
set -euo pipefail
# Reduce backup IO.
sed -i -E 's/^\s*#?\s*(ionice:).*/\1 7/' /etc/vzdump.conf
sed -i -E 's/^\s*#?\s*(bwlimit:).*/\1 32768/' /etc/vzdump.conf
tee /etc/cron.hourly/xfs_fsr <<EOF
#!/bin/sh
xfs_fsr -t 600
EOF
chmod 755 /etc/cron.hourly/xfs_fsr
# May cause soft lockups on certain systems.
echo 'zram' > /etc/modules-load.d/zram.conf
echo 'options zram num_devices=1' > /etc/modprobe.d/zram.conf
memory_size=$(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE)))
swap_size=$((memory_size / 2))
zramctl --size "${swap_size}" /dev/zram0
echo "KERNEL==\"zram0\", ATTR{disksize}=\"${swap_size}\" RUN=\"/sbin/mkswap /dev/zram0\", TAG+=\"systemd\"" > /etc/udev/rules.d/99-zram.rules
mkswap /dev/zram0
grep -q '/dev/zram0' /etc/fstab || echo '/dev/zram0 none swap defaults,pri=10 0 0' >> /etc/fstab
swapon /dev/zram0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment