GitHub repository: mr-manuel/raspberry-pi-backup
I wrote this script for myself. I'm not responsible, if you damage something using my script.
You like the project and you want to support me?
The script backups the whole SD card (also empty blocks) of a Raspberry Pi to a SMB/CIFS share on a NAS/computer without the need to remove the SD card. It works also with Venus OS from Victron Energy.
NOTE: It's not possible to change the used method to not backup empty blocks. The backup will always have the same size as your SD card is. Therefore it works on many systems without installing additional software.
Change the variables in the backup.sh
script with nano
, vi
, vim
or the editor of your choise.
Standard install path /opt/raspberry-pi-backup
Venus OS install path /data/etc/raspberry-pi-backup
-
Execute this commands to download and install the script:
wget -O install-backup.sh https://raw.githubusercontent.com/mr-manuel/raspberry-pi-backup/master/install-backup.sh bash install-backup.sh
-
Modify the needed parameters by changing the
backup.sh
script. -
Run the script on demand or setup a cronjob, if you want to run the backup automatically. You can use the Contab Generator.
Command to execute:
On standard Linux
/opt/raspberry-pi-backup/backup.sh
On Venus OS
/data/etc/raspberry-pi-backup/backup.sh
NOTE: After a Venus OS update you have to setup the cronjob again.
Remove the cronjob (if any) and delete the folder with the script.
Run the script directly and check the output.
Turn off the Raspberry Pi, remove the SD card and insert it in your computer. Write the backup image file to the SD card with Balena Etcher or the tool you prefer.