dd를 실행 중입니다. 왜 자원이 바쁜가?


31

방금 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에서 정확히 무엇을 사용하여 장치를 바쁘게 만드는지 이해하고 싶습니다 . 이것을 어떻게 진단합니까?

지금까지 나는 시도했다 :

  1. 열린 파일 나열 :

    $ lsof /dev/disk2
    $ lsof /dev/disk2s1
    $
    

    또한:

    $ lsof /Volumes/UNTITLED
    $
    
  2. 파일에서 작업하는 사용자 나열 :

    $ fuser -u /dev/disk2
    /dev/disk2: 
    $ fuser -u /dev/disk2s1 
    /dev/disk2s1:
    $
    

    또한:

    $ fuser -u /Volumes/UNTITLED
    $
    
  3. 시스템 메시지를 확인하십시오.

    $ sudo dmesg | grep disk
    $
    

    또한:

    $ sudo dmesg | grep /Volumes/UNTITLED
    $
    

내 환경

  1. 운영 체제 :

    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
    
  2. 내 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
    

추신 : 나는 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있음 을 쉽게 알 수 있습니다 .


사용 of=/dev/rdisk2이 훨씬 더 빨리 그렇게이며, 그래서 당신의 SD 카드에 과세하지.
— Rui F Ribeiro

안녕하세요 @RuiFRibeiro! 그래, 그건 말이 되겠 어 rdisk. 글을 쓸 때 잊어 버렸다 .
— gmile

장치가 자동 마운트되어있어서 사용 중입니다 ...; 마운트를 해제하고 dd를 수행하면 dd가 완료 되 자마자 다시 자동 마운트됩니다.
— Rui F Ribeiro

@RuiFRibeiro 내가 확인의 의미를 알고 ...하지만 다른 표시가 떨어져 보는,이 /Volumes/UNTITLED및 알고 가 자동 마운트이야? 마찬가지로, 대한 책임을 일부 로그, 또는 더 나은 어떤 과정을 복용 장치를?
— gmile

1
@RuiFRibeiro는 현재 마운트 된 볼륨을 보유 하고 있는 2 개의 프로세스가 있음을 나타냅니다 . 내가 놓친 것은 실행했다 lsof및 fuser루트 권한으로. 로 모두 실행 한 후 볼륨에서 수십 개의 파일을 sudo호출 mds하고 mds_store생성 한 프로세스를 파악했습니다 .
— gmile

답변:


49

Apple 법원, Apple 규칙. 시도 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

디스크 이미지의 경우 hdiutil명령이 관심이있을 수 있습니다.에서을 클릭해도 Disk Utility.app됩니다.


안녕 @ thrig, 감사합니다. 예,를 사용하여 마운트를 해제 할 수 diskutil있습니다. 문제가 없습니다. 내가 여기서하고있는 일은 발견 할 수있는 경고에 "예"라고 말하여 시스템의 문제를 식별하는 방법을 배우는 것입니다. "자원 사용량이 많은"이유가 무엇인지, 먼저 제거하는 방법이 아닌 이유를 알고 싶습니다. OS에서 어떤 정확한 프로세스가이 작업을 수행하고 있습니까?
— gmile

내가 아는 한 @gmile 커널은 사용중인 장치를 잠그므로 파티션과 이미지를 마운트 해제하고 꺼내서 해당 커널 잠금을 제거해야합니다.
— thrig

아, 재미 있네요. 커널 잠금을 위해 구글로갑니다. 어쩌면 내가 읽을 수있는 좋은 자료가 있습니까?
— gmile

9

서브 파티션 마운트 해제

/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *8.0 GB     disk2
   1:             Windows_FAT_16 wr_usb_efi              134.2 MB   disk2s1
   2:                      Linux                         1.1 GB     disk2s2
vgsprasad-mbp:~ vgsprasad$ diskutil umount /dev/disk2s1
Volume wr_usb_efi on disk2s1 unmounted
vgsprasad-mbp:~ vgsprasad$ diskutil umount /dev/disk2s2
disk2s2 was already unmounted

3
OP는 포맷 누락 외에도 "인터넷에있는 모든 사람들이 먼저 디스크를 마운트 해제해야한다고 말합니다. 물론 그렇게 할 수 있습니다. 그러나 OS X에서 정확히 무엇을 바쁘게 만드는지 이해하고 싶습니까?" "
— Jeff Schaller

@Jeff gmile과 같은 문제가 발생하여 USB 스틱에 .iso를 쓰려고했지만 dd가 반환했습니다 dd: /dev/disk9: Resource busy. 로 마운트 해제 diskutil umount /dev/disk9s1하면 장치가 데스크탑에서 사라졌지 만 /dev/disk9여전히 마운트되어 있으므로 dd정상적으로 작동하지 못했습니다. 따라서 Mac OSX는 USB 스틱의 내부 파일 시스템에 대한 바로 가기를 생성하여 장비를 사용 중 상태로 유지했습니다.
— 구스타프
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.