25
Jan

Writing Images to Disk on Mac OSX with dd

1.) Become root:

su

2.) Plug in your SD card, HDD, or other block device 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 ‘dd’ command to copy the image file (.dd or .img generally) to the entire disk:

dd if=myImage.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=myPartitionImage.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 ‘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”.

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:


There's 16 Comments So Far

  • NewToThis
    December 10th, 2010 at 3:21 am

    Hello,

    I’m trying to learn how to do all of this so I can root a Droid product, but I must be missing something here because I can’t get it to write the image. It tells me there is no such file or directory. What am I doing wrong? Help me out please. Thanks.

    sh-3.2# diskutil unmountDisk /dev/disk2
    Unmount of all volumes on disk2 was successful
    sh-3.2# dd if=nooter_sdcard_40mb of=/dev/disk2
    dd: nooter_sdcard_40mb: No such file or directory
    sh-3.2#

  • Derek@TheDailyLinux
    December 10th, 2010 at 8:33 am

    A few things that pop into my head immediately:
    1) What happens when you specify the absolute path of the file? (ie. /path/to/filename OR ./filename)
    2) Do other utilities acknowledge the file? What happens when using ‘ls’, ‘less’, or ‘grep’ on the file?
    3) The only other time I’ve seen that sort of error message is when there is a problem with the utility not being compiled properly (this was in an embedded system running Linux that I was working with, I sorta doubt this is your problem).

  • NewToThis
    December 13th, 2010 at 2:05 am

    Derek,

    Thanks for the response. I’m new to this (hence the username), so I’m not sure what you’re asking me to do. But I will try.

    1) It says, “No such file or directory”. But I checked the name three times, and that is what the name shows both underneath the icon on the desktop and when I click on “Get info” and the info opens up. I don’t understand.

    2) I’m not sure what those things mean, so I can’t answer this. I’m starting from scratch here; trying to figure this all out, and I’m smart enough that I’m sure eventually I can, but I’m in kindergarten at the moment, so to speak.

    3) Well, this is a brand new computer, so I don’t know what problems could exist, but I can’t imagine it ought to have any at this point.

    Thanks for your help. Any further suggestions would be additionally helpful. I’ve read/heard somewhere that this is harder on Mac, so maybe I should load Windows XP on this machine and try it that way. I hadn’t bothered yet, but perhaps it would make things easier? I have heard that Linux is the most straightforward of the three for rooting but I know nothing of Linux at this point so I doubt it would help me to try it on a system I don’t know.

    For now, I’m going to delete the file, download it again and start over, see what happens.

  • NewToThis
    December 13th, 2010 at 1:54 pm

    Hello,

    I’ve done about a million things trying to get this to work but so far, nada. I did the ls */ command and it said Desktop/Nooter.img (I changed the file name to see if that would help. No.). So it sees the file on my desktop but it won’t write the disk. This is really frustrating!

    I’m stuck. Is there some other way to do this step?

  • XXXX
    December 15th, 2010 at 1:10 pm

    Got it working – dd if=/Users/XXXX/Desktop/nooter_sdcard_40mb.img of=/dev/disk1

  • Jaycee
    July 29th, 2011 at 6:01 am

    Articles like these put the consumer in the driver seat-very imptronat.

  • OSD775
    December 18th, 2011 at 11:20 am

    thanks for your help – first result in google that worked.

    Cheers

  • clint
    September 20th, 2012 at 8:47 am

    the problem with the command as given is that “if” and “of” are backwards (OSX 10.6 Snow Lep). that’s why the “no such file” error (from terminal, try “man dd” for the full explanation)

    “if” means “INPUT file”
    “of” means “OUTPUT file”

    you want:

    dd if=/dev/diskN of=/where/you/want/whatever.dd

  • mike
    March 9th, 2013 at 2:37 pm

    It’s the right order of input and output. of=/dev/… is the blank sd card output/target file, if=~/Downloads input/source directory is where most people keep images they downloaded from the internet.

  • Eric
    March 13th, 2013 at 1:04 pm

    Clint, it’s using the image file as the input, and outputs it to the blank media, so the process listed is correct.

Who Linked To This Post?

  1. Nook Rooter - because nooter.com was taken
  2. How To Root Nook Color (Android) | Pathik Shah
  3. The Android Developer forum Blog » How To Root Your B&N NookColor
  4. Play Angry Birds on Nook Color – Play games on Nook Color guide - Everything iCamcorder
  5. Play Angry Birds on Nook Color | Blu-ray Video Tips
  6. raspberry pi will rule your world | museo de metralla

Share your thoughts, leave a comment!