Physical Devices  «Prev  Next»
Lesson 1

Devices, Disks, and Filesystems

In this module, we will examine in more detail the relationship between special device files and physical devices, with a special emphasis on disks and disk partitions. In this area, there is wide variation among different versions of UNIX, and even different machines running the same version, not surprising, considering that we are close to the underlying hardware. Because of this, you will have the opportunity to do Linux or Solaris-specific exercises when the tasks and processes differ significantly.
By the end of this lesson, you will be able to:
  1. Locate the special device files associated to hard disks on your system
  2. Manipulate hard links on your system
  3. Describe the relationship of inodes and directory entries
  4. Mount and unmount partitions, and configure your system to mount and unmount partitions automatically at boot time
  5. Describe the significance of the Logical Volume Manager on those systems, such as AIX, where it is used instead of the classical approach of disk partitions
  6. Describe the layout of a typical UNIX filesystem

Relationship between Special device files, Physical devices, Disks and Disk Partitions

In a computer system, physical devices (such as hard disks, CD-ROMs, and USB drives) are accessed through special device files in the operating system. These device files provide a way for software to communicate with the physical device and perform read and write operations. Disk partitions are a way of dividing a physical disk into multiple logical sections, each of which can be treated as a separate device by the operating system. Each partition is assigned its own special device file, which can be used to access the data stored within that partition. For example, on a Linux system, the device file "/dev/sda" might refer to the entire physical disk, while "/dev/sda1" might refer to the first partition on that disk, "/dev/sda2" might refer to the second partition, and so on. Each partition has its own unique device file, even though they are all part of the same physical disk. So in summary, special device files provide a way for software to access physical devices, including disks, and disk partitions provide a way of dividing a physical disk into multiple logical sections, each of which can be accessed through its own special device file.

Relationship between inodes and directory entries on a Unix Operating System

In a Unix operating system, inodes and directory entries are related components in the file system that work together to organize, store, and manage files and directories. Here's a brief explanation of their relationship:
  1. Inodes: An inode (short for "index node") is a data structure that stores important information about a file or directory, such as its permissions, owner, group, timestamps (creation, last modification, and last access), size, and pointers to the actual data blocks on disk. Each file or directory has a unique inode number within the file system, which serves as its identifier.
  2. Directory entries: A directory entry, on the other hand, is a record within a directory that maps human-readable file or directory names to their corresponding inode numbers. Directory entries store two essential pieces of information: the name of the file or directory and the inode number associated with it. Directories themselves are just special types of files that contain these directory entries.
The relationship between inodes and directory entries can be summarized as follows:
  1. Inodes store the metadata and location of the actual data for files and directories.
  2. Directory entries provide the mapping between human-readable names and inode numbers.
  3. When a user accesses a file or directory by its name, the operating system uses the directory entry to look up the corresponding inode number and then retrieves the relevant metadata and data from the inode.

This separation of concerns between inodes and directory entries allows for efficient file management, as it enables features like hard links (multiple directory entries pointing to the same inode), as well as simplifying renaming and moving of files within the file system.