Code Monkey home page Code Monkey logo

bkuprpimage's Introduction

bkup_rpimage

Script to backup a Raspberry Pi disk image

Author / Origin:

Script developed on the RaspberryPi.org forums: The Raspberry Pi Backup Thread. The script, as copied over to github.com, was primarily written by user: jinx. I found this via a raspberrypi.stackexchange.com answer by user: ppumpkin.

The script was taken from here, a post from Mon Nov 10, 2014 7:05 am. I copied the attached file on Wed Feb 01, 2017 to this git repository.

Usage from Jinx and corrected the mistake of using rsync instead of start in the examples

bkup_rpimage.sh v1.0 by jinx

Usage:

  • bkup_rpimage.sh start [-cslzdf] [-L logfile] sdimage
  • bkup_rpimage.sh mount [-c] sdimage [mountdir]
  • bkup_rpimage.sh umount sdimage [mountdir]
  • bkup_rpimage.sh gzip [-df] sdimage

Commands:

  • start - starts complete backup of RPi's SD Card to 'sdimage'
  • mount - mounts the 'sdimage' to 'mountdir' (default: /mnt/'sdimage'/)
  • umount - unmounts the 'sdimage' from 'mountdir'
  • gzip - compresses the 'sdimage' to 'sdimage'.gz

Options:

  • -c creates the SD Image if it does not exist
  • -l writes rsync log to 'sdimage'-YYYYmmddHHMMSS.log
  • -z compresses the SD Image (after backup) to 'sdimage'.gz
  • -d deletes the SD Image after successful compression
  • -f forces overwrite of 'sdimage'.gz if it exists
  • -L logfile writes rsync log to 'logfile'
  • -s define the size of the image file

Examples:

Start backup to rpi_backup.img, creating it if it does not exist:

bkup_rpimage.sh start -c /path/to/rpi_backup.img

Start backup to rpi_backup.img, creating it if it does not exist limiting the size to 8000Mb

bkup_rpimage.sh start -s 8000 -c /path/to/rpi_backup.img

Use the RPi's hostname as the SD Image filename:

bkup_rpimage.sh start /path/to/$(uname -n).img

Use the RPi's hostname and today's date as the SD Image filename, creating it if it does not exist, and compressing it after backup:

bkup_rpimage.sh start -cz /path/to/$(uname -n)-$(date +%Y-%m-%d).img

Mount the RPi's SD Image in /mnt/rpi_image:

bkup_rpimage.sh mount /path/to/$(uname -n).img /mnt/rpi_image

Unmount the SD Image from default mountdir (/mnt/raspi-2014-11-10.img/):

bkup_rpimage.sh umount /path/to/raspi-2014-11-10.img

bkuprpimage's People

Contributors

jamesbrindle avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.