I just formatted microSD card, and would like to run a dd command. Unfortunately dd command fails:$ sudo dd bs=1m if=2016-02-26-raspbian-jessie-lite.img of=/dev/rdisk2dd: /dev/rdisk2: Resource busy$Everyone on the internet says I need to unmount the disk first. Sure, can do that and move on. But I want to understand why / what exactly in OS X is making the device busy? How do I diagnose this?So far I tried:Listing open files:$ lsof /dev/disk2$ lsof /dev/disk2s1$Also:$ lsof /Volumes/UNTITLED$Listing users working on the file:$ fuser -u /dev/disk2/dev/disk2: $ fuser -u /dev/disk2s1 /dev/disk2s1:$Also:$ fuser -u /Volumes/UNTITLED$Check for system messages:$ sudo dmesg | grep disk$Also:$ sudo dmesg | grep /Volumes/UNTITLED$My environmentOperating system:Darwin Eugenes-MacBook-Pro-2.local 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64Information about my microSD:diskutil list disk2/dev/disk2 (internal, physical):   #:                       TYPE NAME                    SIZE       IDENTIFIER   0:     FDisk_partition_scheme                        *31.9 GB    disk2   1:                 DOS_FAT_32 UNTITLED                31.9 GB    disk2s1P.S. I'm using OS X 10.11.Update 22/3/2016. Figured it out. I re-ran the lsof and fuser from above using sudo, and finally got to the bottom of the issue:$ sudo fuser /Volumes/UNTITLED//Volumes/UNTITLED/: 62 282$And:$ sudo lsof /Volumes/UNTITLED/COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF      NODE NAMEmds        62 root    8r   DIR    1,6    32768         2 /Volumes/UNTITLEDmds        62 root   22r   DIR    1,6    32768         2 /Volumes/UNTITLEDmds        62 root   23r   DIR    1,6    32768        10 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AADmds        62 root   25u   REG    1,6        0 999999999 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/journalExclusionmds_store 282 root  txt    REG    1,6     3277        17 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexGroupsmds_store 282 root  txt    REG    1,6        8        23 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexCompactDirectorymds_store 282 root  txt    REG    1,6      312        19 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexTermIdsmds_store 282 root  txt    REG    1,6     3277        29 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexGroupsmds_store 282 root  txt    REG    1,6     1024        35 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexCompactDirectorymds_store 282 root  txt    REG    1,6      312        21 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexPositionTablemds_store 282 root  txt    REG    1,6     8192        31 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexTermIdsmds_store 282 root  txt    REG    1,6     2056        22 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexDirectorymds_store 282 root  txt    REG    1,6     8192        33 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexPositionTablemds_store 282 root  txt    REG    1,6     8224        34 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexDirectorymds_store 282 root  txt    REG    1,6       16        16 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexIdsmds_store 282 root  txt    REG    1,6    65536        48 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/reverseDirectoryStoremds_store 282 root  txt    REG    1,6      704        24 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexArraysmds_store 282 root  txt    REG    1,6    65536        26 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.directoryStoreFilemds_store 282 root  txt    REG    1,6    32768        28 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexIdsmds_store 282 root  txt    REG    1,6    65536        36 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexArraysmds_store 282 root  txt    REG    1,6    65536        38 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.directoryStoreFilemds_store 282 root    5r   DIR    1,6    32768        10 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AADmds_store 282 root   17u   REG    1,6     8192        12 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/psid.dbmds_store 282 root   32r   DIR    1,6    32768        10 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AADmds_store 282 root   41u   REG    1,6       28        15 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/indexState$From the above it's easy to see that processes called mds and mds_store have created and are holding lots of files on the volume.
Running dd. Why resource is busy?
osx;dd;sd card;resources
Apple court, Apple rules. Try diskutil:$ diskutil list...# if mounted somewhere$ sudo diskutil unmount $device# all the partitions (there's also a force option, see the manual)$ sudo diskutil unmountDisk $device# remember zip drives? this would launch them. good times!$ sudo diskutil eject $device(In the case of a disk image, the hdiutil command may also be of interest. You can also click around in Disk Utility.app.)