File and File system
- Abhilasha
- Jul 11, 2024
- 2 min read
File and File System Explained
File
A file is a collection of data stored on a storage medium, such as a hard disk or SSD. It can be anything from a text document, a program executable, to multimedia files like images and videos. Each file is identified by a unique name and typically has properties such as size, creation date, and permissions.
Attributes of a File:
Name: Unique identifier of the file.
Size: Amount of storage space the file occupies.
Location: Address on the storage medium where the file is stored.
Type: Nature of data stored in the file (text, executable, image, etc.).
Permissions: Access rights determining who can read, write, or execute the file.
File System
A file system is a method used by operating systems to manage files and directories on a storage device. It provides a structured way to store, retrieve, and organize files. Different file systems have varying structures and capabilities, suited to different needs and types of storage media.
Components of a File System
Boot Block / Boot Sector: Information required to boot the operating system from the disk.
Superblock: Contains metadata about the entire file system, including size, maximum number of files, and free blocks.
Inode List: Index nodes that store metadata about each file, such as permissions, owner, size, and location on disk.
Block List: Data blocks where the actual file content is stored.
Types of File Systems
FAT (File Allocation Table):
Simple file system dating back to the 1980s.
Uses a File Allocation Table to track which areas of the disk are in use or available.
Comes in variants like FAT12, FAT16, and FAT32, based on the size of entries in the File Allocation Table.
NTFS (New Technology File System):
Developed by Microsoft for Windows NT and later versions.
Supports large storage volumes and offers features like file compression, encryption, and access control.
Uses a Master File Table (MFT) to store metadata about all files and directories.
ext2, ext3, ext4 (Extended File System):
Commonly used in Linux distributions.
Supports larger file sizes and volumes compared to older file systems like ext2.
Provides features such as journaling for data integrity (ext3 and ext4) and support for extended attributes.
Functionality of a File System
Storage Management: Allocates space on the disk for files and manages free space.
Data Organization: Organizes files into directories or folders for easier management and retrieval.
Data Access: Controls how files are accessed and ensures data integrity.
File Naming: Assigns unique names to files for identification and retrieval.
Summary
In essence, a file system is essential for organizing and managing data on storage devices, ensuring that files are stored efficiently, accessed securely, and retrieved reliably. Different file systems offer varying features and capabilities to meet diverse user needs and system requirements.
Comments