--> Sayadasite: File Systems and Storage Management

Multiple Ads

Search

Menu Bar

File Systems and Storage Management

(Click to go DiskScheduling Algorithms)

File Systems and Storage Management is a core topic in operating systems that deals with how data is stored, organized, accessed, and managed on storage devices like hard drives, SSDs, USB drives and other media. A file system acts as a bridge between the operating system and physical storage, providing a structured way to manage files and directories.

File System Concepts:

1. File System Basics

A file system is a method used by an operating system to store and organize files on a storage device.

Key Concepts:

File: A collection of data (text, images, programs, etc.)

Directory (Folder): A container used to organize files

Path: Location of a file in the system (e.g., /home/user/file.txt)

Common File Systems:

1 NTFS (Windows NT/10/11) New Technology File System is Microsoft's proprietary, high-performance journaling file system, introduced in 1993 and used as the default for modern Windows NT/10/11 operating systems.

2 FAT32 / exFAT : (File Allocation Table 32) is a widely compatible 32-bit file system used for USB drives, SD cards, and external drives, ensuring seamless operation across Windows, Mac, Linux, and gaming consoles. 

exFAT (Extended File Allocation Table) is a Microsoft-designed file system introduced in 2006, optimized for flash memory like USB drives and SD cards.

3 ext4 (Linux) : Ext4 (Fourth Extended File system) is a high-performance, journaling filesystem designed for Linux, supporting volumes up to 1 EiB and files up to 16 TiB (EiB:European Installation Bus/ Edge Image Builder (EIB), TiB: A Tebibyte (TiB) is a unit of digital data storage using binary prefixes (bytes), equal to GiB or approximately Terabytes (TB).)4 APFS (macOS)

2. File System Structure

A file system is typically divided into layers:

Logical File System: Manages metadata (file names, permissions)

File Organization Module: Handles file allocation

Basic File System: Sends commands to storage devices

I/O Control Layer: Interacts with hardware

File Attributes

File attributes are the properties or metadata that describe a file and help the operating system manage it efficiently.

Common File Attributes

1. Name

The identifier of the file.

Example: report.txt

2. Identifier (File ID)

A unique number assigned by the operating system.

Used internally to distinguish files.

3. Type

Indicates the kind of file.

Examples:

Text file (.txt)

Image file (.jpg)

Executable file (.exe)

4. Location

Specifies where the file is stored on the storage device.

Includes pointers to disk blocks.

5. Size

The current size of the file (in bytes, KB, MB, etc.).

6. Protection (Permissions)

Controls who can access the file and what actions are allowed.

Examples:

Read (R)

Write (W)

Execute (X)

7. Time, Date, and User Identification

Tracks file activity:

Creation time

Last modification time

Last access time

User/owner ID

8. Flags (Status Information)

Special attributes that indicate file state.

Examples:

Hidden

Read-only

System file

Archive

Summary Table

Attribute

Description

Name

File name

Identifier

Unique internal ID

Type

File format/type

Location

Storage address

Size

File size

Protection

Access permissions

Time & Date

File activity timestamps

Flags

Special status indicators

File Operations

File Operations are basic actions you can perform on files in an operating system or in programming. They are very important in subjects like Operating Systems and programming (C, Python, etc.).

Common File Operations

1. Create a File

Making a new file.

Example: Creating a .txt or .c file.

2. Open a File

Used to access a file for reading or writing.

Modes (in C language):

"r" → Read

"w" → Write

"a" → Append

3. Read from a File

Getting data from a file.

Example: Reading text stored in a file.

 

4. Write to a File

Storing data into a file.

Overwrites existing content (in "w" mode).

5. Append to a File

Adds data at the end without deleting existing content.

6. Close a File

Releases the file after use.

Important to prevent data loss.

File Types,

File types define the nature, structure, and purpose of data stored in a file. Operating systems use file types to determine how to handle and process files.

1. Basic Classification of File Types

1. Regular Files

Most common type

Store user data (text, programs, multimedia)

Examples:

.txt, .docx, .jpg, .mp4, .exe

2. Directory Files

