Unix File System
History The origin of UNIX can be traced back to 1965, Bell Telephone Laboratories, General Electric Company and MIT took up a joint venture to develop an operating system that could serve a large community of users and also allow them to share data. A hard disk may comprise of a single file system or it can also be partitioned to house several file systems. The reverse is however not true. No file system can be split over two different disks. 5/1/2006 Computer System Software CS012 BE 7th Semester 2
UNIX File system UNIX has multiple file systems A file system is a formatted partition of the disk Is a group of files having relevant information There is always one compulsory file system known as the root. others can be created by the administrator and mounted at some point in the hierarchy before use. 5/1/2006 Computer System Software CS012 BE 7th Semester 3
Volume structure in UNIX Boot block : occupies the beginning of the root file system Super block : Has the state of the file-its size,where to find the free space on the file system,how many files it can store etc. Inode list : It follows the super block-give the internal representation of the file Data Block : Contains data.( Size of the blocks can vary from 512 bytes to 4K) 5/1/2006 Computer System Software CS012 BE 7th Semester 4
Boot Block The disk space allotted to a UNIX file system is made of blocks of usually 512 bytes. All the blocks belonging to a file are divided into four parts viz., Boot Block - occupies the beginning of the root file system and contains a program called bootstrap loader. This program is executed when the host machine is booted. 5/1/2006 Computer System Software CS012 BE 7th Semester 5
Super & Data Block Super Block - Has the state of the file-its size, where to find the free space on the file system, how many files it can store etc. Data Block contains the actual file contents. An allocated block can belong to only one file in the file system. 5/1/2006 Computer System Software CS012 BE 7th Semester 6
Inode Table UNIX treats everything it knows and understands as files. 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 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 5/1/2006 Computer System Software CS012 BE 7th Semester 7
Inode Pointer Structure 5/1/2006 Computer System Software CS012 BE 7th Semester 8
Inode Pointer Structure Each inode entry in the inode table consists of 13 addresses each. These addresses specify where exactly the contents of the file are stored on the disk. These addresses are numbered 0 to 12. The first ten adddresses viz., 0 to 9 point to 1 KB blocks on disk and thus can handle a file size upto 10 KB. The 11th entry contains the address of a 1KB block. (This block does not contain the file contents).this block contains 256 more slots or addresses each of which in turn can point to a 1 KB block on disk. The maximum size that can be addressed using the 10th entry is 256 KB. This is called Single Indirection. 5/1/2006 Computer System Software CS012 BE 7th Semester 9
Inode Pointer Structure The 12th address in the inode table points to a block of 256 addresses each of which in turn again points to another set of 256 addresses. These addresses point to 1 KB data chunks. Thus the maximum file size accessible by this is 256 * 256 i.e. 64 MB. This is known as Double Indirection. Similarly, the maximum file size accessible by the 13th address in the inode table is 256*256*256 i.e. 16GB. This is known as Triple Indirection. Thus, together the maximum file size that UNIX can provide is 10 KB + 256 KB + 64 MB + 16 GB which is quite vast. 5/1/2006 Computer System Software CS012 BE 7th Semester 10
Types of users in UNIX OWNER : the owner of the file GROUP : all members in the group OTHERS : all other users in the environment Categories of file permissions Read only Write only Execute only 5/1/2006 Computer System Software CS012 BE 7th Semester 11
File Permissions Example: If all the users are given all the permissions then the file will show the permissions as rwxrwxrwx. The first three slots are for the owner, the next three for the group and the last three for others. If the owner decides to have read, write and execute permissions only for himself and only read permission to others then the file will have rwxr r permissions. 5/1/2006 Computer System Software CS012 BE 7th Semester 12