Page 1 of 1

[script] rsync your entire Raspberry OS to sd-card (swap and run incase of failure)

Posted: Tuesday 27 December 2016 16:23
by Siewert308SW
Was fiddling with a idea today.
As for many times i screwed my entire system again last week.
Although i had Domoticz backup is still needed to create a new rasbian image and install all packages again and set all conf also.
9 times out of 10 i forget what i had installed or amended to the system.
There for i came up the idea to take a second sd-card to which i weekly rsync my entire system via cron.
So that in case i scew up again i only need to swap cards and i'm back online in 30 seconds.
Only thing remaining is setting back my daily domoticz backup.

The first time this scripts is running it will do a full rsync.
The next time it only rsyncs files which are amended or new.
Saves me a lot of time and not afraid of screwing up things again ;-)

Wiki:
https://www.domoticz.com/wiki/Rsync_ras ... ash_script

Rsync script link:
https://bitbucket.org/Siewert308SW/domo ... ew-default

Re: [script] rsync your entire Raspberry OS to sd-card (swap and run incase of failure)

Posted: Tuesday 27 December 2016 19:38
by nigels0
An easier route is to use this script https://github.com/billw2/rpi-clone just needs one parameter.

Re: [script] rsync your entire Raspberry OS to sd-card (swap and run incase of failure)

Posted: Tuesday 27 December 2016 19:47
by Siewert308SW
nigels0 wrote:An easier route is to use this script https://github.com/billw2/rpi-clone just needs one parameter.
Thx for spoiling my moment ;-)
Will post this script in the wiki and close this thread if thats possible...

Re: [script] rsync your entire Raspberry OS to sd-card (swap and run incase of failure)

Posted: Tuesday 27 December 2016 23:20
by Nautilus
Siewert308SW wrote:
nigels0 wrote:An easier route is to use this script https://github.com/billw2/rpi-clone just needs one parameter.
Thx for spoiling my moment ;-)
Will post this script in the wiki and close this thread if thats possible...
After a quick look of the other suggested script it looks like it needs some user input during the operation (in it's standard format at least) and thus might not be optimal for scheduling. Also, you'd need to modify it at least for the part of handling Domoticz stop/start etc. So there's still a change to reclaim your moment I'd say...:) Of course, if you see the other script as somehow "better" then maybe use those parts to improve yours but anyhow I'd be interested to try this kind of full backup script optimised for RPi with the main purpose of running Domoticz! :D

Re: [script] rsync your entire Raspberry OS to sd-card (swap and run incase of failure)

Posted: Wednesday 28 December 2016 0:44
by Siewert308SW
Nautilus wrote:
Siewert308SW wrote:
nigels0 wrote:An easier route is to use this script https://github.com/billw2/rpi-clone just needs one parameter.
Thx for spoiling my moment ;-)
Will post this script in the wiki and close this thread if thats possible...
After a quick look of the other suggested script it looks like it needs some user input during the operation (in it's standard format at least) and thus might not be optimal for scheduling. Also, you'd need to modify it at least for the part of handling Domoticz stop/start etc. So there's still a change to reclaim your moment I'd say...:) Of course, if you see the other script as somehow "better" then maybe use those parts to improve yours but anyhow I'd be interested to try this kind of full backup script optimised for RPi with the main purpose of running Domoticz! :D
thx... Noticed a flaw in the mounting section.
If the mount isn't right then it just syncs the data to a folder specified in the script called: MOUNT_LOCATION
So need to fix that