Skip to content

Instantly share code, notes, and snippets.

@wommy
Last active May 15, 2025 01:57
Show Gist options
  • Save wommy/1eff6ccd9173fed6b7067708f2c6c215 to your computer and use it in GitHub Desktop.
Save wommy/1eff6ccd9173fed6b7067708f2c6c215 to your computer and use it in GitHub Desktop.
#!/usr/bin/bash
## so we're taking the Proxmox VE Host Backup script, former ttech :: https://community-scripts.github.io/ProxmoxVE/scripts?id=host-backup
## aka :: bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/tools/pve/host-backup.sh)"
## the only line we need is 65 or
## tar -czf "$BACKUP_PATH$BACKUP_FILE-$(date +%Y_%m_%d).tar.gz" --absolute-names "${selected_directories[@]}"
## we're going to improve this using zstd
## ssh into NAS and then SSH into Node
export NAS=ed.llo
export NODE=skylake1.llo
export NODE_NAME=skylake1
export BACKUP_PATH=/mnt/$(date +%yq%q_%m%da)-$(hostname)
ssh $NAS
ssh $NODE
## newer tar script
time tar --absolute-names -v \
-c -I "zstd -9 -T0" \
-f "$BACKUP_PATH-root_etc.tar.zst" \
--exclude='/etc/pve' /etc /root
## copy .bash_history and fish_history to /mnt/
cp ~/.bash_history $BACKUP_PATH-basHist
cp ~/.local/share/fish/fish_history $BACKUP_PATH-fisHist
## rsync /mnt/ to $decommish_dir/
## figure out NAS_IP $192.168.10.8:/$zpool/bckp/decommish/
## VARS rsync --info=progress2 -vzhPiSr -f'- /pve' -f'- /vzsnap0' --remove-source-files /mnt/ NAS:/sm7h/bckp/decommish/ -n
rsync --info=progress2 -vzhPiSr -f'- /pve' -f'- /vzsnap0' --remove-source-files /mnt/ $NAS:/sm7h/bckp/decommish/ -n
## remove node from cluster from Node :: https://pve.proxmox.com/wiki/Cluster_Manager#pvecm_separate_node_without_reinstall
systemctl stop pve-cluster ; systemctl stop corosync ; pmxcfs -l
rm /etc/pve/corosync.conf ; rm -r /etc/corosync/*
killall pmxcfs ; systemctl start pve-cluster
shutdown now
## on cluster # $node
pvecm delnode $NODE_NAME
## TUDO tighten up variables
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment