Commands - Proxmox


Node has a question mark in the web gui

# check the cluster status
pvecm status
# check the corosync status
systemctl status corosync
# check the pve-cluster status
systemctl status pve-cluster

## Check proxmox node health

```bash
pveperf

Check disk health

lsblk
smartctl -a /dev/sda

Check vm disk health

qm monitor <vmid>
info block
block-dirty-bitmap <drive> <bitmap>

Mount qcow2 disk

# if you have a qcow2 disk image and you want to mount it to a directory
qm importdisk 107 /mnt/vmstorage/images/100/vm-100-disk-0.qcow2 local-lvm
# if the disk is already in the storage
qm set 100 --scsi1 /dev/dm-6,format=raw
qm set 115 --scsi1 /mnt/vmstorage/images/115/vm-115-disk-0.qcow2,format=qcow2

Exclude node from cluster

pvecm delnode <node>

If the delnode command fails, you can use the following command to remove the node from the cluster:

rm -r /etc/pve/nodes/<node>

Fix quorum issues

pvecm expected 1

Remove excluded node from cluster

systemctl stop pve-cluster
systemctl stop corosync

rm -rf /etc/corosync/*
rm -rf /var/lib/corosync/*

rm -rf /var/lib/pve-cluster/*
rm -rf /etc/pve/corosync.conf

killall pmxcfs

systemctl start pve-cluster

pvecm status

This should indicate that the node is not part of a cluster anymore.

reboot

Change node ip

nano /etc/network/interfaces
nano /etc/hosts

# Change the ip address and reboot
reboot

## Enable Wake on lan

```bash
nano /etc/network/interfaces

post-up /usr/sbin/ethtool -s enp4s0 wol g
post-down /usr/sbin/ethtool -s enp4s0 wol g

# Restart network
systemctl restart networking

Unlock container or VM

qm unlock <vmid>
pct unlock <ctid>

Manually unlock a VM or container

rm /var/lock/qemu-server/lock-<VMID>.conf
rm /var/lock/lxc/lock-<CTID>.conf

Backup schedules examples

Backup monday, wednesday, friday and sunday at 01:00.

mon,wed,fri,sun *-*-* 01:00

Backup tuesday, thursday and saturday at 01:00.

tue,thu,sat *-*-*  01:00

Add a new storage to Node

apt install parted

List all available disks:

lsblk

Create a new partition on the disk (replace /dev/sdb with your disk):

parted /dev/nvme0n1 mklabel gpt
parted /dev/nvme0n1 mkpart primary ext4 0% 100%

Format the new partition:

mkfs.ext4 /dev/nvme0n1p1

Name to new storage

mkfs.ext4 -L vmstorage /dev/nvme0n1p1

Mounting the partition:

mkdir /mnt/vmstorage

Edit the /etc/fstab file:

nano /etc/fstab

Add this line replace UUID with your disk uuid and /mnt/data with your mount point.

LABEL=vmstorage /mnt/vmstorage ext4 defaults 0 2

Mount the new partition:

mount /mnt/vmstorage

Proxmox add disk storage space – NVMe drive

Move VM disk to another storage

# install ntfs-3g if you are moving to an ntfs storage
apt install ntfs-3g
# mount your usb drive on host
lsblk
mkdir /mnt/usb
mount -t ntfs-3g -o rw,uid=0,gid=0,umask=000 /dev/sda1 /mnt/usb
# stop the lxc container
pct stop 10X
# create a vzdump
vzdump 1XX --dumpdir /mnt/usb

# unmount the usb drive
umount /mnt/usb

On Destination Proxmox Host

# mount the usb drive on destination host
lsblk
mkdir /mnt/usb
mount -t ntfs-3g -o ro /dev/sda1 /mnt/usb

# check available container IDs
pct list

# restore backup with new ID (e.g., 200)
pct restore 108 /mnt/usb/vzdump-lxc-133-*.tar.gz --storage local-lvm

# if it's a VM use qm restore instead
qmrestore /mnt/usb/vzdump-qemu-200-*.vma.gz 108 --storage local-lvm

# start the restored container
pct start 108

# verify container is running
pct status 108

# unmount usb drive
umount /mnt/usb

Change Backup directory

nano /etc/vzdump.conf

# change dir to desired location
tmpdir: /mnt/pve/nfs-hdd/vzdump-tmp

# restart pve services
systemctl restart pvedaemon pveproxy

!!!!! In case of using TrueNas NFS storage verify that the group and user are set on root !!!!

Remove backups leftovers

rm -r


## Setup Synology ntf mount