Yes @ReneTode, your right. The command I mentioned must be executed on another machine then the rpi (e.g. Ubuntu desktop).
No @ReneTode , your wrong. This command logs in rpi via ssh, run dd of the sd and zip that on the rpi and finally transmit it over network to the machine, the whole command was entered and write it on that machine into a file called image.gz.
Yes @ReneTode , your right. If you would write the image to an other sd you frist have to unzip it. But thatās really simple.
This applies to anything that HA is loaded on. The Raspberry Pi may have certain issues but any system (odroid, nuc, full blown pc/mac) WILL fail; its just a matter of time and luck.
@ReneTode what is the reason for frequent updates of the OS image? I image it once I install the OS and HA and any other items and then let it be. Yes the HA version will be out of date but as quick as the HA updates are for me I would spend more time imaging the SD card than just running an update after I re-image it. If I need to install something for a new component I would create an image then, however, no regular backups of the SD card.
Just checking that I am not missing something and should have more frequent image backups.
Very Nice. I used a minor tweek on this to account for the default device and to give dd the root permissions.
ssh pi@my-rpi āsudo dd if=/dev/mmcblk0 | gzip =1 -ā dd of=image.gz
Like I said earlier, there are two different types of backups that need to be maintained. One is a system (SD) card backup and should be done once your system is stable. Itās a known point in time when you can go back and recover your system. I see this as something I do when I have done more work in the way of changes than I want to have to re-do if there is a failure. For example, about a week ago, I moved my log to mysql. While that wasnāt a lot of work, and it went pretty well, it represented enough of a change in my mind that once I got it working the way I wanted, I would do a SD card backup and save it somewhere. Whether that is to an image file on a larger drive somewhere, or to a spare SD card is user preference.
The second type backup is one I automate to run nightly. It only gets the configuration files for HA and AD and any python source in AD. This is my fall back when I try setting up something and screw up my config files to the point that I canāt remember what all I changed and want to go back to a known good configuration to start over with the configuration. Iāve automated it to run nightly at midnight because I donāt have enough self discipline to make myself do it before every time I start editing the config or source files. So automating it nightly works for me. If you have the self discipline to remember to do it before you start working on a file, then do it yourself. Storing the files in Git could be another method for this type backup.
And finally, yes all hardware fails at some point. There are things you can do to help protect yourself from it, but it becomes a cost benefit exercise at that point, and that is different for each one of us.
I am editing my apps still frequently.and i have a load off data saved daily.i want to create a system that automaticly checks if my data on the sd card is outdated. But untill then i want my wife to be able to restart the system with as little data loss as possible. Thats why i frequently make a image copy. Idont zip because i have more then enough space. And i automaticly set the last image to an sdcard as well.
i also automaticly save my whole config enviroment. So ineed only to implement a check after restart from homeassistant if data is outdated and then a filecopy.
after that i will reduce the amount of image backups.
but i dont have the time right now, so better save then sorry.
I need a backup that even someone who doesnt know anything about automating can make things working again in a few minutes time.
Seeing this is why I decided to put HASS in a Virtual Machine rather than use a Pi. It works well for me as I can make backups of that VM as necessary and snapshot when want to test more intrusively than my HASS config files I have been fortunate enough that Iāve not had a SD card die in a Pi yet, but what I had created on them is designed run in-memory or save elsewhere to not tax the card so much.
@Bahnburner - i saw you post above about using ārpi-cloneā, i have thought about running this with a stop HA / restart HA either side (just to be sure). Have you scripts / scheduled this on the pi ?
Iāve thought about it, but the process is interactive, so Iām not sure how I would script for that and rpi-clone has to be ran as root, which the hass user doesnāt have access to.
No I am running HASS on top of Ubuntu Server 16.04 LTS
I just went to where my comfort level is - which is with Ubuntu. I have got homebridge running on Arch Linux but that was a steeper curve to climb - the upshot is a very small footprint!
Excellent, thank you for that info. I have a couple laptops and a desktop laying around that I had thought about putting into service as a home automation server. I may have to set one up with VirtualBox and give it whirl.
There are a lot of replies, but I think I did not see a mention here. Just and fyi. If it was mentioned before, sorry my bad.
I am using HASS on RPi also, but I am using it on the latest Raspbian. This one has a backup tool included and it will clone your microSD card on a second microSD attached via USB to RPi.
So basically when your microSD will crash just swap the microSD with the backup and restart the PI.
Or if you have the guts or cli is your call: sudo dd bs=4M if=/dev/sdb of=raspbian.img
LE: I forgot to mention on the first method, the backup is live . This was a must for me.
Is there anything special required for virtual machine - this sounds like the road I want to go down and I plan on doing some test installs soon, any advantage to running Server or will almost any flavour of linux work?
Reason I chose Ubuntu server is because resources are scarce on my hypervisor host, and I have the VM running with 1 CPU and 512Mb RAM happily. By default Ubuntu server does not have any UI etc installed, so you donāt have the overhead of these to consume resources.
I expect Debian or any any other flavour you are used to will work, but you might need to tweak the instructions if that Linux version does not have apt-get or the systemctl daemon handling.
Over and above those instructions, only other thing I did (apart from selecting to enable SSH at install) was install samba so I could edit the configuration files on my PC. Let me know if you need help on this piece - as I ended up creating a group to ensure the access worked.
Thanks - my only experience of linux really has been home-assistant on a pi so no ingrained preferences. Happy to do a few test runs and keep the pi running while I work it out, machine wont be used for anything else. Iāll probably just start with Ubuntu.