Back
Next
Unix File system
Overview
Each partition on a drive has:
Boot block - Volume boot record.
Super block - overall state of file system.
Inode table - tracks individual files.
Static table - maximum number of entry set when created.
Data blocks - actual data storage units.
Unix treats everything as a file.
Boot block (Master boot record, MBR)
Volume boot record - lays out the structure of the partition.
Located At beginning of the file system (partition).
Contains code to continue boot sequence.
Super block
Name of the volume (partition)
Partition size.
Inode table size
Inode table has entries for each possible file to be tracked.
Table created at initial install of filesystem and fixed in size.
Size determined by size of partition and # of file blocks.
Size of data units (blocks or clusters).
512 byte sector block results in too many inode entries if partion large.
Blocks may of "clusters" of sectors totaling 1K, 2K, 4K, etc.
Block size determined at creation time and fixed for each partition.
Locations of blocks? (used to translate block ids to chs or LBA @)
Number of free blocks.
Lists available (location of) data blocks.
Index to next free block.
Index to next free inode entry.
Dirty flag - used to indicate whether superblock has been modified.
Inode table
Tracks the locations of the blocks that make up a file.
Controls access and handling of the files.
Table actually fragmented and distributed across file system partition.
With duplicate copies for protection and faster access.
One entry per file saved - each entry contains
User (owner) id (numeric).
Group id.
File type
File modification time - when created or changed.
File access time - when file was last read.
Inode modification time - when book keeping data changed.
Size of file in bytes and blocks.
Number of links - # of names for a particular file listed in
various directory files.
Table of disk block addresses - where data is stored on disk.
File types
Regular - just data.
Directory - lists inodes of available files.
Symbolic - file containing the path of another file.
Character special - direct communication with byte unit devices.
keyboard, serial port.
Block special - direct communication block unit devices. Raw
communication with hard drive (boot sequence).
Pipe - temporary file used to pass data between running processes.
Sockets - similar to pipes, used with parallel processing, networking.
File pointers
File pointer table has three types of pointers.
1st 10 are direct and list the chs of the data storage block.
11th is an indirect pointer - points to data block of file pointers.
12th is a double indirect pointer - points to a block of pointers to
other blocks of pointers.
13th is a triple indirect pointer.
10 * 512 bytes / sector
+ 128 (512 bytes / 4 bytes/pointer) * 512 bytes / sector
+ 128^2 * 512 bytes / sector
+ 128^3 * 512 bytes / sector
Directories, files, and inodes.
Inode table controls only the files on the partition where it exists.
Each file controlled by its own inode.
Directories list a file's inode # and an associated name.
Every file must have at least one name linked to it but may have several.
For regular files, users can create additional names.
For every name directly associated with a file,
Link count increases by 1.
As filenames are delete from directory files,
Link count decreases by 1.
When count is zero, OS frees the data blocks and inode for file.
File can have many different names (links) listed in a directory file.
File can have the same name listed in many different directories
on the same partition.
Moving a file within a particular partition only requires that only the
directories of the starting and ending location be modified. The file
itself is not accessed.
Hard links
When more than one directory entry refers to a particular inode #,
a hard link has been established.
All hard links to a particular inode must be on the same partition.
Hard links cannot be used on directory files.
As long as at least one link exists, file will exist.
Hard links can access a file even if directory permissions of original
file change.
Symbolic links
Symbolic links are separate files which contain the path to one of the
names of a file of interest.
Because path of file of interest is what is recorded,
Symbolic links can:
Link across partitions.
Link to directories.
Link to non-existant.
Should use absolute paths.
Original file can be deleted or may not even exist.
Most shells will detect circular links or excessively long link chains.
Access to file affected by directory permissions.
NIS+ - current versions of Unix (Solaris) support NIS which allows
partitions on different systesm to be mounted over a network.
Result is somewhere between a hard and soft link.
Requires a high degree of authentication.