Contain information about other files and directories

Help organize the file system

Example: A folder containing documents and images

3. Special Files (Device Files)

Used to interact with hardware devices.

Types:

Character Special Files

Handle data as a stream of characters

Example: keyboard, mouse

Block Special Files

Handle data in blocks

Example: hard disk, USB drive

2. File Types Based on Content

1. Text Files

Store data in readable form (ASCII/Unicode)

Can be opened in editors

Examples:

.txt, .html, .xml, .csv

2. Binary Files

Store data in machine-readable format

Not human-readable

Examples:

.exe, .bin, .dat

3. File Types Based on Usage

1. Source Files

Contain program code

Need compilation/interpreting

Examples:

.c, .cpp, .java, .py

2. Object Files

Intermediate compiled code

Example:

.o, .obj

3. Executable Files

Ready-to-run programs

Examples:

.exe, .out

4. Multimedia File Types

Audio: .mp3, .wav

Video: .mp4, .avi

Image: .jpg, .png, .gif

5. System-Specific File Types

Different operating systems support special file types:

Linux/Unix:

1.    Regular files

2.    Directory files

3.    Device files

4.    FIFO (named pipes)

5.    Sockets

Windows:

1.    .dll (Dynamic Link Library)

2.    .sys (System files)

File Extensions

Suffix added to file name

Helps identify file type

Example:

report.pdf → PDF document

image.png → Image file

Importance of File Types

Determines how a file is opened

Helps OS choose appropriate program

Ensures proper data handling

Improves system organization

Summary

File types classify files based on:

Structure (regular, directory, special)

Content (text, binary)

Usage (source, executable)

File Access Methods (Sequential, Indexed, Direct),

1. Sequential Access

Data is accessed in order, one record after another.

Similar to listening to a song playlist from start to end.

To reach a specific record, all previous records must be read first.

Key Features:

Simple and efficient for linear processing

Cannot skip directly to a desired record

Common in tape storage systems

Example:

Reading a log file line by line

Streaming media

2. Indexed Access

Uses an index (like a table of contents) to locate data quickly.

The index stores pointers to the actual records.

Key Features:

Faster than sequential access

Allows both sequential and random access

Requires extra storage for the index

Example:

Database systems using indexes

Library catalog systems

3. Direct (Random) Access

Data can be accessed directly without reading preceding records.

Each record has a unique address or key.

Key Features:

Very fast access

No need to read data in order

Suitable for applications requiring quick retrieval

Example:

Accessing a specific file on a hard disk

RAM operations

Comparison Table

Feature

Sequential Access

Indexed Access

Direct Access

Access Method

Linear

Via index

Direct by address

Speed

Slow

Medium

Fast

Flexibility

Low

High

Very High

Storage Overhead

Low

Medium (index needed)

Low

Use Case

Logs, tapes

Databases

Disk, RAM

Directory Structure & Disk Scheduling,

In computer systems, directory structure refers to the way in which files are organized in the file system. It provides a hierarchical way to store and locate files, making file management easier. The structure typically consists of directories (also called folders) and subdirectories, which hold files or other directories.

Directory Structures

Different ways to organize files:

Single-Level,

  • Single-Level Directory: All files are stored in one directory.
  • Simple, but becomes cumbersome as the number of files increases.

Example:

/home/user/files/

Two-Level,

  • Two-Level Directory: One directory for user files, and each user has their own directory.
  • A basic hierarchy of organization.

Example:

/home/user1/file1.txt
/home/user2/file2.txt

Hierarchical,

Tree Structure: Hierarchical (most common)

Ø  This is the most common structure, where directories are nested inside other directories, forming a tree-like structure.

Ø  Allows for better file organization and management, especially in large systems.

Example:

/home/user/
    
── Documents/
    
── Pictures/
    
── Downloads/
     └── Music/

Graph Directory Structure

Graph Structure Acyclic Graph (AG): Allows shared files

Ø     More advanced structure where directories can have links to files or other directories in multiple locations.

Ø  File systems like Unix use symbolic links (symlinks) which can create cyclic or acyclic references.

No comments: