Skip to content

Instantly share code, notes, and snippets.

@bdtech
Created March 12, 2013 23:43
Show Gist options
  • Save bdtech/5148126 to your computer and use it in GitHub Desktop.
Save bdtech/5148126 to your computer and use it in GitHub Desktop.
Raspberry Pi backup SD card as zipped image
#!/bin/bash
me=`basename $0`
exec 1> /tmp/$me 2>&1
BDIR="/mnt/data/backup"
mv $BDIR/pi-dos.bin.gz $BDIR/pi-dos.bin.gz.1 -f
mv $BDIR/pi-ext4.bin.gz $BDIR/pi-ext4.bin.gz.1 -f
#change /dev/* below if necessary, run blkid to see the mount points
dd if=/dev/mmcblk0p1 | gzip > $BDIR/pi-dos.bin.gz
dd if=/dev/mmcblk0p2 | gzip > $BDIR/pi-ext4.bin.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment