Skip to content

Instantly share code, notes, and snippets.

@dsbilling
Last active November 3, 2025 20:42
Show Gist options
  • Select an option

  • Save dsbilling/9c0d97d885bcd0fc25f1409fe2fd2d06 to your computer and use it in GitHub Desktop.

Select an option

Save dsbilling/9c0d97d885bcd0fc25f1409fe2fd2d06 to your computer and use it in GitHub Desktop.
A simple script to reset the Proxmox Cluster.
#/bin/bash -xe
systemctl stop corosync.service
systemctl stop pve-cluster.service
systemctl stop corosync
systemctl stop pve-cluster
pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/*
rm /var/lib/corosync/*
# This could be to destructive, I would recommend to delete the folders manually
# rm -rf /etc/pve/nodes/*
systemctl start pve-cluster
systemctl start corosync
systemctl start pve-cluster.service
systemctl start corosync.service
@NucleaPeon
Copy link

Service start commands fail on pve-cluster with

[main] notice: unable to acquire pmxcfs lock - trying again

Proxmox VE 8.1

@Pamalosebi
Copy link

I had that too... I had to use this and it worked:

killall pmxcfs
sleep 30

Basically, you need to stop the previously started `pmxcfs'.

This is what the script would look like:

#/bin/bash -xe
systemctl stop corosync.service
systemctl stop pve-cluster.service
systemctl stop corosync
systemctl stop pve-cluster

pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/*
rm /var/lib/corosync/*

# This could be to destructive, I would recommend to delete the folders manually
# rm -rf /etc/pve/nodes/*

killall pmxcfs
sleep 30

systemctl start pve-cluster
systemctl start corosync
systemctl start pve-cluster.service
systemctl start corosync.service

Another version I found online looked like this:

#/bin/bash -xe

systemctl stop pvestatd.service
systemctl stop pvedaemon.service
systemctl stop pve-cluster.service
systemctl stop corosync
systemctl stop pve-cluster

sqlite3 /var/lib/pve-cluster/config.db "delete from tree where name = 'corosync.conf';"

pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/*
rm /var/lib/corosync/*
rm -rf /etc/pve/nodes/*

killall pmxcfs
sleep 30

systemctl start pve-cluster
systemctl start corosync
systemctl start pve-cluster.service
systemctl start pvedaemon.service
systemctl start pvestatd.service

@thiruvk
Copy link

thiruvk commented Feb 1, 2025

this is dangerous ... DO NOT TRY THIS WITHOUT KNOWING WHAT YOU ARE DOING.

plz include the steps to backup the files or move the fils to different location rather deleting

@lukebarton
Copy link

Yeah, RIP my VMs 😢 Careful as you go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment