Datasheet

10
Part 1: Starting Out with Ubuntu
The Linux system identifies hardware devices as special files, called device files. There
are three classifications of device files:
Character
Block
Network
Character device les are for devices that can handle data only one character at a time.
Most types of modems and terminals are created as character files. Block files are for
devices that can handle data in large blocks at a time, such as disk drives.
The networkle types are used for devices that use packets to send and receive data. These
devices include network cards and a special loopback mechanism that allows the Linux
system to communicate with itself using common network programming protocols.
Linux creates special files, called nodes, for each device on the system. All communication
with the device is performed through the device node. Each node has a unique number
pair that identifies it to the Linux kernel. The number pair includes a major and a minor
device number. Similar devices are grouped into the same major device number. The
minor device number is used to identify a specific device within the major device group.
This is an example of device files on a Linux server:
test@testbox~$ ls -al sda*
brw-rw---- 1 root disk 8, 0 2008-05-07 11:42 /dev/sda
brw-rw---- 1 root disk 8, 1 2008-05-07 11:42 /dev/sda1
brw-rw---- 1 root disk 8, 2 2008-05-07 11:42 /dev/sda2
brw-rw---- 1 root disk 8, 5 2008-05-07 11:42 /dev/sda5
test@testbox~$ ls -al ttyS*
crw-rw---- 1 root dialout 4, 64 2008-05-07 11:42 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 2008-05-07 11:42 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 2008-05-07 11:42 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 2008-05-07 11:42 /dev/ttyS3
test@testbox~$
The sda device is therst SCSI hard drive, and the ttyS devices are the standard IBM-PC
COM ports. The list shows all of the
sda devices that were created on the sample Ubuntu
system. Similarly, the list shows all of the
ttyS devices created.
The fth column is the major device node number. Notice that all of the
sda devices have
the same major device node, 8, while all of the
ttyS devices use 4. The sixth column is
the minor device node number. Each device within a major number has a unique minor
device node number.
The rst column indicates the permissions for the device le. The first character of the per-
missions indicates the type of file. Notice that the SCSI hard drive les are all marked as
block (b) device, while the COM port device files are marked as character (c) devices.
Filesystem Management
Unlike some other operating systems, the Linux kernel can support different types of file-
systems to read and write data to hard drives. Besides having over a dozen lesystems of
its own, Linux can read and write tolesystems used by other operating systems, such as
Microsoft Windows. The kernel must be compiled with support for all types of filesystems
that the system will use. Table 1-1 lists the standard filesystems that a Linux system can
use to read and write data.
95080c01.indd 10 3/5/09 12:15:37 AM