- Disks provide the bulk of secondary storage on which a file system is maintained.
- They have two characteristics that make them a convenient medium for storing multiple files:
- A disk can be rewritten in place; it is possible to read a block from the disk, modify the block, and write it back into the same place.
- A disk can access directly any given block of information it contains. Thus, it is simple to access any file either sequentially or randomly, and switching from one file to another requires only moving the read-write heads and waiting for the disk to rotate.
- Rather than transferring a byte at a time, to improve I/O efficiency, I/O transfers between memory and disk are performed in units of blocks.
- Each block has one or more sectors.
- Depending on the disk drive, sectors vary from 32 bytes to 4096 bytes; usually, they are 512 bytes.
- A file system poses two quite different design problems.
- The first problem is defining how the file system should look to the user. This task involves defining a file and its attributes, the operations allowed on a file, and the directory structure for organizing files.
- The second problem is creating algorithms and data structures to map the logical file system onto the physical secondary-storage devices.
- The file system itself is generally composed of many different levels. The structure shown in Fig 11.1 is an example of a layered design. Each level in the design uses the features of lower levels to create new features for use by higher levels.
Figure 11.1:
Layered file system.
|
- The lowest level, the I/O control, consists of device drivers and interrupt handlers to transfer information between the main memory and the disk system.
- A device driver can be thought of as a translator.
- Its input consists of high-level commands such as ``retrieve block 123''.
- Its output consists of low-level, hardware-specific instructions that are used by the hardware controller, which interfaces the I/O device to the rest of the system.
- The device driver usually writes specific bit patterns to special locations in the I/O controller's memory to tell the controller which device location to act on and what actions to take.
- The basic file system needs only to issue generic commands to the appropriate device driver to read and write physical blocks on the disk.
- The file-organization module knows about files and their logical blocks, as well as physical blocks. By knowing the type of file allocation used and the location of the file, the file-organization module can translate logical block addresses to physical block addresses for the basic file system to transfer. The file-organization module also includes the free-space manager, which tracks unallocated blocks and provides these blocks to the file-organization module when requested.
- Finally, the logical file system manages metadata information.
- Metadata includes all of the file-system structure except the actual data (or contents of the files).
- It maintains file structure via file-control blocks. A file-control block (FCB) contains information about the file, including ownership, permissions, and location of the file contents.
- Many file systems are in use today; ISO 9660, UNIX file system (UFS), FAT, FAT32, NTFS, ext2, ext3, ext4. There are also distributed file systems in which a file system on a server is mounted by one or more clients.
Cem Ozdogan
2011-02-14