3 - File System Structure
3 - File System Structure
Introduction:
• A computer file is defined as a medium used for saving and managing data in the
computer system. The data stored in the computer system is completely in digital
format, although there can be various types of files that help us to store the data.
• File system implementation in an operating system refers to how the file system
manages the storage and retrieval of data on a physical storage device such as a
hard drive, solid-state drive, or flash drive.
• File system provide an efficient and convenient access to the disk by allowing
data to be stored, located and retrieved easily.
• To improve I/O efficiency, I/O transfers between memory and disk are performed
in units, called blocks. Each block has one or more sectors, whose size varies
between 32 bytes to 4096 bytes.
• File systems are maintained on disks as they are convenient in the following ways:
• A disk can be re-written in-place-- it possible to read /modify/write it back file into the same
place
• A disk can access any block of information ,directly.—we can access either sequentially or
randomly.
Design problems of File system
• To define how the file system must look to the user
• This involves defining a file and its attributes , the operation allowed on a file and the
directory structure to organize the files.
• To create algorithms and data structures to map the logical file system onto the
physical secondary-storages devices.
<<optional>>
The file system implementation includes several components, including:
• File System Structure: The file system structure refers to how the files and directories
are organized and stored on the physical storage device. This includes the layout of file
systems data structures such as the directory structure, file allocation table, and inodes.
• File Allocation: The file allocation mechanism determines how files are allocated on
the storage device. This can include allocation techniques such as contiguous allocation,
linked allocation, indexed allocation, or a combination of these techniques.
• Data Retrieval: The file system implementation determines how the data is read from
and written to the physical storage device. This includes strategies such as buffering and
caching to optimize file I/O performance.
• Security and Permissions: The file system implementation includes features for
managing file security and permissions. This includes access control lists (ACLs), file
permissions, and ownership management.
• Recovery and Fault Tolerance: The file system implementation includes features for
recovering from system failures and maintaining data integrity. This includes techniques
such as journaling and file system snapshots.
Why is it important?
• File system implementation is a critical aspect of an operating system as it directly
impacts the performance, reliability, and security of the system.
• Different operating systems use different file system implementations based on
the specific needs of the system and the intended use cases.
• Some common file systems used in operating systems include NTFS and FAT in
Windows, and ext4 and XFS in Linux
How file system is implemented? //
components
• Basic file system – It Issues general commands to the appropriate device driver to read and write
physical blocks on disk. It manages the memory buffers and caches. A block in the buffer can hold the
contents of the disk block and the cache stores frequently used file system metadata.
• File organization Module – It has information about files, (the location of files) and their logical and
physical blocks. Physical blocks do not match with logical numbers of logical blocks numbered from
0 to N. file organization module translates logical block address to physical block address for the
basic file system to transfer .It also has a free space manager that tracks unallocated blocks .
• Logical file system – It manages metadata information about a file i.e includes all details about a file
except the actual contents of the file. It manages the directory structure’s information required for file
organization module. It also maintains file structure -via file control blocks. File control block (FCB)
has information about a file – owner, size, permissions, and location of file contents.
Advantages