Technologic Systems Logo A US Company  
Search Icon
Customer Area | Contact Us |Cart Icon
  16525 East Laser Drive
Fountain Hills, AZ 85268
Phone (480) 837-5200

Home > Blog > Tutorials and Guides > How to Write an SD Card Image (Linux, Windows, Mac OSX)

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

arrow

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!

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

Linux

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):

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!):

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

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

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:

Mac OSX

1.) Become root:

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

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

If the above command was successful, you will see:

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

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

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

Windows

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:

  • https://sourceforge.net/projects/win32diskimager/
  • http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
  • http://unetbootin.github.io/

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 VirtualBoxes.org.

Similar Posts



Posted July 13, 2016 by Derek Hildreth
Tutorials and Guides

Leave a Reply

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