macOS에서 smartctl·lspci·ethtool 대신 무엇을 쓸까

반응형

macOS에는 Linux의 lspciethtool이 기본 제공되지 않고, 두 command의 모든 기능을 대신하는 1:1 command도 없다. 질문을 disk health, hardware inventory, network service, interface link 정보로 나눈 뒤 diskutil, system_profiler, ioreg, networksetup, ifconfig를 조합해야 한다. smartctl은 macOS에서도 smartmontools로 설치할 수 있지만 disk와 adapter가 S.M.A.R.T. data를 노출해야 한다.

먼저 질문별 command를 고른다

확인할 것 macOS에서 먼저 볼 command
disk·volume 식별 diskutil list, diskutil info
S.M.A.R.T. 상태 Disk Utility 또는 smartctl
hardware category별 inventory system_profiler
I/O Registry의 device tree·property ioreg
network service와 hardware port mapping networksetup
interface address·flag·media·link status ifconfig

이 command들은 겹치는 정보가 있어도 자료의 층이 다르다. networksetup의 ‘Wi-Fi’는 사용자가 보는 network service 이름이고, ifconfigen0은 BSD interface 이름이다. 두 이름을 같은 것으로 가정하지 말고 mapping부터 확인한다.

smartctl은 대상 disk를 먼저 찾는다

Homebrew가 이미 설치돼 있다면 smartmontools formula로 smartctl을 설치할 수 있다.

brew install smartmontools

Homebrew 자체가 없다면 blog의 curl | bash 한 줄을 그대로 실행하도록 안내하기보다 Homebrew 공식 설치 페이지에서 현재 요구사항과 script를 확인한다.

/dev/disk0을 모든 Mac의 첫 disk라고 고정하지 않는다. 먼저 disk를 식별한다.

diskutil list
diskutil info /dev/diskX
sudo smartctl --scan-open
sudo smartctl -a /dev/diskX

diskX는 실제 결과로 바꾼다. --scan-open 결과가 없거나 -a가 모든 attribute를 보여 주지 않는다고 바로 disk 고장으로 결론 내리면 안 된다.

  • Apple internal SSD가 일반 SATA drive와 같은 attribute를 노출하지 않을 수 있다.
  • USB enclosure나 bridge가 S.M.A.R.T. command를 전달하지 않을 수 있다.
  • 일부 bridge는 device type option이 필요하지만 model을 확인하지 않고 -d sat를 붙이면 안 된다.
  • S.M.A.R.T.가 정상이어도 모든 고장을 예측한다는 보장은 없다.

GUI에서는 Disk Utility에서 많은 disk의 S.M.A.R.T. 상태를 볼 수 있다. fatal hardware error가 표시되면 repair command 반복보다 backup과 service를 우선한다.

lspci 대신 system_profiler와 ioreg

lspci는 PCI configuration space를 중심으로 보여 주는 Linux utility다. system_profiler SPPCIDataType은 이름이 비슷하지만 동일한 interface가 아니며, 특히 Apple Silicon의 integrated device는 기대한 PCI 목록에 나타나지 않을 수 있다.

지원되는 data type부터 확인한다.

system_profiler -listDataTypes

필요한 category만 요청하면 전체 report보다 빠르고 공유할 정보도 줄일 수 있다.

system_profiler SPHardwareDataType
system_profiler SPPCIDataType
system_profiler SPNVMeDataType
system_profiler SPUSBHostDataType
system_profiler SPThunderboltDataType

SPPCIDataType이 비어 있다고 hardware가 없다는 뜻은 아니다. Apple Silicon, USB, Thunderbolt, NVMe처럼 실제 연결 경로에 맞는 category를 본다. 더 낮은 수준의 I/O Registry를 탐색할 때는 ioreg를 쓸 수 있다.

ioreg -p IODeviceTree -l

ioreglspci -vv의 완전한 대체는 아니다. I/O Kit registry의 service와 property를 보여 주는 도구다. 전체 출력에는 serial number와 device 식별자가 포함될 수 있으므로 그대로 공개 글이나 issue에 붙이지 않는다.

ethtool 대신 interface 질문을 나눈다

먼저 hardware port와 BSD interface를 mapping한다.

networksetup -listallhardwareports

그다음 service 설정과 interface 상태를 따로 본다.

networksetup -getinfo "Wi-Fi"
ifconfig enX

"Wi-Fi"는 service 이름이고 enX는 앞 command에서 확인한 실제 interface로 바꾼다. Ethernet interface라면 ifconfig 출력의 mediastatus에서 negotiated media와 link state를 확인할 수 있다. Wi-Fi radio와 connection detail은 다음 category도 참고할 수 있다.

system_profiler SPAirPortDataType
system_profiler SPNetworkDataType

Linux ethtool이 제공하는 driver register, offload flag, ring parameter까지 위 command들이 모두 제공하는 것은 아니다. vendor driver와 Network Extension, packet capture, Instruments 등 별도 도구가 필요할 수 있다. ‘ethtool 대체 command 하나’를 찾기보다 필요한 질문을 좁힌다.

안전하게 공유하는 순서

  1. -listDataTypes, -listallhardwareports로 대상 category와 interface를 식별한다.
  2. 전체 report 대신 필요한 data type이나 interface 하나만 조회한다.
  3. serial number, MAC address, IP, SSID·BSSID를 가린다.
  4. 상태 조회와 설정 변경 command를 구분한다.
  5. disk hardware error라면 write test보다 backup을 먼저 한다.

Mac hardware report 전반은 macOS 하드웨어 정보 확인, memory command는 macOS에서 free 대신 memory 확인하기에서 이어서 볼 수 있다.

참고 자료

반응형
KEEP READING
카테고리 전체 보기 →

댓글