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
,DEST
and wether or not you like to use compression.SRC
is the name of the sdcard you want to backup, i.e./dev/mmcblk0
. You could find the name of your sdcard withlsblk
or in your/etc/fstab
.DEST
is 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.sh
asroot
to schedule your backup job