UNIX File System Structure
Every file on a UNIX system has a unique ‘inode’. The inode contains the information necessary for a process to access a file. Such as file ownership, access right, file size and location of the file’s data in the file system. Process access files by a well-defined set of system call and specify a file by a path name. An inode consisting of the following information:
1. File owner identifier
2. File type
3. File access permissions
4. File access times
5. Number links to the files
6. Table of contents for the disk addresses of data in a file.
7. File size
The UNIX Kernel views all files as streams of bytes. UNIX supports 4 types of files.
i. Ordinary: An ordinary file created by users, these are application-specific files.
ii. Directory: A directory is a collection of files and sub-directories, organized in a hierarchical structure. A directory is a sequence of entries, each consisting of the inode number and name of the file.
iii. Special files: It is used to access peripheral devices such as terminals and printers. Each I/O device is associated with a special file.
iv. Name files: When a user wants to create a file, the kernel must allocate disk blocks from the file system. The file system super-block contains an array that is used to cache the number of free disk blocks in the file system. The utility program makes (make file system) organize the data blocks of a file system in a linked list. So each link of the list is a disk block that contains an array of free disk block numbers and one array entry is the number of the next block of the linked list.