Skip to content

Instantly share code, notes, and snippets.

@reitermarkus
Last active April 6, 2025 12:27
Show Gist options
  • Select an option

  • Save reitermarkus/937117c4c9105c01a85a78f1d85b42e9 to your computer and use it in GitHub Desktop.

Select an option

Save reitermarkus/937117c4c9105c01a85a78f1d85b42e9 to your computer and use it in GitHub Desktop.

Revisions

  1. reitermarkus revised this gist Nov 23, 2021. 1 changed file with 0 additions and 14 deletions.
    14 changes: 0 additions & 14 deletions pci-passthrough.sh
    Original file line number Diff line number Diff line change
    @@ -1,14 +0,0 @@
    if ! grep -q 'intel_iommu=on' /etc/kernel/cmdline; then
    echo $(cat /etc/kernel/cmdline) quiet intel_iommu=on > /etc/kernel/cmdline
    proxmox-boot-tool refresh
    fi

    cat <<EOF > /etc/modules-load.d/vfio.conf
    vfio
    vfio_iommu_type1
    vfio_pci
    vfio_virqfd
    EOF

    # Mac mini does not support interrupt remapping.
    echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
  2. reitermarkus revised this gist Nov 23, 2021. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,4 @@ tee /etc/cron.hourly/xfs_fsr <<EOF
    xfs_fsr -t 600
    EOF
    chmod 755 /etc/cron.hourly/xfs_fsr

    systemctl enable fstrim.timer
    systemctl restart fstrim.timer
    chmod 755 /etc/cron.hourly/xfs_fsr
  3. reitermarkus revised this gist Nov 23, 2021. 6 changed files with 1 addition and 184 deletions.
    15 changes: 0 additions & 15 deletions fan-speed.sh
    Original file line number Diff line number Diff line change
    @@ -1,15 +0,0 @@
    tee /etc/systemd/system/fan-speed.service <<EOF
    [Unit]
    Description=Set fan speed profile to 'optimal'.
    [Service]
    Type=oneshot
    RemainAfterExit=true
    ExecStart=/usr/bin/ipmitool raw 0x30 0x45 0x01 0x02
    ExecStop=/usr/bin/ipmitool raw 0x30 0x45 0x01 0x02
    [Install]
    WantedBy=multi-user.target
    EOF

    systemctl enable fan-speed
    31 changes: 0 additions & 31 deletions interfaces-htpc.sh
    Original file line number Diff line number Diff line change
    @@ -1,31 +0,0 @@
    tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback
    auto enp10s0
    allow-hotplug enp10s0
    iface enp10s0 inet manual
    auto enp7s0
    allow-hotplug enp7s0
    iface enp7s0 inet manual
    auto bond0
    iface bond0 inet manual
    bond-slaves enp10s0 enp7s0
    bond-miimon 100
    bond-mode active-backup
    bond-primary enp10s0
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig bond0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
    address 10.0.0.158/23
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    hwaddress ether 40:b0:76:57:ef:72
    post-up ifconfig vmbr0 mtu 9000
    EOF
    17 changes: 0 additions & 17 deletions interfaces-mac.sh
    Original file line number Diff line number Diff line change
    @@ -1,17 +0,0 @@
    tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback
    auto enp1s0f0
    allow-hotplug enp1s0f0
    iface enp1s0f0 inet manual
    post-up ifconfig enp1s0f0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
    address 10.0.0.142/23
    bridge-ports enp1s0f0
    bridge-stp off
    bridge-fd 0
    post-up ifconfig vmbr0 mtu 9000
    EOF
    39 changes: 0 additions & 39 deletions interfaces-nas.sh
    Original file line number Diff line number Diff line change
    @@ -1,39 +0,0 @@
    tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback
    auto eno1
    allow-hotplug eno1
    iface eno1 inet manual
    auto eno2
    allow-hotplug eno2
    iface eno2 inet manual
    auto eno3
    allow-hotplug eno3
    iface eno3 inet manual
    auto eno4
    allow-hotplug eno4
    iface eno4 inet manual
    auto bond0
    iface bond0 inet manual
    bond-slaves eno1 eno2
    bond-miimon 100
    bond-mode active-backup
    bond-primary eno1
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig bond0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
    address 10.0.0.141/23
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    hwaddress ether 0c:c4:7a:5e:c3:78
    post-up ifconfig vmbr0 mtu 9000
    EOF
    3 changes: 0 additions & 3 deletions proxmox-setup.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +0,0 @@
    ```
    curl -L https://gist.github.com/reitermarkus/937117c4c9105c01a85a78f1d85b42e9/raw/proxmox-setup.sh | bash
    ```
    80 changes: 1 addition & 79 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,83 +1,9 @@
    set -euo pipefail

    rm -f /etc/apt/sources.list.d/pve-enterprise.list
    echo 'deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription' > /etc/apt/sources.list.d/pve-no-subscription.list

    sed -i.bak -E "s/(data\.status\.toLowerCase\(\) !== 'active')\)/\1 \&\& false)/" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
    systemctl restart pveproxy.service

    # 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

    # Import ZFS pool disks by ID.
    sed -i -E 's/^\s*#\s*(ZPOOL_IMPORT_PATH=.*)/\1/' /etc/default/zfs
    update-initramfs -u

    tee /etc/modprobe.d/kvm.conf <<EOF
    options kvm ignore_msrs=Y
    options kvm report_ignored_msrs=N
    EOF
    update-initramfs -k all -u

    apt-get update
    apt-get upgrade -y
    apt-get install -y curl net-tools mosh

    # Install XG-C100F Driver
    apt-get install -y ethtool git unzip pve-headers build-essential
    pushd /tmp
    rm -rf AQtion
    git clone https://github.com/Aquantia/AQtion
    pushd AQtion
    make
    bash build-deb.sh
    apt-get install -y ./atlantic_*.deb
    popd
    rm -r AQtion
    popd

    tee /etc/sysctl.d/reboot-on-panic.conf <<EOF
    kernel.panic = 30
    EOF

    tee /etc/sysctl.d/net.conf <<EOF
    kernel.pid_max = 4194303
    net.netfilter.nf_conntrack_max = 1048576
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.core.wmem_default = 262144
    net.core.rmem_default = 262144
    net.ipv4.tcp_rmem = 8192 87380 16777216
    net.ipv4.tcp_wmem = 4096 65536 16777216
    net.core.netdev_max_backlog = 30000
    net.ipv4.tcp_congestion_control = htcp
    net.ipv4.conf.all.rp_filter = 2
    net.ipv4.ip_forward=1
    EOF

    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
    EOF

    sed -i -E 's/^\s*#?\s*(net.bridge.bridge-nf-call-iptables)\s*=.*/\1 = 1/' /etc/sysctl.d/pve.conf
    sed -i -E 's/^\s*#?\s*(net.bridge.bridge-nf-call-ip6tables)\s*=.*/\1 = 1/' /etc/sysctl.d/pve.conf

    sysctl --system

    apt-get install -y autofs

    tee /etc/fstab <<EOF
    # <file system> <mount point> <type> <options> <dump> <pass>
    /dev/pve/root / ext4 errors=remount-ro 0 1
    UUID=6A67-3481 /boot/efi vfat defaults 0 1
    /dev/pve/swap none swap sw 0 0
    proc /proc proc defaults 0 0
    /dev/disk/by-id/nvme-SAMSUNG_MZVLB512HBJQ-00000_S4GENF1N252160 /media/data xfs defaults 0 1
    /dev/disk/by-id/ata-TOSHIBA_MG08ACA16TE_Z960A0ZKFVGG /media/media-1 xfs defaults 0 1
    /media/media-1 /media/media fuse.mergerfs allow_other,minfreespace=16G,use_ino,dropcacheonclose=true,category.create=mfs 0 1
    EOF

    tee /etc/cron.hourly/xfs_fsr <<EOF
    #!/bin/sh
    @@ -86,8 +12,4 @@ EOF
    chmod 755 /etc/cron.hourly/xfs_fsr

    systemctl enable fstrim.timer
    systemctl restart fstrim.timer

    apt-get install -y nfs-common nfs-kernel-server
    service nfs-common restart
    service nfs-kernel-server restart
    systemctl restart fstrim.timer
  4. reitermarkus revised this gist Nov 19, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ update-initramfs -k all -u

    apt-get update
    apt-get upgrade -y
    apt-get install -y curl net-tools
    apt-get install -y curl net-tools mosh

    # Install XG-C100F Driver
    apt-get install -y ethtool git unzip pve-headers build-essential
  5. reitermarkus revised this gist Nov 6, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions interfaces-mac.sh
    Original file line number Diff line number Diff line change
    @@ -13,4 +13,5 @@ iface vmbr0 inet dhcp
    bridge-ports enp1s0f0
    bridge-stp off
    bridge-fd 0
    post-up ifconfig vmbr0 mtu 9000
    EOF
  6. reitermarkus revised this gist Nov 6, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions interfaces-mac.sh
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ iface lo inet loopback
    auto enp1s0f0
    allow-hotplug enp1s0f0
    iface enp1s0f0 inet manual
    post-up ifconfig enp1s0f0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
  7. reitermarkus revised this gist Nov 5, 2021. 5 changed files with 13 additions and 23 deletions.
    1 change: 1 addition & 0 deletions interfaces-htpc.sh
    Original file line number Diff line number Diff line change
    @@ -22,6 +22,7 @@ iface bond0 inet manual
    auto vmbr0
    iface vmbr0 inet dhcp
    address 10.0.0.158/23
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    25 changes: 5 additions & 20 deletions interfaces-mac.sh
    Original file line number Diff line number Diff line change
    @@ -2,29 +2,14 @@ tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback
    auto enp10s0
    allow-hotplug enp10s0
    iface enp10s0 inet manual
    auto enp7s0
    allow-hotplug enp7s0
    iface enp7s0 inet manual
    auto bond0
    iface bond0 inet manual
    bond-slaves enp10s0 enp7s0
    bond-miimon 100
    bond-mode active-backup
    bond-primary enp10s0
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig bond0 mtu 9000
    auto enp1s0f0
    allow-hotplug enp1s0f0
    iface enp1s0f0 inet manual
    auto vmbr0
    iface vmbr0 inet dhcp
    bridge-ports bond0
    address 10.0.0.142/23
    bridge-ports enp1s0f0
    bridge-stp off
    bridge-fd 0
    hwaddress ether 40:b0:76:57:ef:72
    post-up ifconfig vmbr0 mtu 9000
    EOF
    1 change: 1 addition & 0 deletions interfaces-nas.sh
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,7 @@ iface bond0 inet manual
    auto vmbr0
    iface vmbr0 inet dhcp
    address 10.0.0.141/23
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    2 changes: 1 addition & 1 deletion pci-passthrough.sh
    Original file line number Diff line number Diff line change
    @@ -10,5 +10,5 @@ vfio_pci
    vfio_virqfd
    EOF

    # on Mac mini
    # Mac mini does not support interrupt remapping.
    echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
    7 changes: 5 additions & 2 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -14,12 +14,15 @@ sed -i -E 's/^\s*#?\s*(bwlimit:).*/\1 32768/' /etc/vzdump.conf
    sed -i -E 's/^\s*#\s*(ZPOOL_IMPORT_PATH=.*)/\1/' /etc/default/zfs
    update-initramfs -u

    echo "options kvm ignore_msrs=Y" > /etc/modprobe.d/kvm.conf
    tee /etc/modprobe.d/kvm.conf <<EOF
    options kvm ignore_msrs=Y
    options kvm report_ignored_msrs=N
    EOF
    update-initramfs -k all -u

    apt-get update
    apt-get upgrade -y
    apt-get install -y curl
    apt-get install -y curl net-tools

    # Install XG-C100F Driver
    apt-get install -y ethtool git unzip pve-headers build-essential
  8. reitermarkus revised this gist Nov 5, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions pci-passthrough.sh
    Original file line number Diff line number Diff line change
    @@ -9,3 +9,6 @@ vfio_iommu_type1
    vfio_pci
    vfio_virqfd
    EOF

    # on Mac mini
    echo "options vfio_iommu_type1 allow_unsafe_interrupts=1" > /etc/modprobe.d/iommu_unsafe_interrupts.conf
  9. reitermarkus revised this gist Nov 5, 2021. 1 changed file with 30 additions and 0 deletions.
    30 changes: 30 additions & 0 deletions interfaces-mac.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback
    auto enp10s0
    allow-hotplug enp10s0
    iface enp10s0 inet manual
    auto enp7s0
    allow-hotplug enp7s0
    iface enp7s0 inet manual
    auto bond0
    iface bond0 inet manual
    bond-slaves enp10s0 enp7s0
    bond-miimon 100
    bond-mode active-backup
    bond-primary enp10s0
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig bond0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    hwaddress ether 40:b0:76:57:ef:72
    post-up ifconfig vmbr0 mtu 9000
    EOF
  10. reitermarkus revised this gist Nov 5, 2021. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions pci-passthrough.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    if ! grep -q 'intel_iommu=on' /etc/kernel/cmdline; then
    echo $(cat /etc/kernel/cmdline) quiet intel_iommu=on > /etc/kernel/cmdline
    proxmox-boot-tool refresh
    fi

    cat <<EOF > /etc/modules-load.d/vfio.conf
    vfio
    vfio_iommu_type1
    vfio_pci
    vfio_virqfd
    EOF
  11. reitermarkus revised this gist Oct 30, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -14,6 +14,9 @@ sed -i -E 's/^\s*#?\s*(bwlimit:).*/\1 32768/' /etc/vzdump.conf
    sed -i -E 's/^\s*#\s*(ZPOOL_IMPORT_PATH=.*)/\1/' /etc/default/zfs
    update-initramfs -u

    echo "options kvm ignore_msrs=Y" > /etc/modprobe.d/kvm.conf
    update-initramfs -k all -u

    apt-get update
    apt-get upgrade -y
    apt-get install -y curl
  12. reitermarkus revised this gist Oct 25, 2021. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions fan-speed.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    tee /etc/systemd/system/fan-speed.service <<EOF
    [Unit]
    Description=Set fan speed profile to 'optimal'.
    [Service]
    Type=oneshot
    RemainAfterExit=true
    ExecStart=/usr/bin/ipmitool raw 0x30 0x45 0x01 0x02
    ExecStop=/usr/bin/ipmitool raw 0x30 0x45 0x01 0x02
    [Install]
    WantedBy=multi-user.target
    EOF

    systemctl enable fan-speed
  13. reitermarkus revised this gist Oct 24, 2021. 2 changed files with 15 additions and 15 deletions.
    19 changes: 4 additions & 15 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -50,6 +50,10 @@ net.ipv4.conf.all.rp_filter = 2
    net.ipv4.ip_forward=1
    EOF

    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
    EOF

    sed -i -E 's/^\s*#?\s*(net.bridge.bridge-nf-call-iptables)\s*=.*/\1 = 1/' /etc/sysctl.d/pve.conf
    sed -i -E 's/^\s*#?\s*(net.bridge.bridge-nf-call-ip6tables)\s*=.*/\1 = 1/' /etc/sysctl.d/pve.conf

    @@ -68,21 +72,6 @@ proc /proc proc defaults 0 0
    /media/media-1 /media/media fuse.mergerfs allow_other,minfreespace=16G,use_ino,dropcacheonclose=true,category.create=mfs 0 1
    EOF

    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

    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
    EOF


    tee /etc/cron.hourly/xfs_fsr <<EOF
    #!/bin/sh
    11 changes: 11 additions & 0 deletions zram.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    # 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
  14. reitermarkus revised this gist Oct 24, 2021. 2 changed files with 2 additions and 0 deletions.
    1 change: 1 addition & 0 deletions interfaces-htpc.sh
    Original file line number Diff line number Diff line change
    @@ -26,4 +26,5 @@ iface vmbr0 inet dhcp
    bridge-stp off
    bridge-fd 0
    hwaddress ether 40:b0:76:57:ef:72
    post-up ifconfig vmbr0 mtu 9000
    EOF
    1 change: 1 addition & 0 deletions interfaces-nas.sh
    Original file line number Diff line number Diff line change
    @@ -34,4 +34,5 @@ iface vmbr0 inet dhcp
    bridge-stp off
    bridge-fd 0
    hwaddress ether 0c:c4:7a:5e:c3:78
    post-up ifconfig vmbr0 mtu 9000
    EOF
  15. reitermarkus revised this gist Oct 24, 2021. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion interfaces-htpc.sh
    Original file line number Diff line number Diff line change
    @@ -18,7 +18,7 @@ iface bond0 inet manual
    bond-primary enp10s0
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig enp10s0 mtu 9000
    post-up ifconfig bond0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
    2 changes: 1 addition & 1 deletion interfaces-nas.sh
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@ iface bond0 inet manual
    bond-primary eno1
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig eno1 mtu 9000
    post-up ifconfig bond0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
  16. reitermarkus revised this gist Oct 21, 2021. 1 changed file with 15 additions and 12 deletions.
    27 changes: 15 additions & 12 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -31,18 +31,6 @@ popd
    rm -r AQtion
    popd


    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

    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
    EOF

    tee /etc/sysctl.d/reboot-on-panic.conf <<EOF
    kernel.panic = 30
    EOF
    @@ -80,6 +68,21 @@ proc /proc proc defaults 0 0
    /media/media-1 /media/media fuse.mergerfs allow_other,minfreespace=16G,use_ino,dropcacheonclose=true,category.create=mfs 0 1
    EOF

    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

    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
    EOF


    tee /etc/cron.hourly/xfs_fsr <<EOF
    #!/bin/sh
  17. reitermarkus revised this gist Oct 21, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -33,6 +33,7 @@ popd


    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
  18. reitermarkus revised this gist Oct 21, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -36,7 +36,7 @@ echo 'zram' > /etc/modules-load.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
    echo "KERNEL==\"zram0\", ATTR{disksize}=\"${swap_size}\" RUN=\"/sbin/mkswap /dev/zram0\", TAG+=\"systemd\"" > /etc/udev/rules.d/99-zram.rules

    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
  19. reitermarkus revised this gist Oct 21, 2021. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -32,6 +32,12 @@ rm -r AQtion
    popd


    echo 'zram' > /etc/modules-load.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
    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
    EOF
  20. reitermarkus revised this gist Oct 21, 2021. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  21. reitermarkus renamed this gist Oct 21, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  22. reitermarkus renamed this gist Oct 21, 2021. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  23. reitermarkus revised this gist Oct 21, 2021. 3 changed files with 31 additions and 29 deletions.
    29 changes: 29 additions & 0 deletions htpc-interfaces
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback

    auto enp10s0
    allow-hotplug enp10s0
    iface enp10s0 inet manual

    auto enp7s0
    allow-hotplug enp7s0
    iface enp7s0 inet manual

    auto bond0
    iface bond0 inet manual
    bond-slaves enp10s0 enp7s0
    bond-miimon 100
    bond-mode active-backup
    bond-primary enp10s0
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig enp10s0 mtu 9000

    auto vmbr0
    iface vmbr0 inet dhcp
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    hwaddress ether 40:b0:76:57:ef:72
    EOF
    29 changes: 0 additions & 29 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -31,35 +31,6 @@ popd
    rm -r AQtion
    popd

    tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback
    auto enp10s0
    allow-hotplug enp10s0
    iface enp10s0 inet manual
    auto enp7s0
    allow-hotplug enp7s0
    iface enp7s0 inet manual
    auto bond0
    iface bond0 inet manual
    bond-slaves enp10s0 enp7s0
    bond-miimon 100
    bond-mode active-backup
    bond-primary enp10s0
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig enp10s0 mtu 9000
    auto vmbr0
    iface vmbr0 inet dhcp
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    hwaddress ether 40:b0:76:57:ef:72
    EOF

    tee /etc/sysctl.d/swap.conf <<EOF
    vm.swappiness=0
    2 changes: 2 additions & 0 deletions nas-interfaces → supermicro-interfaces
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    tee /etc/network/interfaces <<EOF
    auto lo
    iface lo inet loopback

    @@ -33,3 +34,4 @@ iface vmbr0 inet dhcp
    bridge-stp off
    bridge-fd 0
    hwaddress ether 0c:c4:7a:5e:c3:78
    EOF
  24. reitermarkus revised this gist Oct 21, 2021. 1 changed file with 35 additions and 0 deletions.
    35 changes: 35 additions & 0 deletions nas-interfaces
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    auto lo
    iface lo inet loopback

    auto eno1
    allow-hotplug eno1
    iface eno1 inet manual

    auto eno2
    allow-hotplug eno2
    iface eno2 inet manual

    auto eno3
    allow-hotplug eno3
    iface eno3 inet manual

    auto eno4
    allow-hotplug eno4
    iface eno4 inet manual

    auto bond0
    iface bond0 inet manual
    bond-slaves eno1 eno2
    bond-miimon 100
    bond-mode active-backup
    bond-primary eno1
    bond-downdelay 200
    bond-updelay 200
    post-up ifconfig eno1 mtu 9000

    auto vmbr0
    iface vmbr0 inet dhcp
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    hwaddress ether 0c:c4:7a:5e:c3:78
  25. reitermarkus revised this gist Oct 20, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,7 @@ sed -i -E 's/^\s*#?\s*(bwlimit:).*/\1 32768/' /etc/vzdump.conf

    # Import ZFS pool disks by ID.
    sed -i -E 's/^\s*#\s*(ZPOOL_IMPORT_PATH=.*)/\1/' /etc/default/zfs
    update-initramfs -u

    apt-get update
    apt-get upgrade -y
  26. reitermarkus revised this gist Oct 20, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@ sed -i -E 's/^\s*#?\s*(ionice:).*/\1 7/' /etc/vzdump.conf
    sed -i -E 's/^\s*#?\s*(bwlimit:).*/\1 32768/' /etc/vzdump.conf

    # Import ZFS pool disks by ID.
    sed -E 's/^\s*#\s*(ZPOOL_IMPORT_PATH=.*)/\1/' /etc/default/zfs
    sed -i -E 's/^\s*#\s*(ZPOOL_IMPORT_PATH=.*)/\1/' /etc/default/zfs

    apt-get update
    apt-get upgrade -y
  27. reitermarkus revised this gist Oct 20, 2021. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -3,16 +3,16 @@ set -euo pipefail
    rm -f /etc/apt/sources.list.d/pve-enterprise.list
    echo 'deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription' > /etc/apt/sources.list.d/pve-no-subscription.list

    data.status.toLowerCase() !== 'active')
    data.status.toLowerCase() !== 'active')

    sed -i.bak -E "s/(data\.status\.toLowerCase\(\) !== 'active')\)/\1 \&\& false)/" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
    systemctl restart pveproxy.service

    # 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

    # Import ZFS pool disks by ID.
    sed -E 's/^\s*#\s*(ZPOOL_IMPORT_PATH=.*)/\1/' /etc/default/zfs

    apt-get update
    apt-get upgrade -y
    apt-get install -y curl
  28. reitermarkus revised this gist Jul 11, 2021. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,10 @@ set -euo pipefail
    rm -f /etc/apt/sources.list.d/pve-enterprise.list
    echo 'deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription' > /etc/apt/sources.list.d/pve-no-subscription.list

    sed -i.bak "s/(data.status !== 'Active')/(false)/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
    data.status.toLowerCase() !== 'active')
    data.status.toLowerCase() !== 'active')

    sed -i.bak -E "s/(data\.status\.toLowerCase\(\) !== 'active')\)/\1 \&\& false)/" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
    systemctl restart pveproxy.service

    # Reduce backup IO.
  29. reitermarkus revised this gist Jul 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    set -euo pipefail

    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
    echo 'deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription' > /etc/apt/sources.list.d/pve-no-subscription.list

    sed -i.bak "s/(data.status !== 'Active')/(false)/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
    systemctl restart pveproxy.service
  30. reitermarkus revised this gist May 21, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proxmox-setup.sh
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@ systemctl restart pveproxy.service

    # Reduce backup IO.
    sed -i -E 's/^\s*#?\s*(ionice:).*/\1 7/' /etc/vzdump.conf
    sed -i -E 's/^\s*#?\s*(bwlimit:).*/\1 131072/' /etc/vzdump.conf
    sed -i -E 's/^\s*#?\s*(bwlimit:).*/\1 32768/' /etc/vzdump.conf

    apt-get update
    apt-get upgrade -y