Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UK Essays.
In linux everything is treated as a file. A user frequently interacts with files directly or indirectly. They need perform various operations such as create, edit, delete etc on the files. To perform these activities, operating systems provide file management systems. The services required by file management system are provided by operating system.
File management system is a collection of software that provides services to application and users. It facilitates the communication between user application and files. This relieves user from developing the software for each application.
Objectives of File Management systems:
Guarantees data in the file is valid
Optimizes performance in terms of throughput & response time
Provide I/O support for storage device type
Provide I/O support for multiple users
Meet user requirements for data operations 
FILE System architecture:
Figure 1: File System Architecture. 
As depicted in the figure the device drivers interacts with the peripherals. The function of device driver is to start the I/O operation & complete the request. These device drivers are considered as a part of operating system.
Above the device drivers there which is also called as physical I/O. Main function of file system is to deal with the is basic file system data from disk systems & place them on secondary storage. Also it manages buffering of these blocks on to the main memory. It doesn’t care about data inside the file.
The next level is Basic I/O supervisor. The function of this layer is I/O initiation & termination. At this level control structures deals with file status, scheduling, I/O. The device on which file I/O is to be performed selected by I/O supervisor based on particular file selected.
Logical I/O enables users & application to accept records. The logical I/O module deals with file Records. Logical I/O maintains basic data about the files. Access system is the file system closest to the user. The main function is to provide interface between file system & applications.
File Management Functions:
Figure 2: File Management Functions 
Application programs & Users interact with the file system to create and delete files and for performing operations on files. File system first identify and locate the selected file before performing any operation. Directories are used to describe location of all files & their attributes. Most shared systems implements access control policies. Only authorized users can have access to particular files.
The basic operations that a user or application may perform on a file are performed at the record level. The file is viewed by user as structure of records. Access methods are used to map user commands into specific file manipulation commands. I/O operation is done on block basis. The records are organized as a blocks of output. In order to perform the operation files must be allocated to free blocks on the secondary storage. Also free storage must be managed so as to know what blocks are available for new files and growth in existing files.
File Organization: Several criteria affect the selection of file organization. Some of these factors can be listed as follows. The suitability depends on the application which will be using the file.
Economy of Storage
Short Access time
Simple maintenance 
Original file system: Physical disk in Linux is divided into logical disks. It is called as partitions. Each partition is treated as a standalone file system. Each device is assigned with major device number and the partitions are assigned with minor device number. The device driver refers to these numbers to access raw file system. Major number acts like a index to switch table & minor number will recognize specific instance of device. 
Physical location of file data block:
Placing the data blocks in a contiguous manner will improve the performance but will lead to inefficiencies in allocating space. User may need to specify the file of size at the time of creation.
“Linux file system allocates block one at a time from pool of free blocks”. File blocks are scattered randomly on physical disk.
Inodes: inode contains key information related to files required by the OS. A single inode may point to several file names but the active inode is associated only with one file. Inode stores attributes, permissions & other control information related to the file. The information contained in the inode is
¬le ownership indication
â€¢ File type
â€¢ File access permissions.
â€¢ Time of last access, and modi¬cation
â€¢ Number of links (aliases) to the ¬le
â€¢ Pointers to the data blocks for the ¬le
â€¢ Size of the ¬le in bytes (for regular ¬les), major and minor device numbers for special
Figure 3: Inode structure 
Inodes has pointers to data block. Each inodes contain 15 pointers. First 12 pointers will point directly to data blocks. 13th pointer will point to indirect data block.14th pointer points to doubly indirect data block. Similarly, 15th pointer will point to triply indirect block.
1] Very little space wasted. A disk can be filled completely.
2] Indirect block points many data blocks so larger files can be efficiently accessed.
3] Simultaneous operations can be performed. One read operation fetches the inode & another will fetch first data block.
1] may lead to poor performance
Directory provides information about file location, file ownership & its attributes. A directory is itself a file which is accessible to file management routines. The Directory structure can be shown as below
Figure 4: Linux Directory Structure 
As shown in the figure linux organizes directories in hierarchical fashion. The root lies at the top of the tree and it is denoted by “/”.Every directory in the linux system is under root directory.
The various directories under root directory are
Boot : The information required for booting is stored in this directory. This may consist of files used by LILO, Bootstrap loader. This is the place for kernel image.
etc: configuration files of machine & installed software are stored here
dev: device files for devices such as disk drives, serial ports are stored here.
Usr : it consists of all man pages, games, commands, static files for normal operations.
Sbin :It consists of system admin commands.
Home: This is the place where user will keep his own files. It contains users home directory for each user on the system.
Root: This is the home directory for root user.
To share files a special group is created for the set of users who intend to use that files. Directory is created with ownership of that group. The permissions are set such that all users within the group can create files. We can also set group ID so that all the files created in it will automatically have group ownership its parent directory has.
Access control in linux:
Terms related to ACL
A] User class: There are mainly three user classes’ owner, owning group & other users. To allow permission three bits read(r), write (w) and execute (x) can be set.
B] Access ACL: It determines group & user access permissions for file objects.
C] Default ACL: These can be only applied to directories. It decides permissions for file object when it is created.
D] ACL entry: ACL is a set of ACL entries. “An ACL entry contains a type (see Table B.1 on the following page), a qualifier for the user or group to which the entry refers, and a set of permissions”
There are 3 basic sets associated with linux file object. These sets are used to grant permissions read(r), write(w), execute(x) for 3 user groups, file owner & others. We can also set group id, user set id for special cases. “Access control list (ACL) allow the assignment of permissions to individual users or groups even if these do not correspond to the owner or the owning group” 
There are mainly two categories of ACL namely minimum ACL & extended ACL. Minimum ACL only consists of entries for owning group, owner & other which are associated with conventional permission bits for files & directories. Extended ACL has mask entry & entries for named group & named user types. ADD NFS, VFS.
Linux virtual file system:
Figure 5: Virtual file system
Figure 6: Linux virtual file system concept 
In linux file management is done with the help of Virtual file system (VFS).T o user process it appears as a single, uniform file system interface.VFS treats files as a objects stored in mass storage area. Files can be identified by their symbolic names. A file has a attribute such as access protection, ownership etc. A mapping is required by file system to map real file system characteristics into Virtual file system characteristics.
User process issues a file system call using VFS.VFS converts this call into kernel file system call which is then passed to mapping function for particular file system. Sometimes mapping function may result into complex operations. In many cases directories are not files, VFS may need to convert file corresponding to some directories. The original user file system call is translated into native call to the target file system.
The requested function on a file or directory is performed by invoked file system software. The results of the operation are routed back to the user in a similar manner.
As VFS is object oriented they are imlemented as a data structures using C,C++.Object consists of pointers which points to the file system functions.These funtions will operate on data.
The four objects are
Superblock object: Represents a specific mounted file system
Inode object: Represents a specific file
Dentry object: Represents a specific directory entry
File object: Represents an open file associated with a process
Third Extended (EXT3) File System:
EXT3 is third extended file system. It is journaling extension to EXT2.It is 100% compatible with all utilities designed for ext2 file system.”Ext3 shares ext2’s well-known robustness, but also adds extra features such as extended attributes, H tree”. The journaling approach used in EXT3 will greatly reduce the time spent for recovering file system after system crash. This will help to minimize system restart time & file system inconsistencies after unclean shutdown. After rebooting a system mount program first checks the Journal. If it finds ay unchecked changes, it applies the changes to the file system. Thus we can say mount program provides consistency to the system. The mount program takes care of all the consistency the system doesn’t need to check the consistency hence the computers using journaling are available within short duration after reboot..
Ext3 allocated area called as journal in which it records the changes made to files & directories ahead of time. If the system is crashed the recovery simply involves reading the journal from file system & replaying the changes. 
Journaling modes in EXT3 :
The classification is made based on the fact that whether journaling makes log changes only to metadata or to all file system. There are three journaling modes
Journal: It will record both metadata & file system data changes. In this mode there is lowest chance of risk.” This journaling mode minimizes the chance of losing the changes that have been made to any file in an ext3 file system”. It is the slowest mode. The risk associated with it is lowest.
Ordered: It will record the metadata but not the file contents. It is the default ext3 journaling mode. In this mode there is possibility that one may end up with the file in the intermediate stage. The risk associated with this mode is at medium level.
Writeback: “In this mode only metadata is journaled file contents are not”. It allows showing up old data into the file after a crash. It ensures that on reboot all garbage due to unwritten data be zeroed out.
Major Advantages of ext3:
Data Integrity: If there is any unclean, improper system shutdown ext3 guarantees data integrity. We can set the level of protection. It prevents the writing of garbage data to the disk after a crash. Generally we keep the data consistent with state of file system.
Availability: The amount of time system will take to check the consistency after unclean shutdown depends on the size of file system. Larger the file system larger the time. Ext3 will not require such consistency check .recovery time in ext3 does not depend on the file system size or the number of files. It depends on size of journal. So there is faster availability. It only takes few seconds to recover
Easy Transition: we can easily make transformation from ext2 to ext3 without reformatting. We can add journal to ext2 with the help of tune2fs program.
Speed: though ext3 writes data more than once it’s faster than ext2. This is because journaling increases speed of head motion of hard drive.
Because of its broad cross-platform compatibility it can be used on both 32 bit & 64 bit architecture.
As there is no need of any core kernel changes ext3 requires no new system calls.
If you need assistance with writing your essay, our professional essay writing service is here to help!Find out more
Cite This Work
To export a reference to this article please select a referencing style below:
Related ServicesView all
DMCA / Removal Request
If you are the original writer of this essay and no longer wish to have the essay published on the UK Essays website then please: