💾 Writing .img images on SD-card

25 Jul 2015

When i need to write an image on a sd-card, lately i choose pv instead dd in linux. Why? There is no need to bother with switches to achieve maximum writing speed of the sd-card and have progress bar, so i can know how much is left to finish.

PV method: On most distros it is not installed by default, so you have to do it:

sudo apt-get install pv

Then you can write images with the following:

pv < /path-to/image-file.img > /dev/sdc

*** be sure to modify the /dev/sdc path at the end to your sd-card’s path DD method: There is no need to install, it’s integrated on almost every linux distro.

Same command as above but with dd looks like:

dd bs=4M if=/path-to/image-file.img of=/dev/sdc

*** be sure to modify the /dev/sdc path at the end to your sd-card’s path

You can adjust the “speed” of writing with the bs=4M option, where lets say the 4M is the rating of your sd-card. So for example i have a Sandisk Ultra-something 16GB Class 10 sd-card and i’m using 10M as option. Roughly… More like 8M was stable if i remember good ;)