Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

11
Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition

Transcript of Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

Page 1: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

Chapter 2 (Cont.)

The Unix Way

Essential System Administration,

3rd Edition

Page 2: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

2

• Unix organizes all user-accessible files into a single hierarchical directory structure.

• On most Unix systems, disks are divided into one or more fixed-size partitions.

• The disk partition containing the root filesystem is called the root partition and sometimes the root disk.

• The root filesystem is the first one mounted, early in the Unix boot process.

• The remaining ones are mounted afterwards.

2.3.1 An In-Depth Device Example: Disks

Page 3: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

3

• On many operating systems, mounting is making the device's contents available.

• For Unix, it means mapping pathnames to the correct physical device and data blocks.

• Disk partitions may be accessed in two modes:

Block mode and Raw (or character) mode.

• Different special files are used from each mode.

2.3.1 Disks (Cont.)

Page 4: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

• Hardware devices can generally be categorized into:

Random access devices/Block Devices (like disk and tape drives)

Serial devices like/Character Devices (mouse devices, sound cards, and terminals)

• Random access devices are usually accessed in large contiguous blocks of data that are stored persistently.

brw-r----- 1     root      disk  3,64  Apr 27  1995  /dev/hdb

b on the far left of the listing, means that your hard disk is a block device.

4

2.3.1 Disks (Cont.)

Page 5: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

5

• 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.

 crw-r--r--   1     root     sys       14,   3 Jul 18  1994  /dev/dsp 

C on the far left of the listing, means that your hard disk is a Character device.

2.3.1 Disks (Cont.)

Page 6: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

• As an example of the use of special files to access disk partitions, consider the mount commands below:

# mount /dev/disk0a  / 

 # mount  /dev/disk1e  /home 

• The command to mount a disk partition needs to specify the physical disk partition to be mounted (mount's first argument) and the location to place it in the filesystem.

The mount command is discussed in greater detail in Chapter 10. 6

2.3.1 Disks (Cont.)

Page 7: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

7

• Other device types have special files named differently, but they follow the same basic conventions.

• Some of the most common are summarized in Table 2-9:

2.3.2 Special Files for Other Devices

Page 8: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

8

Page 9: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

9

• Most Unix versions provide commands that make it easy to quickly determine what devices are present on the system, as well as their current status.

• The following Table (Table 2-10) lists the commands for the different systems:

2.3.2.1 Commands for listing the devices on a system

Page 10: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

10

Page 11: Chapter 2 (Cont.) The Unix Way Essential System Administration, 3rd Edition.

11

2.3.3 The Unix Filesystem Layout