If I want to make a full backup so I can revert an update, would this be enough, or do I need to keep anything else?
sudo service homeassistant stop
sudo tar -czvf /bku/hass-`date +%Y%m%d_%H%M`.tgz /srv/homeassistant /home/homeassistant/.homeassistant
sudo service homeassistant start
This is with homeassistant being installed in the /srv/homeassistant virtualenv and the database is sqlite3 stored in .homeassistant
I have a Pi and what I usually do is shut it down and just image the SD card. It takes a lot longer, but if I do run into an issue, it’s drop dead easy to get back to a working config.
This is what I do everytime after a stable updates/upgrades as well… but my Pi is in a case hanging on the wall… so it does take a bit of time to shut it down, take out the case and remove the card then backup the image, then put it back in.
I wish I could do a backup LIVE as it’s running… but I haven’t found a best way yet
I have a cronjob, which saves the image of the card every sunday to my nas and another cronjob, which saves my .homeassistant-folder to my nas every day.
Of course I recovered the image back to the sd-card and it worked like it should. The only one issue is that the images have the same size like the card and the Windows-Application “Ester” says the card is smaller than the image. Win32Diskimager worked as it should.
I use the following commands:
sudo mount -t cifs -o username=<USERNAME>,password=<PASSWORD> //<IP OF YOUR SHARE>/<PATH TO YOUR SHARE> /media/backup/
sudo dd if=/dev/mmcblk0 | gzip > /media/backup/HASS04.05.17.img.gz
The first command mounts your network drive and the second makes the image, zips it and put it in the network drive.
@ReneTode this sounds like an excellent solution. However for some unknown reason my Windows machine does not see the rpi smb share. My MacBook pro sees it fine but my Windows 7 machine not (and as this runs 24/7 I would love to use that one. Is there anything specific on the win7 machine that needs to be done to see the share?
i have my shares Always mounted at startup, because i have 3 backups in a cronjob.
every 15 minutes i backup my data
every day i backup my settings and pi dir
every week i backup an image
@tyfoon i backup from the RPI to a windows machine. so i dont see a share from the RPI but i have a share on the PC (win 10) and the RPI uploads to that share.
For safeties I do a full image backup but on a nightly basis I am backing up my Pi and HASS home directories using Webmin, which is basically just a systems management web interface. Allows me to monitor stats, update packages, manage services, etc. Just all around great tool.