Skip to content

Instantly share code, notes, and snippets.

@ScottJWalter
Last active April 7, 2025 02:36
Show Gist options
  • Save ScottJWalter/3cfb278e2b3c4d1c9dbdf8322a2782f9 to your computer and use it in GitHub Desktop.
Save ScottJWalter/3cfb278e2b3c4d1c9dbdf8322a2782f9 to your computer and use it in GitHub Desktop.
Copy a linux (lfs) sd card
#!/bin/sh
# Identify /dev/??? device of card
sudo fdisk -l
# if mounted (boot), must unmount
sudo umount /dev/????
# create image ...
sudo dd if=/dev/???? of=./sd_card.img bs=4M status=progress && sync
# ... and wait ... this gonna take time.
# to create new card, reverse the stream ...
sudo dd of=/dev/???? if=./sd_card.img bs=4M status=progress && sync
# ... and wait even more (this time it's longer).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment