Skip to content

Instantly share code, notes, and snippets.

@ts-sz
Forked from nderjung/reset-proxmox-cluster.sh
Created September 29, 2021 18:21
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ts-sz/8dbdf2f7550f26df2d35498f652ca026 to your computer and use it in GitHub Desktop.
Save ts-sz/8dbdf2f7550f26df2d35498f652ca026 to your computer and use it in GitHub Desktop.
Reset proxmox cluster
#/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/*
systemctl start pve-cluster
systemctl start corosync
systemctl start pve-cluster.service
systemctl start pvedaemon.service
systemctl start pvestatd.service
@undefined-moe
Copy link

no idea why google indexed this instead of the upstream, just for notice, this is a comment copied from source:

DANGER: This will delete ALL of your container & virtual machine configurations, so unless you want to spend the next however long recreating everything, do not do this!

And here is a guide on how to recreate those config (with zero downtime) if you did this by accident:

  • Create a new vm and container, using a id that is not used (9999 for example)
  • Go to /etc/pve/lxc and /etc/pve/qemu-server
  • Copy it's config and modify the disk, and network info (Do not do this from the web panel to prevent unwanted behavior)
  • You should see the container or vm is still online at the web panel

Check process list if you forget the id-name mapping of the virtual machine.
For linux containers, it's ok to create a inaccurate config and then use pct console [id] to get into the running container to get more info then update the config file.

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