Skip to content

Instantly share code, notes, and snippets.

@bouroo
Last active January 6, 2024 18:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bouroo/f1c721a98c2dfc4120c362191a10f1f4 to your computer and use it in GitHub Desktop.
Save bouroo/f1c721a98c2dfc4120c362191a10f1f4 to your computer and use it in GitHub Desktop.
PVE cmd memo

First run

# vmbr0 => public
# vmbr1 => private => mtu 8996
# disable PVE enterprise repo
# enable PVE no-subscription
# enable debian non-free repo
apt update && apt -y full-upgrade && apt -y install intel-microcode
apt -y install openvswitch-switch tmux htop curl wget jq rsync rclone mtr-tiny net-tools iperf3
# Enable auto update
apt install -y unattended-upgrades
# Add: "o=Proxmox,a=stable,n=${distro_codename}";
# Inside: Unattended-Upgrade::Origins-Pattern { ... };
nano /etc/apt/apt.conf.d/50unattended-upgrades
# Increase hotplug RAM
echo "options vhost max_mem_regions=509" > /etc/modprobe.d/vhost.conf
rmmod vhost_net
rmmod vhost
modprobe vhost_net
# Increase prlimit for all CT
echo "lxc.prlimit.nofile = 32768" > /usr/share/lxc/config/common.conf.d/60-prlimit.conf

Config ZFS

Set RAID controller to HBA mode before install

# Add write log
zpool add rpool log mirror /dev/disk/by-id/diskX /dev/disk/by-id/diskX
# Add hot spare
zpool add rpool spare /dev/disk/by-id/diskX
# Enable auto replace fail drive
zpool set autoreplace=on rpool
# Enable auto expand size to fit new disk
# zpool set autoexpand=on rpool
# For safety write must be sync else risk 5 second rollback when crash
zfs set sync=always rpool
# default sync standard
# zfs set sync=standard rpool
# Limit ZSF memory usage to max/4,8
echo "options zfs zfs_arc_max=$[$(free -b | grep Mem: | awk '{print $2}') / 8]" > /etc/modprobe.d/zfs.conf
update-initramfs -u
pve-efiboot-tool refresh
# Apply after reboot

Tune kernel

wget -O /etc/sysctl.d/60-sysctl.conf https://gist.github.com/bouroo/bc52ad58a6e75d44e5235b229e9ca988/raw/a1c1bc43cb6e0c6a4d71933cfed401070acef77a/60-sysctl.conf
wget -O /etc/sysctl.d/80-pve.conf https://gist.github.com/bouroo/bc52ad58a6e75d44e5235b229e9ca988/raw/a1c1bc43cb6e0c6a4d71933cfed401070acef77a/80-pve.conf
# change fq to fq_codel
nano /etc/sysctl.d/60-sysctl.conf
sysctl --system

Install btop

apt -y install jq curl wget tar build-essential tmux sudo
curl -L https://gist.github.com/bouroo/9ccce8d7909e51edfa2d64a1c92a4982/raw/395137f62daaf130d89c590c97f2aa5d6f59b335/btop-installer.sh | bash

Remove node

pvecm delnode {node_name}
rm -rf /etc/pve/nodes/{node_name}
# revove line {node_name} / {node_IP}
nano /etc/pve/priv/known_hosts
pvecm updatecerts

Disk speed test

# Write test
dd if=/dev/zero of=/tmp/test.img bs=1G count=4 oflag=dsync
# Read test
dd of=/dev/zero if=/tmp/test.img bs=1G count=4 oflag=dsync
# fio
cd /path/to/test
# random write
fio --name=randwrite --ioengine=libaio --iodepth=1 --rw=randwrite --bs=4k --direct=0 --size=512M --numjobs=4 --runtime=240 --group_reporting
# random read
fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=0 --size=512M --numjobs=4 --runtime=240 --group_reporting
# random read/write
fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=random_read_write.fio --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75

Spectre-Meltdown Checker

curl -L https://meltdown.ovh | bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment