Table of Contents

Commnads

Config

pct config <id>
pct set <id> --cores 4 --memory 2048
pct resize <id> rootfs 32G

Images

pveam available
pveam download local image.tar.gz
pveam list local

LXC Kernel Logs

apt install -y ulogd2
 
cp /etc/ulogd.conf /etc/ulogd.conf.ORIG
cat<<EOF>/etc/ulogd.conf
[global]
logfile="syslog"
loglevel=3
stack=log1:NFLOG,base1:BASE,ifi1:IFINDEX,ip2str1:IP2STR,print1:PRINTPKT,iptables:LOGEMU
[log1]
group=1
[iptables]
file="/var/log/iptables.log"
sync=1
EOF
 
systemctl restart ulogd
rm -rf /var/log/ulog

Memory Usage

total=0
for i in $(pct list|grep running|awk '{print $1}'); do
  pct status $i --verbose|yq -r '.|"\(.vmid)"+" "+"\(.maxmem|tonumber/1048576|round)"+"M"+" "+"\(.mem|tonumber/1048576|round)"+"M"'
  total=$((total+$(pct status $i --verbose|yq -r '.|"\(.maxmem|tonumber/1048576|round)"')))
done
echo ${total}M

Fix issue with Zabbix

lxcfs.service
[Service]
ExecStart=/usr/bin/lxcfs -l /var/lib/lxcfs