📅 2013-Jun-21 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ dd, disk image, linux, ubuntu, umount ⬩ 📚 Archive
You may sometimes need to write a disk image to a USB thumbdrive or a SD card. This is typically done to create a system that you can use to boot a device. The image file typically has the .img
file extension, though its not necessary and does not matter. Writing the disk image can be easily done on Ubuntu or any other Linux distribution.
Insert the USB thumbdrive or SD or microSD card to your computer. It should be detected and Ubuntu might mount it automatically. If it does not, that is okay as long as it is detected.
We need to find out what is the device file which represents the inserted USB thumbdrive or SD card as described here.
Before we write the disk image, we need to unmount the device. This can be done by passing the device name to the umount
command:
$ umount /dev/sdb
dd
command. Provide the disk image file as the input file and the device file as the output file with a suitable block size:$ sudo dd if=/blah/foo.img of=/dev/sdb bs=1M
$ sync
That is it! The disk image is written and you can take out your USB thumbdrive or SD card to use it.
Related: How to write a disk image on Windows using Win32 Disk Imager
Tried with: Ubuntu 12.04