Backup your RPI!

Sorry Rene,
The joke didn’t translate well. By saying “all I intended” it’s like you were saying that you didn’t have answers you just wanted to get people talking. I know that is far from the truth, hence the joke. I was hoping the LOL on the end would key it as a joke. I am sorry.

no hard feelings.
I am a little on the edge right now.
I was already amazed that something like that came from you :wink:

the LOL could work both ways in that sentence :wink:
sometimes its hard to tell what people mean when they write it

I have nothing but respect and thanks for you. You have been a great help to me and everyone else on the board. :wink:

1 Like

@keith-michael
There are 2 ways of backup in my post, first one(the one I am ussing) is this one:

It is an app included in the latest version of the Raspbian. You can find it in the “Start” menu.
This one will replicate your sd to a second sd inserted in the usb via an adapter. Like this you will have a sd ready to boot in case the main one will crash.
I don’t know if it works on different size cards, I have never tested.
LE: I tried to make a backup to a USB stick different size, and it was successful.
Usually I make an upgrade of Hass and after a few days(if all is fine) I run this, but this one runs from the X server and requires human interaction.

The second method is via CLI, using DD command.
https://linux.die.net/man/1/dd
This has the advantage that you can use via scripting. For more explications check this:

Thank you for that. Are you aware of any problems if I were to power off Pi, remove card, mount in Windows and create image that way as described on thepiehunt.com? I was concerned Windows may write to the SD card and cause problems. If there is no cause for concern this is probably how I would prefer to backup Pi.

There is no problem. That’s what I used untill Raspian included the mentioned tool. I just did not like the down time :).
But be sure to shut down the pi before unplug it. If you just unplug it you can corup the card, and the backup will be corupted also.

Has anybody ever looked at REAR to backup the whole system live?
I stumbled upon this and it does not seem hard to set up, but I have not had a chance to implement this and I was wondering if it actually would be of good use…

REAR website: http://relax-and-recover.org/

Just cheking form some inputs on this tool actually…

Thanks

How about this: http://cagewebdev.com/raspberry-pi-creating-a-backup-image-while-the-raspberry-pi-is-running/

2 Likes

Did you test it?

After my install I did a simple dd copy of the SD card to my laptop. I added samba to my Home Assistant

sudo apt-get samba samba-common

sudo pdbedit -a pi

then added the pi home folder to smb.conf

Every time I alter configuration.yaml I (from the .homeassistant directory) do this

cp configuration.yaml /home/pi

then I just grab it in the finder and back it up somewhere else.

Is it possible to change sd card to a bigger and better one?
I have HASS running on rpi3 hassbian.
Can i do this?

  • Turn off hass and pie
  • take my sdcard to my windows computer, use win32diskimager.
  • read the image
  • write the image to my new card
    *reboot pie

or will this cause any problems?
i want to change from 8gig to something bigger and faster.

One more question, is it possible to boot hass from a usbthumbdrive instead? Shouldn’t that be better to use than a sdcard?

i dont know if its better from an usbthumbdrive, but it should be possible.

your way to get a bigger card must work. ive done it on a simular way.

Yes, you can write the image to a bigger sdcard without problem. The system will still see it as an 8GB “disk” until you change the partition size and resize the filesystem though, but it’s quite easy and you can find lots of guides on how to do it online.

1 Like

Good to hear, then i will buy a new one…
But one more question.
What files is crucial for hass?
Can i just backup my *.yaml files, do a fresh install on sdcard and copy over *.yaml files and expect everything to work as it did before? or is the flash img option better?

a new install with overwriting the yaml files would work also.

1 Like

If nothing is wrong with your install, then I would just make an image and write the image to a new sdcard.

Short version on resizing the filesystem. Not a step-by-step guide, just describing the steps needed:

  • Write disk image to the new card and boot from it
  • Run sudo fdisk -l /dev/mmcblk0 (if that’s your sdcard device) and take note of the starting sector number of partition 2
  • Delete partition 2 and then re-create it with the new size. Use the old starting sector number and set the end sector to something bigger than the old one. You can set the end sector as a number, or set a partition size like +10G. This changes the partition size, but not the file system itself.
  • Save changes and reboot. After reboot you can run resize2fs to increase the filesystem size.

Find a guide and give it a go - if you mess something up you can just write the disk image to the new card and try again :wink:

1 Like

@Bit-River. I currently use π3 and I’ve had many SD card corruptions over the last 18 months. As I have a C1 and C2, can you advise the best way to run hass.io on those?

Corrupt SD cards are nearly always down to an undersized power supply (the rest of the time it’s power failure). Make sure your power supply can supply at least 2.4A, and that it’s not a mobile phone charger.

For running Hass.io, see the install guide. You’ll need to find a compatible image and test that.

Thanks. I’ll check when I get back from holiday but pretty sure my ‘live’ system uses a dedicated 3A Pi power supply.