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).
264 The File System for record-based operations: reading, writing, or locking a database record- by-record. (This might be one of the reasons that most Unix database com- panies bypass the Unix file system entirely and implement their own.) More than simple database support, a mature file systems allows applica- tions or users to store out-of-band information with each file. At the very least, the file system should allow you to store a file “type” with each file. The type indicates what is stored inside the file, be it program code, an exe- cutable object-code segment, or a graphical image. The file system should store the length of each record, access control lists (the names of the indi- viduals who are allowed to access the contents of the files and the rights of each user), and so on. Truly advanced file systems allow users to store comments with each file. Advanced file systems exploit the features of modern hard disk drives and controllers. For example, since most disk drives can transfer up to 64K bytes in a single burst, advanced file systems store files in contiguous blocks so they can be read and written in a single operation. Most files get stored within a single track, so that the file can be read or updated without moving the disk drive’s head (a relatively time-consuming process). They also have support for scatter/gather operations, so many individual reads or writes can be batched up and executed as one. Lastly, advanced file systems are designed to support network access. They’re built from the ground up with a network protocol that offers high performance and reliability. A network file system that can tolerate the crash of a file server or client and that, most importantly, doesn’t alter the contents of files or corrupt information written with it is an advanced sys- tem. All of these features have been built and fielded in commercially offered operating systems. Unix offers none of them. UFS: The Root of All Evil Call it what you will. UFS occupies the fifth ring of hell, buried deep inside the Unix kernel. Written as a quick hack at Bell Labs over several months, UFS’s quirks and misnomers are now so enshrined in the “good senses” of computer science that in order to criticize them, it is first necessary to warp one’s mind to become fluent with their terminology.
Previous Page Next Page