I have a specific situation with one remote Debian(Stretch) server. Mainly there is no one at the site and I need to do some risky upgrades and reconfigurations remotely.
I'm looking for a way to implement a fail-safe system to prevent the situation where I lock myself out. For example, if after a reboot I'm not able to log back in via ssh for a set amount of time that the system issues a dd restore on the root partition from a previously done dd clone.
The main problem is how to do the dd clone/restore safely on a running system. I tried it on my test rig... and it ends up not booting with "UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY." message
Thankfully fsck was able to fix the issues and make the system bootable again... But this seems to me more just luck than a proper method to do it... On top of it, I was able to run fsck manually only because I was physically there next to the machine, which I wouldn't be able to do remotely(maybe it could be scripted)
Is there a way to unmount / and do the clone... Downtime is not an issue.. So a solution which would be automated via a offline script is totally acceptable. I was thinking maybe there is a way to script dd to run at the very last stage of a shutdown/reboot process, when the partition unmounts, but will dd be available then? :-/
Before I go on reinventing the wheel, I though I better ask here for a proven method. Thank you all for any help!
0 Answers