我刚刚格式化了microSD卡,并想运行一个dd
命令。不幸的是,dd
命令失败:
$ sudo dd bs=1m if=2016-02-26-raspbian-jessie-lite.img of=/dev/rdisk2
dd: /dev/rdisk2: Resource busy
$
互联网上的每个人都说我需要先卸载磁盘。当然可以,然后继续前进。但是我想了解为什么/在OS X中到底是什么使设备繁忙?我该如何诊断?
到目前为止,我尝试了:
列出打开的文件:
$ lsof /dev/disk2 $ lsof /dev/disk2s1 $
也:
$ lsof /Volumes/UNTITLED $
列出使用该文件的用户:
$ fuser -u /dev/disk2 /dev/disk2: $ fuser -u /dev/disk2s1 /dev/disk2s1: $
也:
$ fuser -u /Volumes/UNTITLED $
检查系统消息:
$ sudo dmesg | grep disk $
也:
$ sudo dmesg | grep /Volumes/UNTITLED $
我的环境
操作系统:
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_64
关于我的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 disk2s1
PS我正在使用OS X 10.11。
更新22/3/2016。弄清楚了。我使用从头开始重新运行lsof
和,最后找到问题的根源:fuser
sudo
$ sudo fuser /Volumes/UNTITLED/
/Volumes/UNTITLED/: 62 282
$
和:
$ sudo lsof /Volumes/UNTITLED/
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mds 62 root 8r DIR 1,6 32768 2 /Volumes/UNTITLED
mds 62 root 22r DIR 1,6 32768 2 /Volumes/UNTITLED
mds 62 root 23r DIR 1,6 32768 10 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD
mds 62 root 25u REG 1,6 0 999999999 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/journalExclusion
mds_store 282 root txt REG 1,6 3277 17 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexGroups
mds_store 282 root txt REG 1,6 8 23 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexCompactDirectory
mds_store 282 root txt REG 1,6 312 19 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexTermIds
mds_store 282 root txt REG 1,6 3277 29 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexGroups
mds_store 282 root txt REG 1,6 1024 35 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexCompactDirectory
mds_store 282 root txt REG 1,6 312 21 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexPositionTable
mds_store 282 root txt REG 1,6 8192 31 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexTermIds
mds_store 282 root txt REG 1,6 2056 22 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexDirectory
mds_store 282 root txt REG 1,6 8192 33 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexPositionTable
mds_store 282 root txt REG 1,6 8224 34 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexDirectory
mds_store 282 root txt REG 1,6 16 16 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexIds
mds_store 282 root txt REG 1,6 65536 48 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/reverseDirectoryStore
mds_store 282 root txt REG 1,6 704 24 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.indexArrays
mds_store 282 root txt REG 1,6 65536 26 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/0.directoryStoreFile
mds_store 282 root txt REG 1,6 32768 28 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexIds
mds_store 282 root txt REG 1,6 65536 36 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.indexArrays
mds_store 282 root txt REG 1,6 65536 38 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/live.0.directoryStoreFile
mds_store 282 root 5r DIR 1,6 32768 10 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD
mds_store 282 root 17u REG 1,6 8192 12 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/psid.db
mds_store 282 root 32r DIR 1,6 32768 10 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD
mds_store 282 root 41u REG 1,6 28 15 /Volumes/UNTITLED/.Spotlight-V100/Store-V2/A2D41CCB-48CC-45F3-B8D6-F3B383D91AAD/indexState
$
从上面可以很容易地看出,进程已经调用mds
并且mds_store
已经创建并在卷上保存了大量文件。
嗨@RuiFRibeiro!是的,这完全合情合理,我
—
gmile
rdisk
在撰写本文时就忘记了。
设备正忙,因为它已自动安装...; 您将其卸载,执行dd,dd完成后它将再次自动安装。
—
Rui F Ribeiro
@RuiFRibeiro我知道,这很有道理...但是除了看到
—
gmile
/Volumes/UNTITLED
并知道它是自动安装的以外,还有其他指示吗?像是一些日志,还是一些更好的负责获取设备的过程?
@RuiFRibeiro证明当前有2个进程保存已安装的卷。我错过的是运行
—
gmile 16-3-22
lsof
并fuser
具有root特权。使用两者运行后sudo
,我发现进程在卷上调用mds
并mds_store
创建了十几个文件。
of=/dev/rdisk2
它的速度非常快,而且不会对SD卡造成负担。