The Unix file system ( UFS ) is a family of file systems supported by many Unix and Unix-like operating systems. It is a distant descendant of the original filesystem used by Version 7 Unix .
28-416: A UFS volume is composed of the following parts: Inodes are numbered sequentially, starting at 0. Inode 0 is reserved for unallocated directory entries, inode 1 was the inode of the bad block file in historical UNIX versions, followed by the inode for the root directory , which is always inode 2 and the inode for the lost+found directory which is inode 3. Directory files contain only the list of filenames in
56-401: 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
84-713: A mechanism that maintains the file system consistency without limiting the performance in the way the traditional sync mode did. This has the side effect of reducing the requirement of file system checking after a crash or power failure. To overcome the remaining issues after a failure, a background fsck utility was introduced. In UFS2, Kirk McKusick and Poul-Henning Kamp extended the FreeBSD FFS and UFS layers to add 64-bit block pointers (allowing volumes to grow up to 8 zebibytes ), variable-sized blocks (similar to extents ), extended flag fields, additional 'birthtime' stamps, extended attribute support and POSIX1.e ACLs. UFS2 became
112-464: A problem. To combat this, BSD originally increased the filesystem block size from one sector to 1 K in 4.0 BSD; and, in FFS, increased the filesystem block size from 1 K to 8 K. This has several effects. The chance of a file's sectors being contiguous is much greater. The amount of overhead to list the file's blocks is reduced, while the number of bytes representable by any given number of blocks
140-563: A single "fragment" block instead of multiple mostly empty blocks. The work on Berkeley FFS was widely adopted by other Unix vendors, and the family of filesystems derived from it are collectively known as UFS. Vendors of some proprietary Unix systems, such as SunOS / Solaris , System V Release 4 , HP-UX , and Tru64 UNIX , and open Unix derived systems like illumos , 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. Many have continued to use
168-403: A super-root directory, where remote trees can be mounted. If, for example, two workstations "pcs2a" and "pcs2b" were connected via "connectnodes" and "uunite" startup script, "/../pcs2b" could be used to access the root directory of "pcs2b" from "pcs2a". Under DOS , OS/2 , and Microsoft Windows , each partition has a drive letter assignment (e.g. the C partition is labeled C:\ ) and there
196-545: A version of UFS. In Apple 's Mac OS X , it was available as an alternative to HFS+ , their proprietary filesystem. However, as of Mac OS X Leopard , it was no longer possible to install Mac OS X on a UFS-formatted volume. In addition, one cannot upgrade older versions of Mac OS X installed on UFS-formatted volumes to Leopard; upgrading requires reformatting the startup volume. There was a 4 GB file limit for disks formatted as UFS in Mac OS X. As of Mac OS X Lion , UFS support
224-623: Is an implementation of a log-structured file system (a concept originally proposed and implemented by John Ousterhout ), originally developed for BSD . It was removed from FreeBSD and OpenBSD ; the NetBSD implementation was nonfunctional until work leading up to the 4.0 release made it viable again as a production file system. Most of the on-disk format of LFS is borrowed from UFS . The indirect block, inode and directory formats are almost identical. This allows well-tested UFS file system code to be re-used; current implementations of LFS share
252-602: 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 implemented block reallocation, a technique that reorders the blocks in the file system just before the writes are done to reduce fragmentation and control file system aging. He also implemented soft updates ,
280-406: Is delayed until there are no clean segments left; it can also be deferred for when the system is idle. Even then, only the least-dirty segments are picked for collection. This is intended to avoid the penalty of cleaning full segments when I/O bandwidth is most needed. At a checkpoint (usually scheduled about once every 30 seconds), LFS writes the last known block locations of the inode map and
308-456: Is increased. Larger disk sizes are also possible, since the maximum number of blocks is limited by a fixed bit-width block number. However, with larger block sizes, disks with many small files will waste space, since each file must occupy at least one block. Because of this, BSD added block-level fragmentation , also called block suballocation, tail merging, or tail packing , where the last partial block of data from several files may be stored in
SECTION 10
#1732775784264336-446: Is no public root directory on it. On many Unixes , there is also a directory named /root (pronounced "slash root"). This is the home directory of the 'root' superuser . On many Mac and iOS systems this superuser home directory is /var/root . A home page 's URL usually points to the root of the respective website 's domain name . Log-structured File System (BSD) The Log-Structured File System (or LFS )
364-424: 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 was inspired by UFS1 but does not support fragments and there are no plans to implement soft updates. (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
392-406: Is the "empty" part before the initial directory separator character ( / ). All file system entries, including mounted file systems are "branches" of this root. In UNIX-like operating systems, each process has its own idea of what the root directory is. For most processes this is the same as the system's actual root directory, but it can be changed by calling the chroot system call . This
420-453: Is typically done to create a secluded environment to run software that requires legacy libraries and sometimes to simplify software installation and debugging. Chroot is not meant to be used for enhanced security as the processes inside can break out. Some Unix systems support a directory below the root directory. Normally, "/.." points back to the same inode as "/", however, under MUNIX [ de ] , this can be changed to point to
448-477: The clump of inodes and the data blocks they referred to caused thrashing . Marshall Kirk McKusick , then a Berkeley graduate student, optimized the V7 FS layout to create BSD 4.2 's FFS (Fast File System) by inventing cylinder groups, which break the disk up into smaller chunks, with each group having its own inodes and data blocks. The intent of BSD FFS is to try to localize associated data blocks and metadata in
476-402: The cost of seeking between segments. Whenever a file or directory is changed, LFS writes to the head of this log: Unlike UFS, inodes in LFS do not have fixed locations. An inode map—a flat list of inode block locations—is used to track them. As with everything else, inode map blocks are also written to the log when they are changed. When a segment is filled, LFS goes on to fill
504-401: The directory and the inode associated with each file. All file metadata are kept in the inode. Early Unix filesystems were 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 grew larger, moving the head back and forth between
532-575: The higher-level UFS code with the lower-level code for FFS, since both of these file systems share much in common with UFS. LFS divides the disk into segments , only one of which is active at any one time. Each segment has a header called a summary block . Each summary block contains a pointer to the next summary block, linking segments into one long chain that LFS treats as a linear log. The segments do not necessarily have to be adjacent to each other on disk; for this reason, larger segment sizes (between 384KB and 1MB) are recommended because they amortize
560-454: 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 shared code for common functions. The upper layer
588-493: The need for background fsck, and NFSv4 ACLs. FreeBSD, NetBSD, OpenBSD, and DragonFly BSD also include the Dirhash system, developed by Ian Dowse. This system maintains an in-memory hash table to speed up directory lookups. Dirhash alleviates a number of performance problems associated with large directories in UFS. Linux includes a UFS implementation for binary compatibility at the read level with other Unixes, but since there
SECTION 20
#1732775784264616-434: The next free or clean segment. Segments are said to be dirty if they contain live blocks, or blocks for which no newer copies exist further ahead in the log. The LFS garbage collector turns dirty segments into clean ones by copying live blocks from the dirty segment into the current segment and skipping the rest. The summary block in each segment contains a map to track live blocks. Generally, garbage collection
644-570: 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. As of Solaris 7 , Sun Microsystems included UFS Logging, which brought filesystem journaling to UFS, which is still available in current versions of Solaris and illumos. 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 ,
672-464: The root directory is located; it is the filesystem on top of which all other file systems are mounted as the system boots up. Unix abstracts the nature of this tree hierarchy entirely and in Unix and Unix-like systems the root directory is denoted by the / (slash) sign. Though the root directory is conventionally referred to as / , the directory entry itself has no name – its path
700-421: 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
728-458: The supported 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, but eventually soft updates (called soft dependencies in NetBSD) was removed from NetBSD 6.0 in favor of the less complex file system journaling mechanism called WAPBL (also referred as logging), which
756-494: Was added to FFS in NetBSD 5.0. OpenBSD has supported soft updates since version 2.9 and has had UFS2 (FFS2) support (no ACLs) since version 4.2. OpenBSD has now made UFS2 the default UFS version and will be included with the 6.7 release. Since FreeBSD 7.0, UFS also supports filesystem journaling using the gjournal GEOM provider. FreeBSD 9.0 adds support for lightweight journaling on top of soft updates (SU+J), which greatly reduces
784-469: Was completely dropped. Root directory In a computer file system , and primarily used in the Unix and Unix-like operating systems , the root directory is the first or top-most directory in a hierarchy. It can be likened to the trunk of a tree , as the starting point where all branches originate from. The root file system is the file system contained on the same disk partition on which
#263736