How to Write an SD Card Image (Linux, Windows, Mac OSX)


The question “How do I write a TS Image to an SD card under Linux / Mac OSX / Windows?” comes up quite a bit when dealing with embedded systems or any situation where you want to make an exact, bit-by-bit copy of a removable storage card or disk. While the following guide talks about our products, it can be applied generically. Read through it first to make sure you have a basic, core understanding of the instructions given, and then apply them to your situation. We’ll be looking at how to write to an entire disk and/or a specific partition on that disk using the dd command, a common utility found in most unix systems for low-level operations on hard disks. Jokingly, ‘dd’ stands for “disk destroyer” or “delete data”, so take care!      Home

If you are working with a Technologic Systems‘ product, please be sure to also see the product manual for specific instructions for that device.


1.) The following commands will need to be executed as root. It’s popular to prefix the commands with ‘sudo’, but you can also become root by using the command (may vary depending on distribution) for Super User which will look for a [set] password entry:


2.) Plug in your SD card and then use the following command to see which /dev/ node it’s located on (be sure of this!):

fdisk -l

3.) Unmount the disk (using /dev/sda as example, verify with step 2):

umount /dev/sda*

4.) Use the dd command to copy the image file (ts-image.dd) to the entire disk:

dd if=ts-image.dd of=/dev/sda bs=1M conv=fsync

Note, bs=1M is telling dd to write 1 Mb block sizes at a time (faster write speeds this way) and conv=fsync is telling dd to flush data to the disk after every write.

As an example, say you have a separate kernel partition, you can write the image to the specific partition number:    Home

dd if=ts-kernel.dd of=/dev/sda1 bs=1M conv=fsync


1.) Become root(Super User):


2.) Plug in your SD card and then use the following command to see which /dev/diskN node it’s located on:

diskutil list

3.) Unmount the disk where “N” is the number of the disk taken from the above command:

diskutil unmountDisk /dev/diskN

If the above command was successful, you will see:

Unmount of all volumes on diskN was successful

4.) Use the ddcommand to copy the image file (ts-image.dd) to the entire disk:

dd if=ts-image.dd of=/dev/diskN

Also, you can write the image to particular partitions of the disk with (N is the disk number and P is the partition number):

dd if=ts-kernel.dd of=/dev/diskNsP

The process to do this under Linux is very similar except that it’s not required to un-mount the drive before using the ddcommand and the commands are a little different. For example, you would use fdisk -linstead of diskutil list, your device node would be located at /dev/sda instead of /dev/disk and the un-mount command is umountinstead of diskutil unmountDisk.    Home


With Windows, you’ll need to search out some third party utilities to help. For example, here are some we’ve seen which work well:


You could also use a Linux virtual machine. VirtualBox is a nice, user friendly virtualization program and you can find ready-to-run Linux distributions easily online, such as Ubuntu on     Home

Author: Derek Hildreth

eBusiness Manager for Technologic Systems