How to copy img file to sd card

by 21:18 0 comments
Many people need to copy img files to sd card or flash usb for lot of reasons

You should know the known way to copy (that using cp command in unix) is not solution, uploading image to sdcard is like moving it byte per byte.

okay windows users can find programs like fedora arm installer or disk image writer to use it.

Here we will describe how use linux terminal for linux users

First step, we need to identify the device name for the SD Card Reader in your host machine.

This can be done by using df -h command before and after inserting the SD Card

Note that sometimes,ubuntu fails to detect the SD card.

As in Previous screenshot you can see it is on sdb2, yours can be different.

Next we should unmount the device (all the device sdb not just the partition sdb2)
 use this command
$ sudo umount /dev/sdb
 
Next, we will need to dump the image file to the SD Card
Assume image file is ~/my-image.img
 $ sudo dd bs=4M if=~/my-image.img of=/dev/sdb

Note: If your image has the extension xz use the following command
$ xzcat ~/my-image.img.xz | sudo dd of=/dev/sdb bs=4M
 

Be careful, this may corrupt your whole hard disk if you wrote wrong command.

Good luck.

Ammar Atef

Blog Creator

Always work and you will be happy, Writing code, designing system and learning some thing new, I call that real life, No matter what is the problem, humanity can solve it any way, Creative one who believes he is creative, Who really watch, think, try and success, World is watching us because we are engineers.

0 comments:

Post a Comment