Contact us |
Lab 8 - Understanding DevicesTable of contents:Objectives After completing this lab, you will be able to - Identify the various device types in Linux - Distinguish between major and minor devices numbers - Create devices - Mount and un-mount devices as needed - Use and configure the mtools package Estimated time to complete this lab: 30 minutes Block and Character Devices Under UNIX, every piece of hardware is a file. Hardware devices can generally be categorized into random access devices like disk and tape drives, and serial devices like mouse devices, sound cards, and terminals. Random access devices are usually accessed in large contiguous blocks of data that are stored persistently. They are read from in discrete units (for most disks, 1024 bytes at a time). These are known as block devices. Serial devices, on the other hand, are accessed one byte at a time. Data can be read or written only once. For example, after a byte has been read from your mouse, the same byte cannot be read by some other program. Serial devices are called character devices and are indicated by the letter “c”. Your /dev/dsp (Digital Signal Processor--that is, your sound card) device is also another example of a character type device. Major and Minor Device Numbers Devices are divided into sets called major device numbers. For instance, all IDE disks have major number 3. Further, each individual device has a minor device number like /dev/hda, which has minor device number 0. Major and minor device numbers identify the device to the kernel. The file name of the device is arbitrary and is chosen for convenience and consistency. Common Device Names A list of common devices and their descriptions follows. The major numbers are shown in parentheses. The complete reference for devices is in a file called "devices.txt" (usually located in “ /usr/share/doc/MAKEDEV-3.3/devices.txt”. /dev/hd?? hd stands for hard disk, but refers here only to IDE devices--that is, common hard disks. The first letter after the hd dictates the physical disk drive: /dev/hda (3) First drive, or primary master. /dev/hdb (3) Second drive, or primary slave /dev/sd?? (8) sd stands for SCSI disk, the high-end drives mostly used by servers. sda is the first physical disk probed, and so on. For example /dev/sda1 is the first partition on the first drive. /dev/ttyS? (4) These are serial devices numbered from 0 up. /dev/ttyS0 is your first serial port (COM1 under MS-DOS or Windows). If you have a multi-port card, these can go to 32, 64, and up.
|
Login... |