Proxmox

Tasks

Add guest agent

apt install qemu-guest-agent
yum install qemu-guest-agent

then start it:

systemctl start qemu-guest-agent

Documentation: https://pve.proxmox.com/wiki/Qemu-guest-agent

For Windows

https://docs.fedoraproject.org/en-US/quick-docs/creating-windows-virtual-machines-using-virtio-drivers/

download the latest iso:

https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/

Unlock VM/containers

VMs and container often stay locked after any kind of connectivity problem, to unlock them:

pct unlock <ID>
qm unlock <ID>

Use a USB drive for backup

Mount the USB drive, then you can add via GUI a new Storage Datacenter->Storage->Add->Directory

Reduce HD file size (qcow2)

mv original_image.qcow2 original_image.qcow2_backup
qemu-img convert -O qcow2 original_image.qcow2_backup original_image.qcow2

TASK ERROR: can’t lock file

If you issue a Shutdown command on a VM than cannot process it (no ACPI), the task runs and tries its best before timing out. During this time the /var/lock/qemu-server/lock-100.conf is locked by this task.

If during this time (before the Shutdown task times out), you issue a Stop command to the VM, you become this error message:

trying to acquire lock...

TASK ERROR: can't lock file '/var/lock/qemu-server/lock-101.conf' - got timeout

In this case, you have to open the -still running- Shutdown task (double click on it in the Tasks pane) and stop it.

Then, re-issue the Stop command to the VM. This time it should work.

Mount a network share on an unprivileged container

cannot be done -> bind mount instead (see pct)

Utilities

pveam – Proxmox VE Appliance Manager

pveam update
pveam available
pveam download <storage> <template>
pveam download local debian-10-turnkey-observium_16.0-1_amd64.tar.gz
pveam download Deployment ubuntu-21.04-standard_21.04-1_amd64.tar.gz

pvesm – Proxmox VE Storage Manager

config file:

/etc/pve/storage.cfg
pvesm status
root@proxmox01:~# pvesm path local-lvm:vm-107-disk-0
/dev/pve/vm-107-disk-0
pvesm add cifs StorageName --server myServer --share myShare --username myUser --domain myDomain --smbversion 3.0 --password
pvesm remove StorageName

Failed migration with ZFS drives:

https://forum.proxmox.com/threads/failed-migration-lack-of-unused-storage-on-desc-server.56220/

pct – Tool to manage Linux Containers (LXC) on Proxmox VE

pct list
pct shutdown 302

Bind mount (container 109, mount point #0):

pct set 109 --mp0 /mnt/pve/Deployment,mp=/mnt/deployment,backup=0,replicate=0,ro=1

Unlock a container:

pct unlock <ID>

Documentation: https://pve.proxmox.com/pve-docs/pct.1.html

Cluster

Remove:

systemctl stop pve-cluster corosync
pmxcfs -l
rm /etc/corosync/*
rm /etc/pve/corosync.conf
killall pmxcfs
systemctl start pve-cluster

Src: https://forum.proxmox.com/threads/proxmox-ve-6-removing-cluster-configuration.56259/

pmxcfs – Proxmox Cluster File System

Misc

NFS share for backups

VM and containers configuration files

/etc/pve/qemu-server
/etc/pve/lxc

Default local storage directory

more /etc/pve/storage.cfg
/var/lib/vz

https://pve.proxmox.com/wiki/Storage:_Directory

Container to hold docker (nesting)

Create a container with debian/ubuntu

  • unpriviledged
  • disk 8GB
  • cpu 2 cores
  • ram 2048 GB, 512 GB swap
  • Network IPv4/v6 DHCP (for now)

Add keyctl and nesting features.

Start and update

create new user

adduser --quiet technician
usermod -aG sudo technician

The rest will happen as leo over ssh.

Install docker following: https://docs.docker.com/engine/install/ubuntu/

Add technician to the docker group to be able to manage the containers:

usermod -aG docker technician

src: https://www.youtube.com/watch?v=hDR_1opHGNQ