Home Blog Projects Tags About Friends

What is a file system?

A file system is a **structure and set of rules used to manage data on storage devices**. You can think of a file system as: > 💼 A "super document management system" that records the location, size, name, and permissions of every file, and determines how we read and write them. A device without a file system (such as a new hard drive) cannot be operated...

· 3 min read

✅ What is a File System?

A file system is a set of structures and rules used to manage data on storage devices. You can think of it as:

💼 A “super document management system” that records metadata such as file location, size, name, and permissions, and defines the specific methods the operating system uses to read and write these files.

If a storage device (such as a new hard drive) does not have a file system, the operating system cannot recognize its internal structure and, therefore, cannot store or read data.


✅ What is Formatting?

Formatting refers to:

🎨 The process of creating a file system on a storage device (such as a hard drive or USB flash drive).

For example:

• Formatting a hard drive to ext4 means building an ext4 file system on that drive.

• It is important to note that formatting typically wipes existing data (or marks it as available for overwriting).


✅ What is Mounting?

Mounting refers to:

📎 The process of “attaching” a file system to the directory tree of an operating system.

For example, when you plug in an external hard drive (device name /dev/sdb1) and want to access it via the /mnt/data directory, you need to execute the following command:

mount /dev/sdb1 /mnt/data

Once mounted, you can access the data on the hard drive just like a local folder.


✅ Deep Dive: ext4 vs. xfs

ext4 and xfs are the two most mainstream file systems in Linux, each with different performance focuses:

File SystemDescription
ext4The default Linux file system; offers excellent compatibility and stable performance, suitable for most general-purpose scenarios.
xfsDesigned for large files and high throughput; supports high concurrency, making it ideal for databases and big data processing.

Key Advantages of ext4: • Supports journaling, effectively preventing data loss during power outages. • Supports storage capacities up to 1 EB, with a maximum single-file size of 16 TB. • Features delayed allocation to help optimize disk space utilization.

Key Advantages of xfs: • Superior high-concurrency read/write performance. • Supports online file system resizing (ext4 only supports expansion, not shrinking). • Better suited for enterprise-level applications, such as database storage and high-load log servers.


🎯 Workflow Overview

flowchart TD
    A[New Hard Drive] --> B[Format as ext4/xfs, etc.]
    B --> C[Mount to a specific path]
    C --> D[OS can read/write files]

🔧 Practical Demonstration (Linux)

# List all storage devices
lsblk

# Format the device to an ext4 file system
sudo mkfs.ext4 /dev/sdb1

# Create a mount point directory
sudo mkdir /mnt/mydisk

# Perform the mount
sudo mount /dev/sdb1 /mnt/mydisk

# Verify if the mount was successful
df -h
All Posts