1. Introduction

When you view a file in an operating system, you see much more than its actual content. Information such as:

  • File name

  • File size

  • File type

  • Permissions

  • Owner

  • Date modified

is not part of the file's actual data.

This information is called metadata.

Metadata is data about data.

In operating systems, file attributes are stored separately from file content and are essential for:

  • File access

  • Security

  • Storage management

  • Performance optimization

2. What are File Attributes?

File attributes are metadata associated with a file that describe its properties, ownership, location, permissions, and status.

Key Idea

File = Data + Attributes (Metadata)

Important Insight

The operating system relies heavily on file attributes rather than scanning file contents.

Attributes enable efficient:

  • Searching

  • Access control

  • Resource management

3. Where are File Attributes Stored?

File attributes are maintained in a special operating system structure.

File Control Block (FCB)

Most operating systems store metadata in a:

File Control Block (FCB)

UNIX/Linux: inode

UNIX-like systems use:

inode

instead of a traditional FCB.

Important Structure

Directory
     ↓
 inode
     ↓
Disk Blocks

Key Insight

The directory stores file names.

The inode stores file metadata.

The actual data resides in disk blocks.

4. Core File Attributes

4.1 File Name

The file name is the human-readable identifier of a file.

Example:

report.txt

Characteristics

  • Used by users and applications

  • Stored in the directory

  • Not stored inside the inode

Why?

Separating names from metadata allows:

  • Multiple names for the same file (hard links)

  • Flexible file management

4.2 File Identifier (Unique ID)

Every file has an internal identifier used by the operating system.

Examples:

inode number

or

file ID

Purpose

  • Uniquely identifies files

  • Faster lookup than searching by file name

  • Used internally by the OS

Key Insight

The operating system primarily works with file IDs, not file names.

4.3 File Type

Indicates how the file should be interpreted.

Common file types:

  • Text files

  • Binary files

  • Executable files

  • Directory files

  • Device files

Examples

.txt
.exe
.pdf

Important Insight

The operating system generally treats files uniformly.

Applications determine how to interpret file contents.

4.4 File Size

Stores the length of the file.

Usually measured in:

Bytes

Uses

  • Disk allocation

  • Memory management

  • Storage accounting

Example:

Size = 2048 Bytes

4.5 File Location

The operating system must know where the file data resides on storage devices.

Instead of storing data contiguously, modern systems use pointers.

Types of Block Pointers

Direct Pointers

Point directly to data blocks.

Indirect Pointers

Point to blocks containing additional pointers.

Double Indirect Pointers

Point to blocks that contain indirect pointers.

Purpose

Allows files to:

  • Grow dynamically

  • Occupy non-contiguous disk space

  • Support very large file sizes

4.6 Permissions (Very Important)

Permissions determine who can access a file and how.

Permission Types

PermissionMeaning
rRead
wWrite
xExecute

Example

-rwxr-xr--

Breakdown

User CategoryPermission
Ownerrwx
Groupr-x
Othersr--

Key Insight

Permissions enforce:

  • Security

  • Protection

  • Controlled sharing

4.7 Timestamps

Operating systems maintain several timestamps for each file.

Creation Time

When file was created.

Modification Time

When file content was last changed.

Access Time

When file was last read or accessed.

Uses

  • Backup systems

  • Synchronization tools

  • Cache management

  • Auditing

4.8 Owner and Group

Every file has an associated:

  • Owner (User)

  • Group

Purpose

Used for:

  • Permission checking

  • Access control

  • Security policies

Example:

Owner = Alice

Group = Developers

4.9 Link Count (Advanced)

The link count stores the number of references to a file.

Example

Link Count = 3

means three directory entries refer to the same inode.

UNIX Insight

A file is physically deleted only when:

Link Count = 0

and no process is currently using it.

5. inode Structure (Conceptual View)

A typical inode stores:

inode

├── File ID
├── File Size
├── Permissions
├── Owner ID
├── Group ID
├── Timestamps
├── Link Count
├── Direct Pointers
├── Indirect Pointers
└── Double Indirect Pointers

Important Note

The file name is not stored in the inode.

6. How the Operating System Uses File Attributes

Consider opening a file.

Step 1: Path Lookup

The OS searches the directory structure.

Example:

/home/user/file.txt

Step 2: Locate inode

The directory entry provides:

inode number

Step 3: Load Metadata

The inode is loaded into memory.

Step 4: Permission Verification

The OS checks:

  • Read permission

  • Write permission

  • Execute permission

Step 5: Access Data

Using block pointers, the OS locates the actual file blocks.

Key Insight

File access is metadata-driven rather than name-driven.

7. Why File Attributes Matter

7.1 Performance

Metadata enables:

  • Fast lookups

  • Efficient indexing

  • Reduced disk searching

7.2 Security

Permissions prevent unauthorized access.

7.3 Storage Management

Attributes help the OS:

  • Track disk usage

  • Allocate blocks

  • Manage files efficiently

7.4 Reliability

Metadata supports:

  • Recovery mechanisms

  • Backup systems

  • Consistency checks

8. Real-World Analogy

Think of a library.

Book

Represents:

File Data

Library Catalog

Represents:

File Attributes

When searching for a book, librarians use the catalog rather than reading every book.

Similarly, operating systems use metadata rather than scanning file contents.

File attributes are the foundation of file management in operating systems. They allow the OS to efficiently locate files, enforce security policies, manage storage, and provide reliable access to persistent data without examining the actual file contents.