Presentation is loading. Please wait.

Presentation is loading. Please wait.

Day 27 File System.

Similar presentations


Presentation on theme: "Day 27 File System."— Presentation transcript:

1 Day 27 File System

2 UNIX File Management Types of files Ordinary – stream of bytes
Directory – list of names plus pointers to attributes of the entry Special – map physical devices to file names Pipes – for inter-process communication. Links – an alternative way to access the file. Symbolic links – like shortcuts – data file that contains the name of the file it links to.

3 In a typical UNIX system
Dynamic allocation Non-contiguous Indexed allocation i-node holds the pointers to the datablock i-node holds other attributes too Array of free blocks to track the free blocks.

4 Volume structure Boot block – code to boot the OS
Superblock – attributes about the File system (partition size, free block list, free i-node list , i-node table size) Inode table Data blocks Superblock has an array to hold the list of free sectors. The last entry points to a datablock that has the rest of the array. First search in the superblock for free blocks. When no more free entries in the superblock, then copy from the datablock to superblock and free datablock.

5 i-node (index-node) The i-node holds the attributes of the file/directory It also points to the datablocks of the file/directory The pointers to the datablocks can be: Direct pointers Single, double, triple indirect pointers This allows for both small files and large files

6

7

8

9 Unix directory structure

10 Question When asked to find /usr/ast/mbox, where does the file system begin the search? When asked to find csse332/project1, where does the file system begin the search?

11 File systems under Linux
Virtual File System (VFS) Provides support for a variety of file management systems and file structures. Provides a single, uniform interface to all user processes.

12 Virtual File System Similar to UNIX in supporting In addition,
Hierarchical directory structure Directories are treated like files (only the format of the contents of the data-blocks differ) i-nodes are used to describe directory entries. In addition, Files are considered objects that share basic properties regardless of the target file system. Files have symbolic names that allow them to be uniquely identified Have owners, protection against unauthorized access or modification … A mapping module is used to convert the attributes of the file in its native file system to the format of the VFS.

13

14 Object types in VFS Superblock object
Stores information about the specific file system Device mounted on, pointer to root of the file system, basic block size, list of open files, list of superblock operations etc.

15 Object types in VFS The Inode Object Exists only in main memory.
A cache of all accessed file and directory i-nodes is maintained. Holds the attributes of the directory entry File type, owner, size of data, number of datablocks

16 Object types in VFS Directory Entry Object (dentry)
Exists only in main memory Held in a dcache (dentry cache) Constructed as directory entries are accessed from the various underlying file systems Maintained by the VFS for faster access.

17 Object types in VFS The File Object
Represent a file(or directory) opened by a process. open(), close() operations Includes the following: Dentry object associated with the file. File system containing the file. File pointer

18 Accessing a file with VFS
Check to see if a dentry for the file exists in the dcache. If yes, then find the i-node in the i-node cache and take appropriate action. If no, map the VFS system call to the system call of the file system that the file exists in. Access the file information from the file system, perform appropriate action and update the dcache and i-node cache. In some cases, this may involve having to actually construct the i-node for the dentry.

19 Ext3fs (Third extended file system)
The de-facto Linux file system Supports basic UNIX operations and structure In addition, Supports long file names (upto 255 characters) Supports larger portion sizes (more than one sector) Faster symbolic links i.e. the path is stored in the i-node and does not occupy a block on the disk. Secure deletion of files (man shred) Journaling is enabled log of all file system changes is maintained in the event of a system crash can undo or redo actions based on the recorded actions in the log file The main difference between ext2fs and ext3fs


Download ppt "Day 27 File System."

Similar presentations


Ads by Google