Backup and restore your running Raspberry
Clone or download
Latest commit 951fdc2 Nov 13, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE Update Jul 6, 2018
RESTAPI Using optional parm Jul 27, 2018
extensions Updated cpy Oct 19, 2018
helper Test whether nfs parition already mounted Nov 4, 2018
installation Updating config files Sep 29, 2018
test Updated tests May 11, 2018
.travis.yml Added sudo in travis May 11, 2018 Create Mar 11, 2018 Create Mar 11, 2018
LICENSE Added license file Dec 14, 2016
Makefile Updated tests May 11, 2018 README update Nov 13, 2018 Added inspect Sep 27, 2018 Fixed pv issue #70 Sep 19, 2018

raspiBackup - Backup and restore your running Raspberries

  • A full system backup will be created unattended with no shutdown of the system or other manual intervention just by starting raspiBackup using cron. Important services will be stopped just before starting the backup and are started again when the backup finished.
  • Any device mountable on Linux can be used as backupspace (local USB disk, remote nfs drive, remote samba share, remote ssh server using sshfs, remote ftp server using curlftpfs, webdav drive using davfs, ...).
  • Standard Linux backup tools dd, tar and rsync can be used to create the backup.
  • An external rootpartition, Raspberry 3 USB boot images and NOOBS images are supported.
  • Status eMail sent when backup finished
  • Much more features ... (See doc below)



For the latest and actual list of options see here

pi@raspberry: $, 2018-02-21/19:17:52 - 7f9d77a
usage: [option]* {backupDirectory | backupFile}

-General options-
-A append logfile to eMail (default: no)
-b {dd block size} (default: 1MB)
-D "{additional dd parameters}" (default: no)
-e {email address} (default: no)
-E "{additional email call parameters}" (default: no)
-g Display progress bar
-G {message language} (EN or DE) (default: EN)
-h display this help text
-l {log level} (Off | Debug) (default: Off)
-L {log location} (Syslog: /var/log/syslog | Varlog: /var/log/raspiBackup/<hostname>.log | Backup: <backupPath> | Current: ~/raspiBackup.log) (default: Varlog)
-m {message level} (Minimal | Detailed) (default: Minimal)
-M {backup description}
-n notification if there is a newer scriptversion available for download (default: yes)
-s {email program to use} (mail,ssmtp,sendEmail,mailext) (default: mail)
-u "{excludeList}" List of directories to exclude from tar and rsync backup
-U current script version will be replaced by the actual version. Current version will be saved and can be restored with parameter -V
-v verbose output of backup tools (default: no)
-V restore a previous version
-X extended attributes and ACLs are handled by tar (default: no)
-z compress backup file with gzip (default: no)

-Backup options-
-a "{commands to execute after Backup}" (default: )
-B Save bootpartition in tar file (Default: 0)
-k {backupsToKeep} (default: 3)
-o "{commands to execute before Backup}" (default: no)
-P use dedicated partitionbackup mode (default: no)
-t {backupType} (dd|rsync|tar) (default: dd)
-T "{List of partitions to save}" (Partition numbers, e.g. "1 2 3"). Only valid with parameter -P (default: *)

-Restore options-
-C Formating of the restorepartitions will check for badblocks (Standard: 0)
-d {restoreDevice} (default: no) (Example: /dev/sda)
-R {rootPartition} (default: restoreDevice) (Example: /dev/sdb1)
--noResizeRootFS or --resizeRootFS (Default: yes)

Detailed information

Miscellaneous tools and utilities

  • Wrapper script for raspiBackup to add any activities before and after backup (Code)

  • Wrapper script which checks whether a nfsserver is online, mounts one exported directory and invokes raspiBackup. If the nfsserver is not online no backup is started. (Code)

  • Script which restores an existing tar or rsync backup created by raspiBackup into an image file and then shrinks the image with pishrink. Result is the smallest possible dd image backup. When this image is restored via dd or windisk32imager it's expanding the root partition to the maximum possible size. (Code)

  • Installation scripts (Code)

    • raspiBackup Installation
    • Extension sample installation

Sample extensions (Code)

  • Sample eMail extension
  • Sample pre/post extension which reports the memory usage before and after backup
  • Sample pre/post extension which reports the CPU temperatur before and after backup
  • Sample pre/post extension which reports the disk usage on the backup partition before and after backup and the absolute and relative change
  • Sample pre/post extension which initiates different actions depending on the return code of raspiBackup
  • Sample ready extension which copies /etc/fstab into the backup directory

REST API Server proof of concept

Allows to start a backup from a remote system or any web UI.

  1. Download executable from RESTAPI directory
  2. Create a file /usr/local/etc/raspiBackup.auth and define access credentials for the API. For every user create a line userid:password
  3. Set file attributes for /usr/local/etc/raspiBackup.auth to 600
  4. Start the RESTAPI with sudo raspiBackupRESTAPIListener. Option -a can be used to define another listening port than :8080.
  5. Use curl -u userid:password -H "Content-Type: application/json" -X POST -d '{"target":"/backup","type":"tar", "keep": 3}' http://<raspiHost>:8080/v0.1/backup to kick off a backup.