Cover V05, I01
Article
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Sidebar 1

jan96.tar


Sidebar: UNIX Filesystem Structure

A traditional UNIX filesystem is described by its superblock, which contains the basic parameters of the system. These parameters include the number of data blocks in the filesystem, a count of the maximum number of files, and a pointer to the free list, which is a list of all the free blocks in the filesystem. In this filesystem, the information was laid out on the disk in the following manner:

Boot Block
Superblock
Inodes
Datablocks

Because this organization separates the inodes from the data, accessing a file normally incurs a long seek from the file's inode to its data. In addition, a fault in the superblock puts the entire disk at risk.

In 4.3BSD version of UNIX, a new filesystem was provided which has since been adopted for SVR4 as the ufs, or the Unix File System. The first change was that the superblock was replicated to protect against catastrophic loss. This replication is done when the filesystem is created. Since the information contained in the superblock is static, the copies need not be referenced unless the default superblock is corrupted.

The new filesystem organization divides a disk partition into one or more areas, each of which is called a cylinder group. These normally comprise one or more consecutive cylinders on a disk. Each cylinder group contains bookkeeping information (including a copy of the Superblock), space for inodes, a bitmap describing the usage of datablocks within the cylinder group, and summary information describing the available blocks in the cylinder group. The bitmap replaces the traditional freelist.

The motivation for cylinder groups is to create clusters of inodes that are spread over the disk, instead of being allocated at the beginning of the disk. The filesystem attempts to allocate data blocks close to their inodes. This also decreases the chance of losing all the inodes in a single disk failure.

The UFS filesystem is laid out as follows:

Boot Block
Superblock
Cylinder Block
Inodes
Data Blocks
Superblock
Cylinder Block
Inodes
Data Blocks
Superblock
Cylinder Block
Inodes
Data Blocks