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

Category : 工作学习 / Tags : , / Date : 2009.03.10 / /

  设备文件分为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



无觅相关文章插件,快速提升流量

Comments

There are no comments.

Leave a Reply

You must be logged in to post a comment.

传奇 似水流年 绽放 风筝 八月照相馆