Bare-metal backup and recovery for Raspberry Pi using raspiBackup. Creates compressed dd images (.dd.gz / .ddz) that include the partition table, bootloader, and all OS data — fully restorable to any same-size or larger drive.
| File | Purpose |
|---|---|
raspiBackup.conf |
Sanitized raspiBackup configuration (no secrets) |
raspiBackup-install.sh |
One-liner installer for raspiBackup |
RESTORE.md |
Full restore guide (macOS, Linux, Pi) |
This setup uses raspiBackup in dd mode with gzip compression (ddz), storing backups on a NAS mount. Docker and other services are stopped cleanly before the image is taken and restarted after.
| Setting | Value |
|---|---|
| Type | dd (bit-for-bit image) |
| Compression | gzip (.dd.gz) |
| Retention | 3 backups kept |
| Destination | NAS mount (e.g. /mnt/nas_backups) |
A dd backup captures the entire SD card or SSD — partition table, boot partition, root filesystem, and all data. It is a complete clone, not a file-level backup.
Clone this repo to your Raspberry Pi to access the configuration templates and installation scripts.
git clone git@github.com:KDN-Cloud/pi-backups-recovery.git
cd pi-backups-recoveryNote: If you already have a setup for your repositories, you can clone directly into your current directory. Otherwise, use the automated setup below:
mkdir -p ~/projects && cd ~/projects && \
git clone https://github.com/KDN-Cloud/pi-backups-recovery.git && \
cd pi-backups-recoverybash raspiBackup-install.shsudo cp raspiBackup.conf /usr/local/etc/raspiBackup.conf
# Edit to set your backup path, notification tokens, and NAS mount
sudo nano /usr/local/etc/raspiBackup.confsudo raspiBackup.shsudo crontab -e
# Run every Sunday at 02:00
0 2 * * 0 /usr/local/bin/raspiBackup.shsudo crontab -e
# Run every day at 3am and ensure services are started up
00 03 * * * /usr/local/bin/raspiBackup.sh -m 0 ; /usr/bin/systemctl restart docker cronSee RESTORE.md for full restore instructions across macOS, Linux, and Raspberry Pi.
raspiBackup writes to a mounted NAS share. Add to /etc/fstab for automatic mounting:
192.168.1.x:/var/nfs/shared/RaspberryPi4 /mnt/unas_backups/ nfs defaults,_netdev,x-systemd.automount,x-systemd.idle-timeout=600 0 0//192.168.x.x/pi-backups /mnt/nas_backups cifs credentials=/etc/nas-credentials,_netdev 0 0# /etc/nas-credentials (chmod 600, never commit)
username=your_nas_user
password=your_nas_passwordMount and verify before first backup:
sudo mount -a
df -h /mnt/nas_backupsraspiBackup stops services before imaging and restarts them after to ensure a consistent snapshot:
systemctl stop docker
systemctl stop cron
systemctl stop containerd
# Restarted after backup
systemctl start containerd
systemctl start cron
systemctl start dockerAdjust DEFAULT_STOPSERVICES and DEFAULT_STARTSERVICES in raspiBackup.conf to match your setup.