Restore full system under OpenVZ


New in the Restic realm…Today, I need to restore a full OpenVZ VPS (ie. CentOS 7). So, could you guide me about the good how-to?

Backups are done every night by cron towards a remote repository (promptless login has been managed). My restic-excludes list (ie. not backep-up) is: /proc/*, /sys/*, /dev/*, /run/*, /tmp/*.

Does a simple command like below would suffice or not? What’s the right way? Does OpenVZ introduces something special to take care of?

su (to be root in VPS to restore)
export RESTIC_PASSWORD="placeforthepassword" 
nohup restic restore 648bd4a7 --target / >restic-restore.log 2>&1

[user, pass, repo, snapshot id and domain above are not the real ones]

“nohup” being there to prevent any stop in case of disconnection since I’m reaching the VPS through SSH (from PuTTY).

Of course, I need to be able to directly reconnect through SSH afterward, since I have no physical access to the machine.

I’m just curious; Why do you want to restore the entire system instead of just your data and configuration onto a newly installed system?

Because it’s a VPS I had in standby for a project whose development has been highly impacted by the new coronavirus’s world… Then, some days ago I just visited it and found that some essential points like DNS, panel-related installations were broken… It’s just what I saw, but I don’t know if there’s something else (I mean, broken) around. So, in this situation, I have three possibilities:

  1. I restore to a previous date I know it was OK (I have Restic backups one and two months ago)

  2. Figure-out, point per point, what has been broken (I mean, what pieces, whatever the origin of this state; could be a corrupted auto-update from the panel for example, but I don’t know since this VPS was in standby for say four months); for example, I could do a Restic diff to evaluate the modifications, but chance it will be a lot of data to parse (by hand).

  3. I could close this VPS and rebuild one when this dev will be on the road again… Would be a one-week job knowing I’ve full detailed history (my habit to note anything in a journal for every project) of the steps to rebuild anything!

For me, #2 would be a lot of effort since I’m currently on another project and I would like to minimize the parenthesis (and keep focused). And the point #3 would be a pity since I would prefer to take the opportunity (of this unfortunate situation) to test and learn how to restore all in full… So, I would like to go with the point #1 : full Restic restore!

Hoping it replies to your interrogation :wink:

EDIT: At your turn, can you answer my questions, please?

I don’t know much about openvz but I did a few restores like that to other VPS. So I don’t see a reasons why it should not work.

Described it here some time ago Bare metal restore from restic repo: worked fine!

1 Like

OK, thanks a lot for your feedback, betatester77. The difference between your case and mine seems to be that you started from another system in a fresh VPS while I would like to restore (overwrite) to the same. So, I guess I don’t have to chroot to a new mounting point nor take care about grub… But Restic will have to deal with eventual locked files, for example.

Well, I’m going to take a try and we will see…

Well, my feedback; in case that would be useful to someone someday…

Before restoring, I managed my remote repo to be easily downloadable considering the disk space in my VPS (the one to restore). So, I used forget on some snapshots, then prune and a final scp to be able to restore locally (just to reduce the number of eventual reasons of failure).

At first, the restore of full system (from “/”) failed and corrupted the VPS. Then, I asked to my provider to restore the OpenVZ container from a backup I did just before my attempt.

In a second pass, I simply stopped the maximum of running services and this time it worked; I was able to reboot with success and files was well changed. Nevertheless, the Restic log I managed in my command line showed me that there were 6692 errors.

Then, I tried to restore some specific folders and files using --include, in case… But it didn’t suffice to recover full good working (especially about the control panel – Webuzo – that certainly corrupted a lot of my config during its auto-updates; but I don’t know exactly what and when since I didn’t maintain this VPS for, say, 4 months)

At the end, even if this Restic restore was a good experience, it didn’t solve all my issues with this VPS… So, as stated in my second message in reply to rawtaz above, I closed it!

EOExperience :slight_smile: Next (I mean next project; return on focus to my current one)!

1 Like