Unix File System

Unix File System

Infobox filesystem
full_name = UNIX file system
name = UFS
developer = CSRG
introduction_os = 4.2BSD
introduction_date =
partition_id =
directory_struct = table
file_struct =
bad_blocks_struct =
max_file_size = 2^73 bytes (8 ZiB)
max_files_no =
max_filename_size = 255 bytes
max_volume_size = 2^73 bytes (8 ZiB)
filename_character_set =
dates_recorded =
date_range =
forks_streams =
attributes =
file_system_permissions =
compression =
encryption =
OS = FreeBSD, OpenBSD, NetBSD, DragonFlyBSD, A/UX
The Unix file system (UFS) is a file system used by many Unix and Unix-like operating systems. It is also called the Berkeley Fast File System, the BSD Fast File System or FFS. It is a distant descendant of the original filesystem used by Version 7 Unix.


A UFS volume is composed of the following parts:
* a few blocks at the beginning of the partition reserved for boot blocks (which must be initialized separately from the filesystem)
* 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

Inodes are numbered sequentially. The first several inodes are reserved for historical reasons, followed by the inode for the root directory.

Directory files contain only the list of filenames in the directory and the inode associated with each file. All file metadata is kept in the inode.

History and evolution

Early versions of Unix used filesystems referred to simply as "FS". FS only included the boot block, superblock, a clump of inodes, and the data blocks. This worked well for the small disks early Unixes were designed for, but as technology advanced and disks got larger, moving the head back and forth between the clump of inodes and the data blocks they referred to caused thrashing. BSD optimized this in FFS (Fast File System) by inventing cylinder groups, breaking the disk up into smaller 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 nearby cylinder group, thus reducing fragmentation caused by scattering a directory's contents over a whole disk.

Some of the performance parameters in the superblock included number of tracks and sectors, disk rotation speed, head speed, and alignment of the sectors between tracks. In a fully optimized system, the head could be moved between close tracks to read scattered sectors from alternating tracks while waiting for the platter to spin around.

As disks grew larger and larger, sector level optimization became obsolete (especially with disks that used linear sector numbering and variable sectors per track). With larger disks and larger files, fragmented reads became more of a problem. To combat this, BSD originally increased the filesystem block size from one sector to 1k in 4.0BSD, and, in FFS, increased the filesystem block size from 1k to 8k. This has several effects. The chances of a file's sectors being contiguous is much greater. The amount of overhead to list the file's blocks is reduced. The number of blocks representable in a fixed bit width block number is increased (allowing for larger disks).

With larger block sizes, disks with many small files would waste a lot of space, so BSD added block level fragmentation [A rather ambiguous name, "block level fragmentation" is also used as Database terminology - a web search on the term will find plenty of such examples.] (also called block suballocation, tail merging or tail packing), where the last partial block of data from several files may be stored in a single "fragment" block instead of multiple mostly empty blocks (Allen 2005).


Vendors of some commercial Unix systems, such as SunOS/Solaris, System V Release 4, HP-UX, and Tru64 UNIX, have adopted UFS. Most of them adapted UFS to their own uses, adding proprietary extensions that may not be recognized by other vendors' versions of Unix. Surprisingly, many have continued to use the original block size and data field widths as the original UFS, so some degree of (read) compatibility remains across platforms. Compatibility between implementations as a whole is spotty at best and should be researched before using it across multiple platforms where shared data is a primary intent.

As of Solaris 7, Sun Microsystems included UFS Logging, which brought filesystem journaling to UFS. Solaris UFS also has extensions for large files and large disks and other features.

In 4.4BSD and BSD Unix systems derived from it, such as FreeBSD, NetBSD, OpenBSD, and DragonFlyBSD, the implementation of UFS1 and UFS2 is split into two layers — an upper layer that provides the directory structure and supports metadata (permissions, ownership, etc.) in the inode structure, and lower layers that provide data containers implemented as inodes. This was done to support both the traditional FFS and the LFS log-structured file system with common code for common functions. The upper layer is called "UFS", and the lower layers are called "FFS" and "LFS". In some of those systems, the term "FFS" is used for the combination of the FFS lower layer and the UFS upper layer, and the term "LFS" is used for the combination of the LFS lower layer and the UFS upper layer.

