Bash script to clone (read & write) an SD card


If you’re imaging an SD card and writing the image to a different SD card, the cards have to be identical in terms of design and size for this to work properly. In other words, if your reading from a card that is a SanDisk 16 gig card, you need to write/restore to a 16 gig SanDisk card. Different brands vary in terms of their architectures.

Works on a Mac, but takes forever

While this script will run on a Mac, my experience is that it takes forever to read or write a 16G SD card – anywhere from 3 hours to 6 hours. Contrary to some posts I’ve found around the web, there is not edit for this sort of script that will make it run significantly faster on a Mac (some folks swear that there’s a method which works, but, it didn’t work for me). I’ve test this, numerous times and found that on a Mac a 16 gig SD card will take about fours to write, versus about and hour-and-twenty minutes on Linux.

Recommended: Debian based Linux

I would recommend running this script of some variant of Debian (Ubuntu, Mint, etc.); the “function pause” part of the script, as I recall, does not work on Redhat-based Linux distros.

..and it’s still not very fast!

Yesterday I wrote an image to a 16 gig SD card, running this on Linux Mint, and it took exactly one-hour and twenty minutes – about 4 to 6 times faster than on a Mac, but not super fast.

Linux - General

Leave a Reply

Your email address will not be published. Required fields are marked *