LoginSignup
4
4

More than 1 year has passed since last update.

Linux デバイス - ブロックデバイスとキャラクタデバイス

Posted at

Linux のデバイスには、ブロックデバイスとキャラクタデバイスがあります。

キャラクタデバイス (character device)

ひとつの文字(単位)ごとに処理をするデバイスのことです。

バッファを使いません。
ひとつ前のデータに戻ってアクセスはできません。

  • シリアルポート
  • パラレルポート
  • サウンドカード
  • キーボード
  • マウス
  • モデム
  • 仮想コンソール

ブロックデバイス (block device)

データのまとまりごとに処理をするデバイスのことです。

バッファを使います。
ランダムアクセス可能です。

  • ハードディスク
  • CD-ROM

デバイスの一覧

Linux が認識しているデバイスの一覧は、 cat /proc/devices で出力できます。
キャラクタデバイス、ブロックデバイスが順に表示されます。

[ec2-user@sample ~]$  cat /proc/devices
Character devices:
  1 mem
  4 /dev/vc/0
  4 tty
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
  7 vcs
 10 misc
 13 input
128 ptm
136 pts
202 cpu/msr
203 cpu/cpuid
249 nvme
250 dax
251 hidraw
252 bsg
253 rtc
254 tpm

Block devices:
  9 md
253 device-mapper
254 mdp
259 blkext
4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4