Wednesday 25 May 2016

File System in UNIX

The UNIX file system is different from the MS-DOS file system. The disk space allotted to a UNIX file system is made of blocks of usually 512 bytes. All the blocks belonging to a file system are divided into following four parts




Boot Block  : Occupies the beginning of the root file system. This block contains a program called
                       bootstrap loader. Bootstrap loader executes when the host machine is booted.

Super Block : Super block contains the state of the file system ie its size, where to find the free space on the file system, how many files it can store etc.

Inode Block(Table) : It follows the super block and gives the internal representation of the file. The information related to these files is stored in a table known as Inode Table on the disk. For each file, there is an inode entry in the table. Each entry is approx 64 bytes and contains details such as
  •     Owner of the file
  •     Type of the file
  •     File access permissions
  •     File access time
  •     Size of the file
  •     Date and time of last access etc
   
Data Block : Data block contains the actual file contents. An allocated block can belong to only one file in the file system.(Size of blocks can vary from 512 bytes to 4K)


Hierarchy of Unix File System:



The Unix file system follows a tree structure with root represented by '/'.
Every non-leaf node is a directory, containing some other files and subdirectories
Every leaf nodes can be empty directories, regular files or special device files.

The main features of a Unix file system:
  •     Hierarchical structure
  •     Create and delete files
  •     Dynamic growth of files
  •     Protection of file data
  •     Treats peripheral devices as files
  •     Keeps track of files using i-node numbers.
  •     Information of files is kept in the i-node block.

File access permissions can be set for 3 classes of users:
  •     File Owner
  •     File Owner’s Group
  •     Others

Permissions on file:
Read (r), Write (w), Execute (x) permissions can be set for each file.

/bin        : Executable System Utilities (sh, cp, rm etc.)
/lib         : Operating System and Programming Libraries.
/dev       : Device Related Files
/etc        : System Configuration files and databases. 
/tmp      : System Scratch Files
/usr       : Home Directories of all users




   ***************************END**************************

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...