Linux┊字符设备和块设备的区别?

Doubi Gao3 posted @ 2014年4月29日 21:11 in Linux with tags ubuntu , 782 阅读

      今天学了下Linux下文件的备份,如dump命令,然后在/dev里面查看文件时发现了有些文件的标识是b与c,不是通常的d,然后去网上找了找资料,就放这了吧。laugh

      设备文件分为Block Device Driver和Character Device Drive两类。Character Device Drive又被称为字符设备或裸设备raw devices; Block Device Driver通常成为块设备。而Block Device Driver是以固定大小长度来传送转移资料 ;Character Device Driver是以不定长度的字元传送资料 。且所连接的Devices也有所不同,Block Device大致是可以随机存取(Random Access)资料的设备,如硬碟机或光碟机;而Character Device刚好相反,依循先後顺序存取资料的设备,如印表机 、终端机等皆是。

  /dev/dsk对应的为块设备,文件系统的操作用到它,如mount。/dev/rdsk对应的为字符设备(裸设备,rdsk的r即为raw),fsck newfs等会涉及到。一般我们的操作系统和各种软件都是以块方式读写硬盘,这里的块是逻辑块,创建文件系统时可以选择,windows里叫簇。可看newfs or mkfs的manual。oracle是比较常见的字符方式读写硬盘。

  Character Device Files

  The file type “c” identifies character device files. For disk devices,character device files call for I/O operations based on the disks smallest addressable unit, or sectors. Each sector is 512 bytes in size.

  Block Device Files

  The file type “b” identifies block device files. For disk devices, block device files call for I/O operations based on a defined block size. The block size depends on the particular device, but for UFS file systems,the default block size is 8 Kbytes.

转载自:http://www.360doc.com/content/11/0420/14/1317564_111004478.shtml


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter