Skip to content

Instantly share code, notes, and snippets.

@dklassen
Last active December 24, 2016 17:38
Show Gist options
  • Save dklassen/47fc6402f279232558e0f1a3f5aabc32 to your computer and use it in GitHub Desktop.
Save dklassen/47fc6402f279232558e0f1a3f5aabc32 to your computer and use it in GitHub Desktop.

Remote Raspberry PI SD Card Backup

From http://unix.stackexchange.com/questions/132797/how-to-dd-a-remote-disk-using-ssh-on-local-machine-and-save-to-a-local-disk

Find the block device id of the SD card you are creating an image from:

pi@pi ~ $ sudo blkid /dev/mmcblk0: PTUUID="a6202af7" PTTYPE="dos" /dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="15CD-3B79" TYPE="vfat" PARTUUID="a6202af7-01" /dev/mmcblk0p2: UUID="13d368bf-6dbf-4751-8ba1-88bed06bef77" TYPE="ext4" PARTUUID="a6202af7-02"

in my case /dev/mmcblk0. Then you can either create the image on the pi or, like below, ssh and transfer it to where you want to save the image:

ssh [email protected] "sudo dd if=/dev/mmcblk0 | gzip -1 -" | dd of=rpi_image.gz

In a separate window monitor with:

sudo pkill -USR1 dd

or via pv (if on a mac will need to brew install pv first):

cat filename | pv

Copying Image to SD Card

see instructions here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment