File Systems
UNIX
File Systems (alphabetical order) AFS CIFS CODA Ext2 GFS MS-DOS NFS NTFS Odyssey Samba UNIX Introduction Structure Concepts Links Some definitions and general technology |
If you've read the other file system pages, like the Ext2 and definitions pages, you probably already have pretty much of an idea of the structure of the file system as implemented in UNIX. Several file systems are based on the Unix semantics almost entirely or initally (like MS-DOS). Comparing with some other file systems, is designed with the KISS-idea in their minds, or simple, fast and thus efficient.
File names up to 255 characters, file name extensions are not obligatory but make things easier. Security of a file via the 9 right bits, defining user, group and everybody, in a format of -rwxrwxrwx: the first "-" is - to represent a file and a "d" to distinguish a directory. One exception for the directory right bits is that the x is for browse rights, and not execute like with files. The file system as a whole is hierarchical built up with the directories and its subdirectories (tree structure). Character special files, block special files, data files, i-nodes.
After starting the processes, the first three file decriptors are resereved for stid, stdout and stderr; when opening a (data)file, the first available filedescriptor is 3. After closing the requeested file, the filedescriptor is released and available for following file processes. Absolute path and relative paths. Absolute ones are resolved starting from the root, relative paths relative from the current directory (normally the work directory). Link is a directory-element pointing to an existing file (often somewhere else in the directory tree, mounted tree). File locks to prevent race problems. Semaphores and critical sections are a theoretical option, but unpractical in distributed systems. Solution: a flexible granulated mechanism to lock something between 1 byte and the whole file in one action. The call has the parameters of the first byte and the amount of bytes requested for the lock. The rest of the bytes of the file are still available for other prcesses, which is really convenient for database implementations. There are two types of locks: shared and exclusive. Exclusive speaks for itself. When there's a shared lock on part of a file, it is allowed to add another shared lock on the bytes who aren't locked exclusively, but a request for an exclusive lock over an shared lock will be denied. UNIX administers the following information of a file: file name, pointer to the structure of the requested information, the file mode (normal, directory, special file) with the protection bits, i-node number, device, amount of links to the file, userID, group identification, file size, time of last access and change and the time these mentioned parameters were changed (readable via the system call STAT). This section will go into a bit more detail of the implementation of the UNIX file system. First, the general layout of the hard disk (see Figure 1.). The Boot Block isn't used by UNIX, but for booting the PC, whereas the Superblock contains the ciritcal information about the layout of hte file system (like the amount of i-nodes, amount of device blocks and start of the list of free blocks). If the latter gets corrupted, the file system will be inaccessible. Each i-node contains the accountancy information of one file.
Indirect and double indirect blocks are used when the file size is larger than 10 data blocks. They are sort of index tables within the main index table. |
References and more information
Modern Operating Systems, A.S. Tanenbaum, Ch 7.