35

I've downloaded Raspbian wheezy from the Raspberry Pi downloads page and following the RPi Easy SD Card Setup wiki page.

I formatted the SD card, and cded into the folder containing the Raspbian img file, but when I run sudo dd if=2013-07-26-wheezy-raspbian.img of=/dev/disk2s1 bs=1m, this is the output I get:

dd: /dev/disk2s1: Resource busy 

I tried it again with /dev/disk2 as the output file, but get the same error. I'm not sure what I'm doing wrong/why the img isn't being copied over.

This is the (relevant) output of $ diskutil list:

/dev/disk2 #: TYPE NAME SIZE IDENTIFIER 0: FDisk_partition_scheme *32.5 GB disk2 1: Windows_FAT_32 YQFORKLIFT 32.5 GB disk2s1 

As well as $ df -h:

ysim:~$ df -h Filesystem Size Used Avail Capacity Mounted on ... /dev/disk2s1 30Gi 1.7Mi 30Gi 1% /Volumes/YQFORKLIFT 

And this is what I see under System Profiler -> Card Reader:

Built in SD Card Reader: Vendor ID: 0x05ac Product ID: 0x8403 Revision: 1.00 Serial Number: 000000009833 SDHC Card: Capacity: 32.48 GB (32,479,641,600 bytes) Removable Media: Yes BSD Name: disk2 Partition Map Type: MBR (Master Boot Record) S.M.A.R.T. status: Not Supported Volumes: YQFORKLIFT: Available: 32.47 GB (32,465,321,984 bytes) Capacity: 32.48 GB (32,475,447,296 bytes) Writable: Yes File System: MS-DOS FAT32 BSD Name: disk2s1 Mount Point: /Volumes/YQFORKLIFT 
1
  • this should be tagged with OSX or similar Commented Feb 21, 2015 at 10:17

1 Answer 1

52

I found my answer in the very next section of the wiki; silly me. I found that the solution didn't go much into detail about what kind or error messages you see though, and thought it might be helpful to have the exact error message "googleable". I also found the instructions slightly unclear (especially around step 8/9; I wasn't sure if the partition had to be left unmounted), so I tried to rephrase some of it:

[this assumes that your SD card has been formatted already]

  1. Run df -h to locate the SD card's partition, which will be in the pattern /dev/diskns1, where n is an integer. In this case, it's /dev/disk2s1 (the other two are external USB hard drives). And yeah, I know I gave it a weird name...

     $ df -h Filesystem Size Used Avail Capacity Mounted on /dev/disk0s2 233Gi 125Gi 108Gi 54% / devfs 114Ki 114Ki 0Bi 100% /dev map -hosts 0Bi 0Bi 0Bi 100% /net map auto_home 0Bi 0Bi 0Bi 100% /home /dev/disk1s1 466Gi 351Gi 115Gi 76% /Volumes/Elements /dev/disk3s1 466Gi 276Gi 189Gi 60% /Volumes/Elements 1 /dev/disk2s1 30Gi 1.7Mi 30Gi 1% /Volumes/YQFORKLIFT 
  2. Unmount the partition:

     $ sudo diskutil unmount /dev/disk2s1 Volume YQFORKLIFT on disk2s1 unmounted 
  3. Check that it's been unmounted/it no longer shows up when you run df -h (otherwise that's what causes the Resource busy error above - see here).

     $ df -h Filesystem Size Used Avail Capacity Mounted on /dev/disk0s2 233Gi 125Gi 108Gi 54% / devfs 114Ki 114Ki 0Bi 100% /dev map -hosts 0Bi 0Bi 0Bi 100% /net map auto_home 0Bi 0Bi 0Bi 100% /home /dev/disk1s1 466Gi 351Gi 115Gi 76% /Volumes/Elements /dev/disk3s1 466Gi 276Gi 189Gi 60% /Volumes/Elements 1 
  4. While it's still unmounted, run sudo dd bs=1m if=/path/to/extracted/raspberry-pi-img.img of=/dev/rdiskn, replacing n with the N in /dev/diskNs1 from step 1. Make sure to write to /dev/rdiskN (the disk) and NOT /dev/diskNs1 (the partition), which is something else that causes the Resource busy error.

     $ sudo dd bs=1m if=2013-07-26-wheezy-raspbian.img of=/dev/rdisk2 1850+0 records in 1850+0 records out 1939865600 bytes transferred in 151.663501 secs (12790590 bytes/sec) 
  5. The SD card is now re-mounted and named boot!

     $ df -h Filesystem Size Used Avail Capacity Mounted on /dev/disk0s2 233Gi 125Gi 108Gi 54% / devfs 115Ki 115Ki 0Bi 100% /dev map -hosts 0Bi 0Bi 0Bi 100% /net map auto_home 0Bi 0Bi 0Bi 100% /home /dev/disk1s1 466Gi 351Gi 115Gi 76% /Volumes/Elements /dev/disk3s1 466Gi 276Gi 189Gi 60% /Volumes/Elements 1 /dev/disk2s1 56Mi 18Mi 37Mi 34% /Volumes/boot 
4
  • 4
    Super helpful thanks. I had to use sudo diskutil unmountDisk /dev/disk2 instead (which is in fact the only step I needed to take to re-run the dd command) Commented Apr 17, 2014 at 16:51
  • I just unmounted the volume and then used the ddrescue / dd directly on the disk, and it worked just fine. I don't think the other steps, are really necessary. Commented Apr 24, 2017 at 15:55
  • Could you explain why it says /dev/rdisk2 instead of /dev/disk2? Where does the r come from? Commented Oct 18, 2019 at 7:51
  • @oschlueter it is way faster to use the raw disks. See superuser.com/a/631601 Commented Jan 23, 2020 at 20:34

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.