I was struggeling recently as I somehow „destroyed“ the operating system of my RPi. So I wanted to setup a better Raspberry Pi backup solution.
The existing solution saved me, true, but we can do better. I had the following setup running:
- Updraft for all the wordpress content. This really saved me. A very nice backup solution. The restore was easy and worked. Google drive is used as storage for the backup.
- A regular backup of the mysql db with automysqlbackup. The backup also worked, but it’s quite difficult to make a restore. This is recommended if you have other applications except wordpress that use the database.
The backup was saved to an USB flash drive mounted to the RPi. - An rsync backup of the most important config files under /etc.
The backup was saved to the same USB flash drive mounted to the RPi.
New backup solution
The new solution now looks like that:
- I’m still using Updraft for all the wordpress content and system. Google drive is used as storage for the backup.
- Optional: A regular backup of the mysql db with automysqlbackup. The backup also works, but it’s quite difficult to make a restore. If you are starting from scratch you have to create the database, users and privileges before importing the content of the database.
This is recommended if you have other applications except wordpress that use the mysql database.
The backup is saved to an USB flash drive mounted to the RPi. - The script raspiBackup saves now both partitions of the RPi file system. Mine are both located on a hard drive, but of course it can be on the S(S)D card as well.
So you need a mounted drive where you wanna save the complete backup and for the restore you need either a linux system with the script running or another RPi.
If you are using the „dd“ method you can also use a windows system.
If you wanna be notified when the backup was running, hopefully successful, you need an mail client.
I was trying to install ssmtp as an e-mail client, but was not successful, so I switched to the – for me – well known exim4.
You can install it based on this tutorial.
Be aware when using it with a google mail account that you have to enable the feature lesssecureapps.
With that solution I’m able to restore the live RPi system reliably much faster with all the data.