Skip to content

Instantly share code, notes, and snippets.

@matheusportela
Created June 21, 2018 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matheusportela/d0fbf2df20d6d4d873e035143df14998 to your computer and use it in GitHub Desktop.
Save matheusportela/d0fbf2df20d6d4d873e035143df14998 to your computer and use it in GitHub Desktop.

Backup

diskutil list # Find out your Raspberry Pi drive
diskutil unmountDisk /dev/disk2 # Unmount disk
sudo dd if=/dev/disk2 of=raspberry_pi_backup.img # Create backup image
gzip -c raspberry_pi_backup.img > raspberry_pi_backup.img.gz # Compress image

Restore

gzip -k -d raspberry_pi_backup.img.gz # Uncompress image
diskutil list # Find out your Raspberry Pi drive
diskutil unmountDisk /dev/disk2 # Unmount disk
sudo dd if=raspberry_pi_backup.img of=/dev/disk2 # Restore from backup image. CAUTION: BE SURE TO WRITE TO THE CORRECT DRIVE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment