Operations 8 min read

Mastering Disk Structure, Partitioning, and Filesystem Management on Linux

This guide explains the physical and logical structure of hard disks, reasons and methods for partitioning, various filesystem types, and essential Linux commands such as fdisk, mkfs, mount, umount, df, and fstab for managing and automating disk usage.

Raymond Ops
Raymond Ops
Raymond Ops
Mastering Disk Structure, Partitioning, and Filesystem Management on Linux

1. Disk Structure

1. Physical Structure

Disk platters: a hard drive contains multiple platters, each with two usable surfaces.

Read/write heads: each surface has one head.

2. Data Structure

Sector: the smallest storage unit, 512 bytes per sector.

Cylinder: group of tracks aligned vertically across platters.

Image
Image

3. Disk Interface Types

Image
Image

4. HDD vs. SSD

Image
Image
Image
Image

2. Disk Partitioning

1. Why Partition

Optimize I/O performance

Implement disk quota limits and improve recovery speed

Isolate system files from applications

Allow multiple operating systems

Use different filesystem types

2. Partition Types

Image
Image

Extended partitions cannot be used directly; they must be divided into logical partitions.

3. Partition Structure

Only four primary partitions are allowed.

Primary and extended partition numbers are limited to 1–4.

Extended partitions are further divided into logical partitions.

Logical partition numbers start from 5.

3. Filesystems

XFS Filesystem

Stores files and directory data

High‑performance journaling filesystem

Default on CentOS 7 and supports data recovery

SWAP (swap filesystem)

Creates a swap partition for Linux

Other Linux‑supported Filesystem Types

FAT16, FAT32, NTFS

EXT4, JFS

disk command

View or manage disk partitions fdisk -l [disk_device] or

fdisk [disk_device]

fdisk -l Output Fields

Device: partition device file name

Boot: indicates a boot partition (marked with "*")

Start: starting cylinder

End: ending cylinder

Blocks: size in blocks (default 1024 bytes per block)

Id: system ID (83 = Linux XFS/EXT4, 8e = LVM)

System: partition type

Interactive Mode Commands

m, p, n, d, t, w, q

mkfs Command

Make Filesystem – creates (formats) a filesystem

Image
Image

Boot (boot) partition is used to start the system; it is marked with "*".

Image
Image
Image
Image

echo "- - -" > /sys/class/scsi_host/host2/scan

Scan the SCSI bus without rebooting.

Change partition type

Image
Image

Delete partition

Image
Image
Image
Image

Steps: partition → format → create mount point → mount

Image
Image

UUID is a unique identifier.

Image
Image

4. Mounting and Unmounting Filesystems

mount Command

Mount a filesystem or ISO image to a specified directory

mount [-t type] device mount_point
mount -o loop iso_image mount_point

umount Command

Unmount a mounted filesystem

umount device
umount mount_point

The above are temporary mounts.

Configure Automatic Mounting

In /etc/fstab each line records a partition’s mount configuration with six fields. /dev/sdb1 / xfs defaults 0 0 Field 1: device name or label

Field 2: mount point directory

Field 3: filesystem type (e.g., xfs, swap)

Field 4: mount options (defaults, rw, ro, noexec, etc.)

Field 5: dump backup flag (1 = backup, 0 = ignore)

Field 6: fsck order (0 = no check, 1 = first, 2 = second)

Adding entries to /etc/fstab enables automatic mounting at boot, e.g., for /dev/sdb1.

Check Disk Usage

df Command

df [options] [file]
[root@localhost ~]# df -hT
Filesystem               Type   Size  Used  Avail Use% Mounted on
/dev/mapper/VolGroup-Lv_root ext4 6.7G 4.1G 2.3G  65% /
/dev/sda1                ext4  99M  11M   83M 12% /boot
tmpfs                    tmpfs 252M   0  252M   0% /dev/shm
/dev/sdb1                ext4  19G 173M   18G   1% /mailbox
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

FilesystemMountdiskfdiskfstab
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.