This repository contains somes scripts and tips for Proxmox hypervisor and backup server
Find here more of my videos about proxmox
If you want to setup and update your Proxmox VE / BS server, please have a look at my Proxmox Toolbox
- Set no subscription sources
- New update command (proxmox-update) wich automatically remove message if needed
- Security with Fail2ban
- snmp
- mail notifications
- Backup and restoration of Proxmox VE / BS configurations
A home server may be power consuming and i wanted something to have a compromise between performance and energy saving without having to power-off the server Here it is: CPU_SCALE.SH
- The script, when configured to start at boot or manually executed for testing purpose, will check for the cpu load and ramp-up to a better CPU Gouvernor when calculation power is needed.
- You can configure the ramp-up and ramp-down time
- You can choose what CPU gouvernor you want to use (i recommand switching between schedutil and powersave)
Here's a power consumption report for my server:
You'll find there some usefull commands used for proxmox and more generally debian
Menu:
1 - Debian General
1.1 - System
1.2 - Drives Management
1.3 - Zpool Management
1.4 - Monitoring
1.5 - PCI express
1.6 - CPU
1.7 - Benchmark and performance test
2 - Proxmox Virtual Environement
2.1 - Services management
2.2 - Proxmox commands
2.3 - VM Management
3 - Proxmox Backup Server
3.1 - Recover / add an existing datastore
4 - Usefull tools
dpkg-reconfigure tzdata
timedatectl set-ntp true
ls /dev/disk/by-id/ -la
ls /dev/disk/by-id/ -la | grep "serial"
lsblk -o name,model,serial,uuid /dev/sdX
ls -l /dev/disk/by-uuid
ls -l /dev/disk/by-partuuid
wipefs -af /dev/sdX
hdparm -z /dev/sdX
echo 1 > /sys/block/sdX/device/rescan
lsblk -o NAME,PHY-SeC
- Identify your pools:
systemctl | grep zfs
- Remove import of a pool at boot (remove old pools from load)
systemctl disable [email protected]
awk '/^size/ { print $1 " " $3 / 1048576 }' < /proc/spl/kstat/zfs/arcstats
zfs list -o name,avail,used,refer,lused,lrefer,mountpoint,compress,compressratio
zpool replace pool /old/drive /new/drive
zpool clear "poolname"
zpool --version
zpool upgrade "$poolname"
- Get your $poolname
zfs list
- find actual options - filter if necessary
zfs get all
zfs get all | grep atime
- Set new option value
zfs set atime=off $poolname
zfs set compression=off $poolname
zpool export $poolname
zpool import -d /dev/disk/by-id -aN
watch -n 1 "zpool iostat -v"
- Identify your device:
lspci
- Get infos
lspci -vv -s 2a:00.0
#!/bin/bash
shopt -s nullglob
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
echo "IOMMU Group ${g##*/}:"
for d in $g/devices/*; do
echo -e "\t$(lspci -nns ${d##*/})"
done;
done;
https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
crontab -e
@reboot echo "ondemand" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor >/dev/null 2>&1
dd if=/dev/zero of=/$pathtostorage/test1.img bs=1G count=1 oflag=dsync
hdparm -t /dev/$sdX
for i in pve-cluster pvedaemon vz qemu-server pveproxy pve-cluster; do systemctl stop $i ; done
pvebanner
qm set $vmid -scsi0 /dev/sdX
tar -xvf "path_to_appliance.ova"
qm importdisk $vmid path_to_appliance_disk.vmdk local-lvm
- Identifiy the disk of a vm
qm config $vmid
- Check absolute path ($absolutepath) for drive as seen by the OS
absolutepath=$(pvesm path local-lvm:vm-100-disk-0)
echo $absolutepath
- Export the drive wanted, watch for the format to be correct :-)
qemu-img convert -O qcow2 -f raw $absolutepath OUTPUT.qcow2
- edit "/etc/proxmox-backup/datastore.cfg"
datastore: backup
gc-schedule daily
keep-daily 1
keep-last 1
keep-monthly 5
keep-weekly 5
path /mnt/datastore/backup
prune-schedule 2,22:30
Ensure the rights are corrects:
chown backup:backup -R "/path/to/datastore"
Ioping - usefull to simulate drive activity and therefore locating it.
s-tui - Graphical interface to monitor system performances
stress - install it with s-tui to be able to stress your system - dont use in prod