- In the previous post, we discussed about different file operations. In this post, we will try to understand what the file system is.
Files system provides the mechanism for storing and accessing both data and programs of o/s.
- The file system consists of three parts:
1) Files
2) Directory Structure
3) Partition
Files
- A collection of files each storing related data.
Directory Structure
- It organizes and provide information about all the files in the system.
- The computer file system can be very expensive.
- Generally system stores all the files on the disk.
- To manage all these files and data we need to organize them.
- We can organize data by two ways: 1) Partition 2) Directories
Partition
- A partition can be created to split large disk area into sub-partitions either physically or logically.
- Disks are split into one or more partition also known as minidisk in the IBM system or volumes on the pc.
- Each disk on a system contains at list one partition which is a low level structure in which files and directories are stored.
- Sometimes partitions are used to provide several separate areas within one disk that can be treated as separate storage device.
- Partition can be considered as virtual disk.
- It can also store multiple o/s allowing a system to boot and run more than one o/s.
Directories
- Each partition contains information about files within it.
- This information is kept in a device directory or in a volume.
- Each partition contains a directory structure that holds information about the files stored on that partition.
- A directory can be viewed as a symbol tables that translate file name into their directory and disk.
- There are different schemes for defining logical structure of the directory system are available.
- While defining any particular directory structure we need to keep in mind the operations that are to be perform on a directory.
- There are following operations that can be perform on a directory.
Search for a File
- Searching a directory structure to find for a specific file entry.
Creating a File
- Whenever a new file is created, its entry should be recorded into the directory.
Deleting a File
- Whenever a file is no longer needed its associative entry should be remove form a directory.
List a Directory
- The directory structure should allow to list out all files in a directory and the content of directory entry for each file in the list.
Rename a File
- Name of file represent it content to its users. The name must be changeable when the content or users of file changes.
Traverse a File
- Traverse is an operation to access every directory and every files within a directory.
- We may be able to access every directory and every file within a directory structure.