Kirk McKusick extended the FreeBSD FFS and UFS layers to support a new variant, called UFS2, which adds 64-bit block pointers (allowing volumes to grow up to 8 zettabytes), variable-sized blocks (similar to extents), extended flag fields, additional 'birthtime' stamps and extended attribute support. UFS2 became the default UFS version starting with FreeBSD 5.0. FreeBSD also introduced soft updates and the ability to make file system snapshots for both UFS1 and UFS2. These have since been ported to NetBSD. OpenBSD has supported soft updates since version 2.9 [http://www.openbsd.org/29.html] and UFS2 since version 4.2 [http://www.openbsd.org/42.html] .

Linux includes a UFS implementation for binary compatibility at the read level with other Unixes, but since there is no standard implementation for the vendor extensions to UFS, Linux does not have full support for writing to UFS. The native Linux ext2 filesystem is inspired by UFS. (In fact, in some 4.4BSD-derived systems, the UFS layer can use an ext2 layer as a container layer, just as it can use FFS and LFS.)

NeXTStep, which was BSD-derived, also used a version of UFS. In Apple Incorporated's Mac OS X, it is available as an alternative to HFS+, their proprietary filesystem. However, as of Mac OS X v10.5, one cannot install Mac OS X "Leopard" on a UFS-formatted volume. In addition, one cannot upgrade older versions of Mac OS X installed on UFS-formatted volumes to Leopard. To upgrade to Leopard you need to reformat your startup volume. [http://docs.info.apple.com/article.html?artnum=306516]

See also

* Comparison of file systems



* The Linux Documentation Project's [http://www.tldp.org/HOWTO/Filesystems-HOWTO-9.html#ffs Filesystems HOWTO: FFS] . Note that the distinction this draws between FFS and UFS is wrong; both terms are used at present and have been used in the past.
* [http://sixshooter.v6.thrupoint.net/jeroen/faq.html#UFS-DIFF-FFS Little UFS2 FAQ: What is the difference between UFS and FFS?] Note that this gets the relationship between FFS and UFS backwards; see the "Local Filesystems" chapter of "The Design and Implementation of the 4.4BSD Operating System", which refers to the upper layer as UFS, and the "Local Filestores" chapter, which refers to the lower layer as FFS.
* [http://www.informit.com/content/images/0131482092/samplechapter/mcdougall_ch15.pdf The Sun Solaris UFS implementation] chapter of the "Solaris Internals: Solaris 10 and OpenSolaris Kernel Architecture, Second Edition" book by Richard McDougall, Jim Mauro ISBN 0-13-148209-2
* PDFlink| [http://www.pacnog.org/pacnog1/day1/freebsd/intro-freebsd-additional-topics.pdf "UFS2 and Soft Updates make for a powerful combination", page 23, retrieved on 2007-11-04] |385 KiB

External links

* [http://lists.freebsd.org/pipermail/freebsd-current/2003-April/001444.html Little UFS2 FAQ]
* Linux [http://ufs-linux.sourceforge.net userspace UFS2 tools] .
* [http://www.tldp.org/HOWTO/Filesystems-HOWTO.html Filesystems-HOWTO] (part of The Linux Documentation Project, link is not Linux specific.)
* [http://ufs2tools.sourceforge.net/ UFS2 Tools] : An open source tool for accessing UFS2 (BSD) slices from within Windows
* http://docs.info.apple.com/article.html?artnum=306516 No UFS installation for Leopard
* http://www.freebsd.org/projects/bigdisk/index.html

Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Unix File System —   [Abk. UFS], das Dateisystem des Betriebssystems Unix. Es zeichnet sich u. a. dadurch aus, dass die Dateien in einem einzigen Verzeichnisbaum auch über mehrere physikalische Platten und Computer hinweg angeordnet sind. UFS fasst den Dateibegriff …   Universal-Lexikon

  • Unix File System — Das Unix File System (UFS) ist ein Dateisystem, dessen Entwicklung Anfang 1980 von William N. Joy unter dem Namen UFS in loser Anlehnung an die Datenstrukturen des UNIX Version 6 Dateisystems begonnen wurde. Zwei Jahre später, nach dem das… …   Deutsch Wikipedia

  • Unix File System — UFS Разработчик CSRG Файловая система UNIX file system Дата представления (4.2BSD) Структура Содержимое папок таблица Ограничения Макси …   Википедия

  • Unix File System — El perro de sant roque no tiene rabo, por que Sergio Ramos se lo ha cortado Unix File System (UFS) es un sistema de archivos utilizado por varios sistemas operativos UNIX y POSIX. Es un derivado del Berkeley Fast File System (FFS), el cual es… …   Wikipedia Español

  • Unix File System — UFS, abréviation de Unix File System, est un système de fichiers utilisé par de nombreux systèmes d exploitation de type Unix. Il est dérivé du FFS, qui lui même était basé sur le FS, dans les premières versions d Unix développées aux Bell Labs.… …   Wikipédia en Français

  • File system permissions — Most modern file systems have methods of administering permissions or access rights to specific users and groups of users. These systems control the ability of the users affected to view or make changes to the contents of the file… …   Wikipedia

  • File System — Système de fichiers Pour les articles homonymes, voir FS et SGF. Un système de fichiers (file system ou filesystem en anglais) ou système de gestion de fichiers (SGF) est une structure de données permettant de stocker les informations et de les… …   Wikipédia en Français

  • File system — Système de fichiers Pour les articles homonymes, voir FS et SGF. Un système de fichiers (file system ou filesystem en anglais) ou système de gestion de fichiers (SGF) est une structure de données permettant de stocker les informations et de les… …   Wikipédia en Français

  • File system fragmentation — In computing, file system fragmentation, sometimes called file system aging, is the inability of a file system to lay out related data sequentially (contiguously), an inherent phenomenon in storage backed file systems that allow in place… …   Wikipedia

  • File System Visualizer — mostrando el directorio home en Mac OS X. Desarrollador Daniel Richard G …   Wikipedia Español

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”