Proxmox
Tonton Jo - 2021
Join the community:
Support the channel with one of the following link:
Informations:
This repository contains somes scripts and tips for Proxmox hypervisor and backup server
Find here more of my videos about proxmox
Proxmox Toolbox
This tools will help you get your Proxmox VE and BS installations configured and secured in no time:
- set sources, update bin, remove subsciption message, fail2ban, snmp, mail notifications and much more Proxmox Toolbox
Usefull commands:
You'll find there some usefull commands used for proxmox and more generally debian
1 - Proxmox
1.1 - Stop all services:
for i in pve-cluster pvedaemon vz qemu-server pveproxy pve-cluster; do systemctl stop $i ; done
1.2 - Regenerate console login screen (usefull after ip changes)
pvebanner
2 - VM Management
2.1 - Disk passtrough
qm set $vmid -scsi0 /dev/sdX
2.2 - Appliance Import
qm importdisk $vmid pathtoappliance.ova local-lvm
2.3 - Appliance Export
- Identifiy the disk of a vm
qm config $vmid
- Check absolute path ($absolutepath) for drive as seen by the OS
pvesm path local-lvm:vm-100-disk-0
- Export the drive wanted, watch for the format to be correct :-)
qemu-img convert -O qcow2 -f raw $absolutepath OUTPUT.qcow2
3 - Drives Management
3.1 - Find a disc with ID:
ls /dev/disk/by-id/ -la
ls /dev/disk/by-id/ -la | grep "serial"
3.2 - list disk informations: Replace X
lsblk -o name,model,serial,uuid /dev/sdX
3.3 - find disk UUID or partition UUID
ls -l /dev/disk/by-uuid
ls -l /dev/disk/by-partuuid
3.4 - Wipe Disk
wipefs -af /dev/sdX
3.5 - Read actual partition status after change
hdparm -z /dev/sdX
echo 1 > /sys/block/sdX/device/rescan
3.6 - Find the actual blocksize of all disks - Usually 4k
lsblk -o NAME,PHY-SeC
3.6 - Find the actual blocksize of all disks - Usually 4k
lsblk -o NAME,PHY-SeC
3.6^7 - Test speed of drive (hdparm needed)
hdparm -t /dev/$sdX
4 - Zpool Management
4.1 - Remove import of removed pools at startup:
4.1.1 - Identify your pools:
systemctl | grep zfs
4.1.2 - Remove import of a pool at boot (remove old pools from load)
systemctl disable zfs-import@zpoolname.service
4.2 - Find ARC RAM usage for Zpool:
awk '/^size/ { print $1 " " $3 / 1048576 }' < /proc/spl/kstat/zfs/arcstats
4.3 - Find Compression ratio and used space:
zfs list -o name,avail,used,refer,lused,lrefer,mountpoint,compress,compressratio
4.4 - Replace Zpool Drive:
zpool replace pool /old/drive /new/drive
4.5 - Mark a pool as OK - Clear errors on pool and drives
zpool clear "poolname"
4.6 - Get Zpool version:
zpool --version
4.7 - Ugrade a zpool:
zpool upgrade "$poolname"
4.8 - Zpool options settings
4.8.1 - Get your $poolname
zfs list
4.8.2 - find actual options - filter if necessary
zfs get all
zfs get all | grep atime
4.8.3 - Set new option value
zfs set atime=off $poolname
zfs set compression=off $poolname
4.9 - If pool is created with /dev/sdX instead of ID (wich may lead to mount fail)
zpool export $poolname
zpool import -d /dev/disk/by-id -aN
5 - Monitoring
5.1 - Live disk IO
watch -n 1 "zpool iostat -v"
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