UNIX file system

UNIX File System also called the Berkeley Fast File System (FFS) and was designed to be fast and reliable. Modern UNIX systems use a Virtual File System; this allows the system to use many different actual file systems in a seamless fashion. Important data structures are stored throughout the file system. In order to facilitate fast data accessibility, data are localized so that the hard disk heads do not need to travel much when reading a file.

A UFS is organized into sections, called cylinder groups, and the size of each group is based on the geometry of the hard disk. A UFS volume is composed of the following parts:

  • Superblock: UFS has a superblock data structure in the beginning of the file system that contains the basic layout information. The content of each file is saved to a block, which is a group of consecutive sectors. Blocks also can be broken up into fragments, which are used to store the final bytes of a file instead of allocating a full block.
  • Boot block: A few blocks at the beginning of the partition are reserved and initialized for boot information.
  • Inode: The metadata for each file and directory is stored in an inode data structure. The names of files are stored in directory entry structures, which are located in the blocks allocated to directories.
  • Cylinder group: A cyclinder group contains various components like: a backup copy of the superblock, o a cylinder group header, with statistics, free lists, etc, a number of inodes, each containing file attributes and a number of data blocks. In short, each cylinder group contains its own inode table, bitmaps for the allocation status of fragments, and copies of the superblock.
  • Directory entry structure: Directory entry structures are basic data structures that contain the name of the file and a pointer to the file's inode entry.
The UFS1 file system is the default file system of OpenBSD and Solaris. It used to be the default file system of FreeBSD and NetBSD until FreeBSD 5.0 and NetBSD 2.0 included UFS2. UFS2 adds support for larger files and disks and other advanced features. At the time of this writing, only FreeBSD and NetBSD support UFS2. Apple OS X and Linux also support UFS1, but it is not their default file system. Solaris also has a version of UFS to support large files and disks.