Skip to content

Instantly share code, notes, and snippets.

@fuji246
Created September 6, 2019 23:56
Show Gist options
  • Save fuji246/74fda8b6da39a76bca0b784c211b36b0 to your computer and use it in GitHub Desktop.
Save fuji246/74fda8b6da39a76bca0b784c211b36b0 to your computer and use it in GitHub Desktop.
backup raspberry pi image

on OSX:

  1. backup whole disk
# check micro sd card disk

$ diskutil list

# copy whole disk, /dev/disk2 is the sd card devcie, the size is 16G

$ sudo dd if=/dev/disk2 bs=4m | pv -s 16G | sudo dd of=pi.img bs=4m
  1. shrink the image
# download https://github.com/thhan/Docker-PiShrink, and copy pi.img to Docker-PiShrink

$ ./docker.sh 

# inside docker container

$ pishrink pi.img
$ gzip -9 pi.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment