Everything2
Near Matches
Ignore Exact
Full Text
Everything2

UFS

created by simonc

(thing) by ssd (7.1 mon) (print)   ?   (I like it!) 2 C!s Tue Mar 12 2002 at 4:50:18

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.


printable version
chaos

journaling filesystem System V metadata HFS+
filesystem stat tunafish #include
inode superblock BSD Excuse me, could you explain again why you suck?
vnode read only Unix variant UNIX file system layout
FS File size Thrashing boot
Partition magic number data Virtual File System
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
What you are reading:
Sugar daddy
Kosovo
How to listen to the stories that cats tell us
Prostitution in the Victorian Era
How to create a bitmap in memory in Windows
No one wants you the way you are
Hubble Constant
Sephiroth
ice cream and psilocybin
Der Ring des Nibelungen
A Computer Prayer
Kandahar
Pocky
New Writeups
Madara
One Winged Angel(fiction)
Tom Rook
Talk is cheap(poetry)
shaogo
Adelle Davis(person)
Aerobe
race car g sfjsgsd(poetry)
Binah
Dream Log: July 5, 2008(dream)
StrawberryFrog
Forgotten things in space(idea)
antigravpussy
velvet revolution fairy tale(idea)
Heitah
Nerve agent VX(thing)
Pavlovna
shite(idea)
wonton
Days and nights come together in a slow falling down(fiction)
Pavlovna
wee(idea)
katherine
root log: July 2008(log)
Madara
There’s nothing like a trail of blood to find your way back home(fiction)
Heitah
After sneeze(idea)
froggy7384
Why we smoke(personal)
This page courtesy of The Everything Development Company