Closed marrobHD closed 1 year ago
When you copy the old contents to the original directory try doing the below instead (basically adding the wildcard will take everything from within that directory and copy it over to the specified one instead)
cp -avr /var/tmp/var/tmp/etc/ /etc/ cp -avr /var/tmp/var/tmp/var/ /var/ cp -avr /var/tmp/var/tmp/root/* /root/
Is that something that should be added to this script or should the script be changed?
Is that something that should be added to this script or should the script be changed?
Maybe restoration
Anybody willing to update the script so this is fixed?
Just an initial working prototype. Not pretty but it is a start. When I find the time I will update the script and create a PR.
#!/bin/bash
set -e
if [[ $# -eq 0 ]] ; then
echo 'Argument missing -> restore.sh proxmox_backup_proxmoxhostname_2017-12-02.15.48.10.tar.gz'
exit 0
fi
FOLDER_1="./$1_1"
FOLDER_2="./$1_2"
mkdir "$FOLDER_1"
mkdir "$FOLDER_2"
tar -zxvf $1 -C "$FOLDER_1"
find "$FOLDER_1" -name "*tar" -exec tar xvf '{}' -C "$FOLDER_2" \;
for i in pve-cluster pvedaemon vz qemu-server; do systemctl stop $i ; done || true
cp -avr $FOLDER_2/. /
rm -r "$FOLDER_1" "$FOLDER_2" || true
read -p "Restore complete. Hit 'Enter' to reboot or CTRL+C to cancel."
reboot
Script working but when i restored pve-cluster.service not start at boot.
Please open a PR if you want this merged. thanks!
@razem-io Are you still searching for time or did you give up? :-P
@DerDanilo ah sorry, forgot about that. I did not modify the script till today. So I will leave it the way it is for now.
my test server failed after restore. (only 1 server in cluster)
what I did: backup pve, then restore it.
admin web page
This page isn’t working 172.16.3.21 is currently unable to handle this request. HTTP ERROR 501
root@test-pve-1:~# systemctl status pveproxy ● pveproxy.service - PVE API Proxy Server Loaded: loaded (/lib/systemd/system/pveproxy.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2022-06-06 12:20:48 CST; 6min ago Process: 910 ExecStartPre=/usr/bin/pvecm updatecerts --silent (code=exited, status=111) Process: 911 ExecStart=/usr/bin/pveproxy start (code=exited, status=0/SUCCESS) Main PID: 912 (pveproxy) Tasks: 4 (limit: 2292) Memory: 143.9M CPU: 1.296s CGroup: /system.slice/pveproxy.service ├─912 pveproxy ├─913 pveproxy worker ├─914 pveproxy worker └─915 pveproxy worker Jun 06 12:20:47 test-pve-1 pvecm[910]: ipcc_send_rec[1] failed: Connection refused Jun 06 12:20:47 test-pve-1 pvecm[910]: ipcc_send_rec[2] failed: Connection refused Jun 06 12:20:47 test-pve-1 pvecm[910]: ipcc_send_rec[3] failed: Connection refused Jun 06 12:20:47 test-pve-1 pvecm[910]: Unable to load access control list: Connection refused Jun 06 12:20:48 test-pve-1 pveproxy[912]: starting server Jun 06 12:20:48 test-pve-1 pveproxy[912]: starting 3 worker(s) Jun 06 12:20:48 test-pve-1 pveproxy[912]: worker 913 started Jun 06 12:20:48 test-pve-1 pveproxy[912]: worker 914 started Jun 06 12:20:48 test-pve-1 pveproxy[912]: worker 915 started Jun 06 12:20:48 test-pve-1 systemd[1]: Started PVE API Proxy Server.
and check hostname is correct
root@test-pve-1:~# cat /etc/hosts 127.0.0.1 localhost.localdomain localhost 172.16.3.21 test-pve-1.test.local test-pve-1 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts root@test-pve-1:~# cat /etc/hostname test-pve-1
root@test-pve-1:/var/log# pveversion -v proxmox-ve: 7.2-1 (running kernel: 5.15.35-1-pve) pve-manager: 7.2-4 (running version: 7.2-4/ca9d43cc) pve-kernel-5.15: 7.2-3 pve-kernel-helper: 7.2-3 pve-kernel-5.13: 7.1-9 pve-kernel-5.15.35-1-pve: 5.15.35-3 pve-kernel-5.13.19-6-pve: 5.13.19-15 pve-kernel-5.13.19-2-pve: 5.13.19-4 ceph-fuse: 15.2.15-pve1 corosync: 3.1.5-pve2 criu: 3.15-1+pve-1 glusterfs-client: 9.2-1 ifupdown2: 3.1.0-1+pmx3 ksm-control-daemon: 1.4-1 libjs-extjs: 7.0.0-1 libknet1: 1.22-pve2 libproxmox-acme-perl: 1.4.2 libproxmox-backup-qemu0: 1.3.1-1 libpve-access-control: 7.1-8 libpve-apiclient-perl: 3.2-1 libpve-common-perl: 7.2-2 libpve-guest-common-perl: 4.1-2 libpve-http-server-perl: 4.1-2 libpve-storage-perl: 7.2-4 libspice-server1: 0.14.3-2.1 lvm2: 2.03.11-2.1 lxc-pve: 4.0.12-1 lxcfs: 4.0.12-pve1 novnc-pve: 1.3.0-3 proxmox-backup-client: 2.2.1-1 proxmox-backup-file-restore: 2.2.1-1 proxmox-mini-journalreader: 1.3-1 proxmox-widget-toolkit: 3.5.1 pve-cluster: 7.2-1 pve-container: 4.2-1 pve-docs: 7.2-2 pve-edk2-firmware: 3.20210831-2 pve-firewall: 4.2-5 pve-firmware: 3.4-2 pve-ha-manager: 3.3-4 pve-i18n: 2.7-2 pve-qemu-kvm: 6.2.0-8 pve-xtermjs: 4.16.0-1 qemu-server: 7.2-3 smartmontools: 7.2-pve3 spiceterm: 3.2-2 swtpm: 0.7.1~bpo11+1 vncterm: 1.7-1 zfsutils-linux: 2.1.4-pve1
most services failed, I'm going to make a fresh install and test again.
root@test-pve-1:~# systemctl -t service --state=running --no-legend --no-pager | grep pve pve-lxc-syscalld.service loaded active running Proxmox VE LXC Syscall Daemon pvedaemon.service loaded active running PVE API Daemon pvefw-logger.service loaded active running Proxmox VE firewall logger pveproxy.service loaded active running PVE API Proxy Server root@test-pve-1:~# systemctl -t service --state=failed --no-legend --no-pager | grep pve ● pve-cluster.service loaded failed failed The Proxmox VE cluster filesystem ● pve-firewall.service loaded failed failed Proxmox VE firewall ● pve-guests.service loaded failed failed PVE guests ● pve-ha-crm.service loaded failed failed PVE Cluster HA Resource Manager Daemon ● pve-ha-lrm.service loaded failed failed PVE Local HA Resource Manager Daemon ● pvescheduler.service loaded failed failed Proxmox VE scheduler ● pvestatd.service loaded failed failed PVE Status Daemon
+1
I can't even boot after the restore. I'm left with a unbootable proxmox installation.
Yes, I guess we should remove the restore and the manual restore information. At the current state, it is very error-prone. At least make a huge banner: "ONLY USE THIS SCRIPT ON THE SAME NODE / PROXMOX VERSION, OTHERWISE IT WILL ALWAYS FAIL. IT WILL ALSO FAIL IF YOU ARE RUNNING A CLUSTER!!!"
It is only to restore a known state, when you configured something wrong on a non cluster proxmox node.
Just a few examples where it will or could fail:
I mainly use the script to secure my vm / lxc configurations and to diff against changes. If you run a promox cluster, you will only need it, if every node in your cluster is gone. If you still have running node(s) in your cluster, restore vm configurations from there.
FYI: I intended this script to backup important parts of the pve cluster itself. Backup up other stuff and also the scripted restore was added by community members. I never use that actually. Only needed a cluster backup once and that's what backups are for. :) Nodes itself should probably be managed via IAC (e.g. Ansible) to document node configuration. This also is way more flexible when having to deploy configuration to nodes with newer software version etc.
@razem-io Would you mind adding appropriate warnings to the restore section in the readme and a short warning banner to the restore script? Thanks in advance!
@tristan-k the problem is the fstab, by restore on fresh system copy /etc/fstab -> /restore/fstab then run the restore script. Move back the fstab from fresh install
cp /restore/fstab /etc/fstab
Grub screen after:
Unpack the original backup
tar -zxvf proxmox_backup_proxmoxhostname_2017-12-02.15.48.10.tar.gz
unpack the tared contents
tar -xvf proxmoxpve.2017-12-02.15.48.10.tar tar -xvf proxmoxetc.2017-12-02.15.48.10.tar tar -xvf proxmoxroot.2017-12-02.15.48.10.tar
If the services are running, stop them:
for i in pve-cluster pvedaemon vz qemu-server; do systemctl stop $i ; done
Copy the old content to the original directory:
cp -avr /var/tmp/var/tmp/etc /etc cp -avr /var/tmp/var/tmp/var /var cp -avr /var/tmp/var/tmp/root /root
And, finally, restart services:
for i in qemu-server vz pvedaemon pve-cluster; do systemctl start $i ; done