Skip to content

Instantly share code, notes, and snippets.

@pixelbrackets
Created February 11, 2018 13:42
Show Gist options
  • Save pixelbrackets/b95694b67b64e59aa4311be219f0f611 to your computer and use it in GitHub Desktop.
Save pixelbrackets/b95694b67b64e59aa4311be219f0f611 to your computer and use it in GitHub Desktop.
Create/ write images of SD-cards

Create/ write images of SD-cards

Detect SD card

# show SD card - something like /dev/XXXX e.g  /dev/sdb1
df –h
# unmount the card to prevent card access while writing the image 
umount /dev/XXXX

Write image to SD card

# write image 
dd if=/path/to/image.img of=/dev/XXXX 
# …compressed image (gzip) and larger block size (faster) 
gzip -dc /path/to/image.img.gz | dd bs=4M of=/dev/XXXX

Backup

# create new image
dd if=/dev/XXXX of=/path/to/image.img
# …compress on the fly and enlarge block size
dd bs=4M if=/dev/XXXX | gzip > /path/to/image.img.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment