character device, block device , raw device?

character device, block device , raw device?

Post by somez7 » Thu, 13 Dec 2001 08:26:04

HI, all.
    could someone explain me.

        character device
        block device
        raw device

    I'm very confusing these concepts. could someone explain me clearly.

    when can I use those?

thank you for your time.


character device, block device , raw device?

Post by Lew Pitch » Wed, 12 Dec 2001 22:00:28

Quote:>HI, all.
>    could someone explain me.

The usual definitions are something like...

Quote:>        character device

 - accepts single characters, one at a time.
 - data cannot be random accessed
 - Examples: video terminal,

Quote:>        block device

 - accepts blocks of data,
 - usually, cannot accept data smaller than a block
 - data usually can be random accessed
 - Examples: hard disk

Quote:>        raw device

 - accepts data without editing or caching
 - bypasses kernel buffering
 - can be either a character or block device


>    I'm very confusing these concepts. could someone explain me clearly.

>    when can I use those?

Raw is good for hardware throughput, but not for process throughput
(the process has to perform whatever buffering and/or editing is
necessary on the data, rather than leaving that up to the kernel).
You would likely implement user-defined filesystems (such as
databases) with a raw device

Block is good for hardware that works in blocks (primarily disk

Character is for most everything else.

Quote:>thank you for your time.

Lew Pitcher, Information Technology Consultant, Toronto Dominion Bank Financial Group

(Opinions expressed are my own, not my employer's.)


1. How relative do raw device bind block device on linux ?

I tested  block i/o speed. when i tested file i/o speed,
i/o speed was 17mb/sec.
At this point file size was 3.1Gb, and command was "time dd
if=/linux_tag/linux.dd of=/linux_tag/linux_file.dd bs=8192k".
but when i tested block i/o speed, i/o speed was about 3mb/sec.
command was "time dd if=/dev/sdd1 of=/linux_tag/linux1.dd bs=8192k"

last i binded block device to raw device. and i test raw device i/o
command was "time dd if=/dev/raw/raw1 of=/linux_tag/linux_raw.dd
i/o speed was about 10Mb/sec.

why i/o speed was different between block device and raw device?

Please anyone explain to me!!!!!

Thank U.

2. PPC 7200 speed on Linux

3. programming environment

4. Help: character device vs. block device

5. Concatenating two contiguous ufs partitions?

6. ** Raw character device vs. Block in AP/SCO **

7. isakmpd.conf multiple tunnels

8. Cannot open master raw device '/dev/rawctl' (No such device)

9. large hdd for cooked device and raw device

10. need device: devices.pci.b7100010:devices.pci.b7100092

11. /proc/devices for block devices