Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 23

File Systems

A file system is a process of


managing how and where data on
a storage disk, which is also
What is a referred to as file management or
FS.
File
System? It is a logical disk component that
compresses files separated into
groups, which is known as
directories.
DATA :
• Data is raw and unorganized facts that
are useless without proper processing
and organising them to retrieve some
Data and information for future use .

METADATA :
Metadata • Metadata is a data about data.
• Metadata shows basic information
about data, which can make finding and
working with specific instances of data
easier.
Example
Six basic file operations. The OS can provide system calls to create, write,
read, reposition, delete, and truncate files.

Creating a file:Two steps are necessary to create a file.

File
Space in the file system must be found An entry for the new file must be made in
for the file. the directory.

Operations Writing a file: To write a file, we make a system call specifying both the
name of the file and the information to be written to the file.

Reading a file: To read from a file, we use a system call that specifies the
name of the file and where (in memory) the next block of the file should be
put.
Repositioning Repositioning within a file: The directory is searched for the appropriate
entry, and the current-file-position pointer is repositioned to a given value.

Deleting Deleting a file: To delete a file, we search the directory for the named file

Truncating a file: The user may want to erase the contents of a file but
Truncating keep its attributes.
The Buffering in File
• A buffer is a region of physical memory
used to store temporary data.

• A region in main memory used to store


intermediate data between disk and
processes
Continuous Allocation
FILE
ALLOCATI Linked Allocation(Non-
ON contiguous allocation)
METHODS
: Indexed Allocation
Continuous A single continuous set of blocks is allocated to
a file at the time of file creation.
Allocation
Thus, this is a pre-allocation strategy, using
variable size portions.

The file allocation table needs just a single entry


for each file, showing the starting block and the
length of the file.
External fragmentation is a major issue with
this type of allocation technique.
Allocation is on an individual block basis.

Each block contains a pointer to the next block in the


chain.

Linked Again the file table needs just a single entry for each file,
showing the starting block and the length of the file.
Allocation(Non-
contiguous Although pre-allocation is possible, it is more common
simply to allocate blocks as needed.
allocation)
Any free block can be added to the chain. The blocks
need not be continuous.

It eliminates External Fragmentation


It addresses many of the problems of
Indexed contiguous and chained allocation.
Allocation In this case, the file allocation table contains
a separate one-level index for each file:
The index has one entry for each block
allocated to the file.
Allocation may be on the basis of fixed-size
blocks or variable-sized blocks.
Allocation by blocks eliminates external
fragmentation
Content and structure
of directories
• A directory is a container that is used to contain
folders and files. It organizes files and folders in a
hierarchical manner.
Structure of • There are several logical structures of a directory
• Single-level directory

Directories • Two-level directory


• Tree-structured directory
Single-level directory
• The single-level directory is the simplest directory structure. In it, all files are contained in
the same directory which makes it easy to support and understand.

• A single level directory has a significant limitation, however, when the number of files
increases or when the system has more than one user. Since all the files are in the same
directory, they must have a unique name.
Two-level directory
• Single level directory often leads to confusion of files names among different users.
•  The solution to this problem is to create a separate directory for each user. 
• In the two-level directory structure, each user has their own user files directory (UFD). 
• The UFDs have similar structures, but each lists only the files of a single user. 
• System’s master file directory (MFD) is searches whenever a new user id=s logged in. 
• The MFD is indexed by username or account number, and each entry points to the UFD
for that user.
Tree-structured directory
• Once we have seen a two-level directory as a tree of height 2, the natural generalization
is to extend the directory structure to a tree of arbitrary height. 
• This generalization allows the user to create their own subdirectories and to organize
their files accordingly.
Partitioning allows the use of different
filesystems to be installed for different kinds
of files.

Separating user data from system data can


Partitionin prevent the system partition from becoming
full and rendering the system unusable.
g
Partitioning can also make backing up easier.
Before you can access the files on a file system,
you need to mount the file system.

Mounting Mounting a file system attaches that file system


and to a directory (mount point) and makes it
available to the system.
Unmounting The root (/) file system is always mounted. Any
File other file system can be connected or
disconnected from the root (/) file system.
Systems The unmounting of a file system removes it
from the file system mount point, and deletes
the entry from the /etc/mnttab file.
• A virtual file system (VFS) is programming that
forms an interface between an operating system's
kernel and a more concrete file system. 
• The VFS serves as an abstraction layer that gives
applications access to different types of file
systems and local and network storage devices.
virtual file
system
A memory mapped file is a disk file that has
Memory been associated to a segment of the virtual
memory space of a process.
mapped It’s useful when you need to manipulate files
file that are too large to fit in memory.

Once mapped you can access the file as if it was


entirely uploaded in memory.

In reality the OS is paging the appropriate part


of the file as you read from the mapped file
pointer.
A special purpose file system is
basically any file system that is not a
disk file system or network file system.
Special
purpose
file This includes systems where the files
are arranged dynamically by software,
systems intended for such purposes as
communication between computer
processes or temporary file space.
A special purpose file system is
basically any file system that is not a
disk file system or network file system.
Special
purpose
file This includes systems where the files
are arranged dynamically by software,
systems intended for such purposes as
communication between computer
processes or temporary file space.
A special purpose file system is
basically any file system that is not a
disk file system or network file system.
Special
purpose
file This includes systems where the files
are arranged dynamically by software,
systems intended for such purposes as
communication between computer
processes or temporary file space.

You might also like