262 The File System What’s a File System? A file system is the part of a computer’s operating system that manages file storage on mass-storage devices such as floppy disks and hard drives. Each piece of information has a name, called the filename, and a unique place (we hope) on the hard disk. The file system’s duty is to translate names such as /etc/passwd into locations on the disk such as “block 32156 of hard disk #2.”' It also supports the reading and writing of a file’s blocks. Although conceptually a separable part of the operating system, in practice, nearly every operating system in use today comes with its own peculiar file system. Meet the Relatives In the past two decades, the evil stepmother Unix has spawned not one, not two, but four different file systems. These step-systems all behave slightly differently when running the same program under the same circumstances. The seminal Unix File System (UFS), the eldest half-sister, was sired in the early 1970s by the original Unix team at Bell Labs. Its most salient fea- ture was its freewheeling conventions for filenames: it imposed no restric- tions on the characters in a filename other than disallowing the slash character (“/”) and the ASCII NUL. As a result, filenames could contain a multitude of unprintable and (and untypable) characters, a “feature” often exploited for its applications to “security.” Oh, UFS also limited filenames to 14 characters in length. The Berkeley Fast (and loose) File System (FFS) was a genetic make- over of UFS engineered at the University of California at Berkeley. It wasn’t fast, but it was faster than the UFS it replaced, much in the same way that a turtle is faster than a slug. Berkeley actually made a variety of legitimate, practical improvements to the UFS. Most importantly, FFS eliminated UFS’s infamous 14-character filename limit. It introduced a variety of new and incompatible features. Foremost among these was symbolic links—entries in the file system that could point to other files, directories, devices, or whatnot. Nevertheless, Berkeley’s “fixes” would have been great had they been back-propagated to Bell Labs. But in a classic example of Not Invented Here, AT&T refused Berkeley’s new code, leading to two increasingly divergent file systems with a whole host of mutually incompatiable file semantics. Throughout the 1980s, some “standard” Unix programs knew that filenames could be longer than 14 characters, others didn’t. Some knew that a “file” in the file
What’s a File System? 263 system might actually be a symbolic link. Others didn’t.1 Some programs worked as expected. Most didn’t. Sun begat the Network File System NFS. NFS allegedly lets different net- worked Unix computers share files “transparently.” With NFS, one com- puter is designated as a “file server,” and another computer is called the “client.” The (somewhat dubious) goal is for the files and file hierarchies on the server to appear more or less on the client in more or less the same way that they appear on the server. Although Apollo Computers had a net- work file system that worked better than NFS several years before NFS was a commercial product, NFS became the dominant standard because it was “operating system independent” and Sun promoted it as an “open stan- dard.” Only years later, when programmers actually tried to develop NFS servers and clients for operating systems other than Unix, did they realize how operating system dependent and closed NFS actually is. The Andrew File System (AFS), the youngest half-sister, is another net- work file system that is allegedly designed to be operating system indepen- dent. Developed at CMU (on Unix systems), AFS has too many Unix-isms to be operating system independent. And while AFS is technically superior to NFS (perhaps because it is superior), it will never gain widespread use in the Unix marketplace because NFS has already been adopted by everyone in town and has become an established standard. AFS’s two other problems are that it was developed by a university (making it suspect in the eyes of many Unix companies) and is being distributed by a third-party vendor who, instead of giving it away, is actually trying to sell the program. AFS is difficult to install and requires reformatting the hard disk, so you can see that it will die a bitter also-ran. Visualize a File System Take a few moments to imagine what features a good file system might provide to an operating system, and you’ll quickly see the problems shared by all of the file systems described in this chapter. A good file system imposes as little structure as needed or as much struc- ture as is required on the data it contains. It fits itself to your needs, rather than requiring you to tailor your data and your programs to its peculiarities. A good file system provides the user with byte-level granularity—it lets you open a file and read or write a single byte—but it also provides support 1Try using cp -r to copy a directory with a symbolic link to “..” and you’ll get the idea (before you run out of disk space, we hope).
Previous Page Next Page