Physical File Structure

  1. Inodes and File Subsystem
  2. Superblocks

Inodes and File Subsystem

Inodes exist in a static form on disk, and the kernel reads them into an in-core inode to manipulate them. The internal representation of a file is given by an inode which contains a description of the disk layout of the life data and other information such as the file owner, access permissions and access times. (Bach 22) Inode is short for index node and is commonly used in UNIX terminology. Each file has one inode but it could have several other names, all which map into the inode. Each of these names is called a link. When a process refers to a file by name, the kernel parses the file name one component at a time, checks that the process has permission to search the directories in the path and eventually retrieves the inode for the file. (Bach 22) When a process creates a new file, the kernel assigns it to an unused inode. Inodes are stored in the file system, but the kernel reads them into an inode table in the core of the primary memory when manipulating files. (Bach 23)
The kernel contains two other data structures, the file table and the user file descriptor table. The file table is the global kernel structure, but the user file descriptor table is allocated per process. (Bach 23) When a process opens or creats a file, the kernel allocates an entry from each table, corresponding to the file's inode. (Bach 23) The user file descriptor table, file table, and inode table maintain the state of the file and the user's access to it.
The file table keeps track of the byte offset in the file where the user's next read or write will start, and the access permissions allowed to the opening process. The user file descriptor table identifies all open files for a process. The kernel returns a file descriptor for the open and creat system calls, which is an index into the user file descriptor table. When executing read and write system calls, the kernel uses the file descriptor to access the user file descriptor table, follows pointers to the file table and inode table entries, and from the inode, finds the data in the file. (Bach 23)

Properties of Inodes

(Bach 62).

Fields of the In-core copy of the Inode

Super Blocks

The super block describes the state of a file system -- how large it is, how many files it can store, where to find free space on the file system, and other information. (Bach 24)

The super block consists of the following fields:


(Bach 76)

PreviousContentsNext