This is a simple script to create an image backup from Raspberry Pi SD card and probably other sd cards as well.
Source:
Licence: GPLv3
- Clone this repo to your Raspberry Pi, e.g. with
https://github.com/Tronde/raspberrypi-dd-backup.git. cd raspberrypi-dd-backup# Change into project directory.- Copy CONFIG.sample to config, e.g.
cp CONFIG.sample config. This way you won't overwrite your confi when you pull the upstream repo with a changed CONFIG.sample. - Edit config and specify
SRC,DESTand wether or not you like to use compression.SRCis the name of the sdcard you want to backup, i.e./dev/mmcblk0. You could find the name of your sdcard withlsblkor in your/etc/fstab.DESTis the path to where the backup should be written, i.e./mnt/backup-target/image-file-name.img. In case you would like to keep multiple backups you could automatically attach the current date to the filename, e.g./mnt/backup-target/raspi-sht21-$(date +%Y-%m-%d).img. - Optional: Setup cronjob to run
raspberrypi-dd-backup.shasrootto schedule your backup job