System V (with no version number) had one filesystem format. It called it FS. BSD unix just had to be better, so they made some major improvements aimed at optimizing for larger disks, and called it ffs, for fast file system. Today's descendant from BSD's ffs is the ufs filesystem.

These days, nearly every unix calls its own filesystem the Unix File System, as opposed to the DOS filesystem, or the CDROM filesystem, etc...

UFS is the primary filesystem of a number of unix variants, including SunOS, Solaris, NeXTstep, many (all?) BSD unix variants, and possibly others. Even the Linux ext2 filesystem uses the features described here. Of course, each adds a few of its own proprietary features to UFS, so UFS binary compatibility between systems may be limited.

A UFS filesystem is composed of the following parts:

  • some potential boot blocks at the beginning of the disk, just in case you want to make this partition bootable
  • a superblock, containing a magic number identifying this as a UFS filesystem, and some other vital numbers describing this filesystem's geometry and statistics and behavioral tuning parameters
  • a collection of cylinder groups; Each cylinder group has the following components:
    • a backup copy of the superblock
    • a cylinder group header, with statistics, free lists, etc, about this cylinder group, similar to those in the superblock
    • a number of inodes, each containing file attributes
    • a number of data blocks

additional details:
The original unix FS only included the boot block, superblock, a clump of inodes, and the data blocks. On large disks, moving the head back and forth between the clump of inodes and the data blocks they referred to caused thrashing, so BSD ffs invented the cylinder groups, breaking the disk up into chunks each with its own inode clump and data blocks.

The intent of BSD FFS is to try to localize associated data blocks and metadata in the same cylinder group, and ideally, all of the contents of a directory (both data and metadata for all the files) in the same or near by cylinder group, thus reducing fragmentation caused by scattering a directory's contents over a whole disk.

Another optimization UFS has inherited from BSD ffs is the file tail fragment. In order to reduce the fragmentation of a file and increase the number of contiguous blocks in the file, BSD increased the block size from 512b to 8k. As a consequence, a 10 byte file would still use 8K of space. To fix this, they added the concept of tail fragments. If the last block in a file is smaller than 4k, it may be stored in a fragment block, along with the tail fragments of other files, saving significant space on your...um, 300M disk.

Of course now, the numbers are more like 32K blocks on 200G disks.

 

No UFS man pages or include files or linux source code files were hurt during the creation of this writeup.