Skip to content

Instantly share code, notes, and snippets.

@CalebFenton
Forked from lotherk/del_cluster.sh
Last active December 8, 2021 23:48
Show Gist options
  • Save CalebFenton/12f8db599270ee483cb89fd72af41060 to your computer and use it in GitHub Desktop.
Save CalebFenton/12f8db599270ee483cb89fd72af41060 to your computer and use it in GitHub Desktop.
delete proxmox cluster
#/bin/sh
# source: https://forum.proxmox.com/threads/removing-deleting-a-created-cluster.18887/
set -x
# stop service
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
#sqlite> select * from tree where name = 'corosync.conf';
#254327|0|254329|0|1480944811|8|corosync.conf|totem {
#version: 2
#[...]
#sqlite> delete from tree where name = 'corosync.conf';
#sqlite> select * from tree where name = 'corosync.conf';
#sqlite> .quit
# create update sql
cat <<EOM > /tmp/update.sql
delete from tree where name = 'corosync.conf';
.quit
EOM
# update sql
sqlite3 -echo /var/lib/pve-cluster/config.db < /tmp/update.sql
rm -f /tmp/update.sql
# remove directories
pmxcfs -l
rm /etc/pve/corosync.conf
rm /etc/corosync/*
rm /var/lib/corosync/*
# CAREFUL: This removes all your VMs and LXCs.
#rm -rf /etc/pve/nodes/*
rm /etc/pve/priv/known_hosts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment