Linux Storage Management: Disks, Partitions, and Filesystems Explained


STORAGE
Storage is unavoidable part of the systems. Decisions you made about data storage have long-term effect on system’s durability, portability, flexibility, and consistency. Therefore, you need to carefully handle any data assets associated with your systems and minimize the risk of any harm.
To understand this well,you need to have a clear understanding of underlying storage, partitioning it and getting it ready for use. Critical Characteristics of storage include these:
Capacity : The total disk space for a storage device.
Input/output operations per second (IOPS) : Measures read and write operations possible; Storage devices can be specialized for read and write operations.
Throughput : Measures the data transfer rate between the application and the filesystem in a specific time interval.
Latency: Measures the response time between an application must wait for a request to complete.
Applications access data with different patterns. So, when deciding how to build systems and what resources to use, you’ll review resources with these characteristics and narrow your options based on your needs.
STORAGE CATEGORIES
Current storage categories are block, file, object, or database. Let’s examine each of these to better understand the underlying storage abstraction layers and the impact on your system design choices.
Block Storage
These are physical storage attached with your systems. It takes any data , like a file or database entry, and divides it into equal size data blocks. These data blocks then stored on underlying physical storage in a manner that is optimized for fast access and retrieval.
Block Storage is ideal when you need to interact with raw storage volumes, whether for the boot drive for a computer, the logical volumes used by virtual machines and containerized images, or data drives used for databases or file storage. In addition, block storage generally has the lowest latency.
File Storage
File Storage is the conventional hierarchical filesystem. It contains folders containing files , each of which has attributes like name, owner, permissions and access dates.
File Storage can be attached with your system physical or Networked. Examples of networked file storage are Samba shares, NFS mounts, or a cloud-hosted service like Dropbox, Google Drive, iCloud Drive, or Microsoft OneDrive.
Object Storage
In contrast to hierarchical file storage, object storage takes an unstructured approach. Each piece of data and associated metadata is stored with a unique identifier that individuals can quickly access on demand. Object storage is appealing when you have a considerable quantity of static items to store and you don’t need to organize individual items in any particular way. So, use object stores for ordinary files: text, images, audio, video, or any other data.
A very common example of Object Storage is AWS S3 .
PARTITIONING
A logical division of storage disk is called Partitioning. You can create one or more independent regions. A disk must have at least one partition. The number of partition depends on needs and requirements. After partitioning the disk, each partition must be put a filesystem. Each single disk can have multiple partitions, and each partition may have different filesystem.
The Disk name on Linux is always start with /dev
something, which is short for device. For example, /dev/sda for hard disk, and /dev/nvme0n1 for Non-Volatile Memory Express. Partitions are the disk name plus a number. If your disk /dev/sda has three partitions, they are /dev/sda1 , /dev/sda2 and /dev/sda3.
FILESYSTEMS
A Filesystem is a method and data structure that an operating system uses to control how data is stored and retrieved on storage devices such as hard drives, SSDs, or USB drives. Without a filesystem, data placed in storage would be a large block of raw data with no way to tell where one piece of information ends and another begins.
The primary roles of a filesystem include:
Data Organization: Arranging files into directories and sub-directories for easy navigation.
Metadata Management: Storing data about data (e.g., timestamps, permissions, file size).
Access Control: Managing which users or processes can access specific files.
Data Integrity: Ensuring that data is stored accurately and can be retrieved without corruption.
Types of Filesystems in Linux
Linux supports several types of filesystems, each with unique features and use cases. Here are some of the most common:
Ext4 (Fourth Extended Filesystem)
Default on many Linux distributions.
Supports large volumes and files (up to 1 EB and 16 TB respectively).
Journaling for quick recovery after crashes.
Reliable and well-tested.
Use case: General-purpose servers and desktops.
XFS
High-performance 64-bit journaling filesystem.
Excellent at handling large files and parallel I/O operations.
Supports dynamic inode allocation and online defragmentation.
Use case: Enterprise systems, media servers, and databases.
Btrfs (B-tree Filesystem)
Advanced features like snapshots, compression, and checksumming.
Supports volume management.
Still maturing, but stable for many workloads.
Use case: Systems requiring advanced data integrity and snapshots.
ZFS
Combines volume management and filesystem features.
Built-in RAID, snapshots, and checksumming for integrity.
Resource-heavy and typically used in storage appliances.
Use case: High-reliability storage solutions and NAS systems.
Creating a Filesystem
To create a filesystem on a partition, you typically use the mkfs
(make filesystem) command.
sudo mkfs.ext4 /dev/sdb1
This formats the partition with the ext4 filesystem. Be cautious—this will erase all data on the specified partition. To label the filesystem
sudo mkfs.ext4 -L mydata /dev/sdb1
Mounting a Filesystem
Once a filesystem is created, it must be mounted to a directory to access it.
Let’s say you have folder /home/biodata and it contains your personal information. You want to mount this data on the /dev/sdb1
filesystem.
1. Ensure the directory exists:
sudo mkdir -p /home/biodata
2. Mount the partition:
sudo mount /dev/sdb1 /home/biodata
Summary
This Article introduces key concepts in Linux storage management, covering storage types, performance metrics, partitioning, and filesystems. It explains block, file, and object storage, and provides an overview of common Linux filesystems like ext4, XFS, Btrfs, and ZFS. Practical steps for creating and mounting filesystems using tools like mkfs
and mount
are also included, helping readers understand how to prepare and manage storage efficiently.
References:
Subscribe to my newsletter
Read articles from KubeCaptain directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
