Download presentation
Presentation is loading. Please wait.
Published byWilla Gilbert Modified over 8 years ago
1
File system In computing, a file system is a method of storing and organizing computer files and the data they contain to make it easy to find and access them. File are collection of data items stored on disk or it's device which can store the information, data, music (mp3), picture, movie, sound, book etc. In fact what ever you store in computer it must be inform of file. A UNIX file system is a collection of files and directories stored in one large tree like-structure. Each file system is stored in a separate disk partition. The following are a few of the file system: / - Special file system that incorporates the files under several directories including /dev, /sbin, /tmp etc /usr - Stores application programs /var - Stores log files, mails and other data /tmp - Stores temporary files
2
File system A UNIX file system is a collection of files and directories stored in tree like structure. Each file system is stored in a separate whole disk partition Structure
3
Directory Directory is a location that contains group of files. Directory is divided into two types: 1. Root directory - Strictly speaking, there is only one root directory in your system, which is denoted by / (forward slash). It is root of your entire file system and can not be renamed or deleted. 2. Sub directory – All Directories under root (/) directory are called subdirectories which can be created, renamed by the user. Note: Directories are used to organize your data files, programs more efficiently.
4
Partitions After the disk has been formatted the next step is to divide into several partitions. Disk partitioning is the act or practice of dividing the storage space of a hard disk drive into separate data areas known as partitions Each partition can be considered to be logically independent disk. Benefits, 1. Use of multi booting setups, which allow users to have more than one operating system on a single computer. For example, one could install Linux, and windows 2. Protecting or isolating files, to make it easier to recover a corrupted file system 3. Separate partitions prevent potential encroachment conflicts that may arise between the various data areas.
5
File system.. Once the disk is partitioned, a file system has to be created in each partition. There are usually multiple filesystem in one machine, each one having its own directory tree headed by root(/). Every file system is organized in a sequence of blocks of 512 bytes each. There are four components. 1.The Boot Block: It contains small boot program 2.The Super block: It contains global information about file system, also maintains free list of Inodes and data blocks which can be immediately allocated by the kernel when creating a file. 3.The Inode Block: It contains the table for file of the file system,all attributes are stored except name of the file or directory. 4.The data Block: It contains users data and programs Boot block Super block Inode blockData Block
6
INODES Every hard disk is organized into Blocks (sectors) where all the data reside. Eventhough the blocks are numbered consecutively, the data of a single file is not arranged continuously. If you are storing a big file that block is full, the remaining data is written in next free blocks. The blocks of files are scattered through the disk and the address of all its blocks are stored in the form of linked list in the INODE. INODE maintains a table for each file, all INODES are stored in INODE Blocks. Each Inode is accessed by a number called i-number or i-node number which references the position of the inode in the list.
7
Contents of inode: Every file or directory has an inode. The contents of inode are. – File type (regular, directory, etc..) – Number of Links ( The number of aliases the file has) – Owner ( The user-id number of the owner) – Group( The group-id number) – File mode ( The triad of the three permission) – Number of bytes in the file (size of the file) – Date and time of last modification. – Date and time of last access – Date and time of last change of inode. – An array of 13 pointer to the file Note: Neither the name of the file nor the i-number is stored in the inode. The filename and i-number are stored in directory which housed th file. The i-number is used to locate the position of the inode in the inode blocks.
8
The Data Block …… Pure data is stored in the data block, which commence from the point the inode blocks terminate. There is no mark at the end of data to indicate that reading or writing should stop at the point. Apart from these direct data blocks, there are also Indirect blocks. Indirect blocks contain the address of the direct blocks. The inode maintains a list of these indirect block addresses.
9
Logical and Physical Blocks… What is a disk block? - If the disk head has to move to the disk surface every time a byte is accessed. - I/O operations to Read or Write one character at a time is done in Character device (terminals and printers). - If Read or Write moves data in Blocks, then we call it as Block device. (Hard disk, Floppy disk,...) Logical block. In Standard System V, block size is 1024 bytes which is called logical blocks. Each block has its own unique address. Using an entire block for read/write operations means that even if you have to write three bytes of data into 1024 byte disk block, 1021 bytes will be simply wasted
10
Physical block.. Apart from logical block UNIX use physical block which is 512 bytes. So the one logical block may contains multiple physical blocks. Commands ls -s, df,du, find, dd will reports only the physical blocks.
11
The Block Addressing Scheme. There are 13 entries (or address) in the Inode table containing the array of 13 disk block addresses is the heart of the Inode. The first ten (addresses 0-9) are direct addresses; that is, they point directly to the first ten logical storage blocks of the contents of the file. If we have three blocks of data, three entries in the table contain the disk block numbers, remaining entries are Zero. If the file is larger than ten logical blocks, the 11th address (10) points to an indirect block, which contains direct addresses instead of file contents. The block is known as single Indirect block If the file is larger than 11 logical blocks, the 12th address (11) points to a double indirect block, which contains addresses of indirect blocks. The 13th address in the array (12) is the address of a triple indirect block, which contains addresses of double indirect blocks. Thus the maximum size a unix file system can support.
12
The figure illustrates this chaining of DATA blocks from the inode.
13
The Boot Block.. The boot block contains the code to bootstrap the OS(bootstrapping is a technique by which a simple computer program activates a more complicated system of programs.....).This is Master Boot Record(MBR) that DOS users would like to call it,this program is loaded into the memory when the system is booted. The bootstrapping program is read from the boot block of the root file system,this block is empty for other file system.
14
Super Block 1.Its followed by Boot block. 2.Its contain global file information about the disk usage,availability of data blocks and Inodes. Mainly it contains Size of the file system : represents the actual no of blocks (used + unused) present in the file system. Last time of updation Length of Disk block Number of free the inodes Number of free data blocks available List of immediately usable nodes.
15
25.9 The standard file system… The modern UNIX system are set up with multiple file system,each meant for a specific purpose. In general the most UNIX system will always have these file system. 1.The root file system.this file system is present in every UNIX system.The contents will include the root directory together with a minimal set of subdirectories and files including /dev, /etc, /bin, /sbin and sometimes /tmp these are just sufficient to keep the system going. 2.The boot file system. contains the UNIX kernel(/stand/unix) and other boot programs.
16
25.8 How the Kernel access a file… Now we know the addressing scheme used by the Kernel for accessing file and directories. Now what happens when we give the command cat tulec2?. 1.The kernel first know the inode for the current directory which is in Memory. Using those Inode number in the inode block it fetches the inode address of the data block. 2.From the directory file it looks the tulec2 and its inode number.it goes back to inode blocks and locates inode for the file tulec2.it reads the file size and disk address entries and reads from the data blocks. 3.Finally it instructs the disk drive to move the disk heads to the respective blocks counts the number of bytes read and matches with the file size.
17
Conti…….. 3.The swap file system. Every system should have the swap file system, which is used by the kernel to control the movement of process. When the system memory is heavily loaded the kernel has to move processes out of memory to this file system.User cannot directly access this file system. 4.The /home or /usr2 or /u file system- System files kept separate from the data files.This file system is usually made for users
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.