Skip to content

Latest commit

 

History

History
32 lines (21 loc) · 1.25 KB

README.md

File metadata and controls

32 lines (21 loc) · 1.25 KB

Backup script for Raspberry Pi

This script does an image backup of the Pi SD card using dd. It is not the most efficient method, but it creates a complete backup and it's easy to restore in case of complete card failure.

Installation

  • Clone this repo into the folder where you keep your housekeeping scripts.
  • Modify the MOUNTPOINT and SUBDIR variables to point to your destination
  • Modify STARTSTOPSERVICE variables to 1 if you want your serives stopped/started
  • Update services stop and start sections to reflect your installated services
  • Optional: Modify GZIP variable if you want your backups zipped
  • Make executable. chmod +x backup.sh
  • Update crontab to run each it each night.

Example

Update /etc/crontab to run backup.sh as root every night at 3am

01 3 * * * root /home/pi/scripts/backup.sh

The backup took a little more than an hour on my first run (SD card to USB HDD).

CREDITS

This script started from http://raspberrypi.stackexchange.com/questions/5427/can-a-raspberry-pi-be-used-to-create-a-backup-of-itself which in turn started from http://www.raspberrypi.org/phpBB3/viewtopic.php?p=136912

2013-Sept-04

Merged in later comments from the original thread (the pv exists check) and added the backup.log