하드디스크의 타입/모델등을 어떻게 알아오죠?

sbkim98의 이미지

페도라 6 입니다. 설치된 하드 디스크의 타입(IDE/SCSI 등등)과 설치된 디스크의 모델정도등을 알아올수 있는 방법이 어떻게 되나요? 리눅스 명령어가 아니라 프로그램 소스차원에서 도움이 될만한 자료가 있을까 해서요....
또한 데비안과 페도라가 다른 코드로 작성이 되어야 하나요? 그건 절대 아닌거 같은데요..

litdream의 이미지

제가 잘은 모르지만, block device 가 controller 에 의해서 abstracted 되어서 알아낼수 있는지 잘 모르겠네요?
dmesg 로 ata 나 ide 타입정도는 볼수 있을지 모르겠지만, 그 밑으로 내려갈수 있을까요?

삽질의 대마왕...

삽질의 대마왕...

Necromancer의 이미지

hdparm 소스를 보십시오.

장치정보를 긁는 데는 ioctl() 시스템콜을 많이 쓰는데,
이건 긁어오는 장치 정보마다 인수도 다르고 문서화도 잘 안되어 있습니다.
주고받는 인수가 장치마다 다 제각각이라는거죠.

Written By the Black Knight of Destruction

Written By the Black Knight of Destruction

ganadist의 이미지

다음 몇가지 방법이 있습니다.
1. ioctl명령어로 얻어오기.
네크로멘서님께서 말씀하셨다시피 hdparm소스를 참조하시면 될 것 같습니다.
2. sysfs와 procfs에서 얻어오기
ide장치의 정보는 /proc/ide/hd?/ 디렉토리에 있는 파일을 읽으면 어느정도 얻을 수 있습니다.
scsi장치의 정보는 /sys/block/sd?/device/ 디렉토리에 있는 파일을 읽으면 됩니다.
3. hal데몬에게서 얻어오기
최근 리눅스 배포판에는 대부분 hal데몬이 설치되어 있을 것입니다. hal데몬에게 쿼리하는 프로그램을 만들어서 얻으면 될겁니다.
dbus api만 조금 익혀두면 금방 만들 수 있을 것입니다.

----
데스크탑 프로그래머를 꿈꾸는 임베디드 삽질러

sbkim98의 이미지

대단히 감사 합니다.
참고 후 잘 안되면 다시 도움을 요청 하겠습니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.