Operations 46 min read

Master Linux Disk Management: From CHS to LVM and RAID Explained

This comprehensive guide walks you through Linux storage fundamentals, covering CHS terminology, partitioning with MBR/GPT, LVM creation and expansion, RAID levels, file system selection, mounting, swap handling, package management, private YUM repository setup, OSI layers, ports, TCP basics, and IP address classification.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux Disk Management: From CHS to LVM and RAID Explained

CHS Disk Storage Terminology

head: 磁头 (磁头数 = 盘面数)

track: 磁道 (磁道 = 柱面数)

sector: 扇区 (512 bytes)

cylinder: 柱面 (1 柱面 = 512 × sector数/track)

# 查看 CHS
fdisk -l /dev/sda

Disk Storage Management

Advantages of partitioning

Optimizes I/O performance

Enables space quota limits

Improves recovery speed

Isolates system and applications

Allows different file systems

Partition schemes Two schemes: MBR and GPT

MBR Structure

GPT Structure

Summary

MBR: suitable for disks ≤ 2 TB, up to 4 primary partitions, legacy BIOS compatible.

GPT: suitable for disks > 2 TB, up to 128 partitions, provides redundancy, requires UEFI.

Partition Management

List block devices:

# 列出块设备
lsblk

View partition table: # fdisk -l /dev/sda Create partitions (fdisk, gdisk, parted):

# fdisk 管理 MBR 分区
# gdisk 管理 GPT 分区
# parted 高级分区操作

Partition types (primary, extended, logical) and examples are shown with fdisk commands.

File Systems

After creating a partition, a file system must be created to manage files.

File system responsibilities: organize storage, protect, retrieve, control access, logging, compression, encryption.

Creating a file system is analogous to Windows formatting.

Block size can be specified (e.g., 4 KB).

Common Linux file systems:

Ext4 – journaled, up to 1 EB total, 16 TB per file.
XFS – 64‑bit, up to 8 EB, high performance for databases.

Mounting

Mount: associate an additional file system with an existing directory.

Umount: remove the association.

Mount point contents are hidden while mounted.

Mounted devices in use cannot be unmounted.

Mount command options:

mount [options] device mountpoint
-t fstype   # specify file system type (ext4, xfs, ...)
-o ro        # read‑only
-o rw        # read‑write (default)
-o remount   # remount with new options
-B, --bind   # bind mount a directory

Swap (Virtual Memory)

Check swap size: # free -h Disable swap: # swapoff -a Enable swap: # swapon -a Adjust swappiness:

# echo "vm.swappiness = 10" >> /etc/sysctl.conf
sysctl -p

LVM

Basic concepts:

Physical Volume (PV) – underlying disk or partition.

Volume Group (VG) – pool of PVs.

Logical Volume (LV) – virtual partition created from a VG.

Typical workflow:

Create PV

Create VG

Create LV

Format and mount LV

# fdisk /dev/sdb   # create LVM partition (type 8e)
# pvcreate /dev/sdb3
# vgcreate testvg /dev/sdb3
# lvcreate -L 2G -n log_lv testvg
# mkfs.ext4 /dev/testvg/log_lv
# vim /etc/fstab   # add mount entry
# mount -a

Extend logical volume:

# lvextend -l +100%FREE /dev/mapper/testvg/log_lv
# resize2fs /dev/testvg/log_lv

RAID Arrays

# RAID 0 – striping, 100 % utilization, no redundancy, high performance, min 2 disks.
# RAID 1 – mirroring, 50 % utilization, high redundancy, read‑fast, write‑slow, min 2 disks.
# RAID 5 – block + parity, (n‑1)/n utilization, tolerates one disk failure, read‑fast, min 3 disks.
# RAID 10 – mirrored striped sets, 50 % utilization, high redundancy, very high performance, min 4 disks.
# RAID 10 (alternative) – striped mirrored sets, same characteristics.

Package Management

RPM

# Install .rpm
rpm -ivh package.rpm
# Remove package
rpm -e package_name
# Query installed packages
rpm -qa
# Verify integrity
rpm -V package_name

YUM/DNF (CentOS/Rocky)

# Install httpd for private repo
yum install -y httpd
# Create repo directory
mkdir -p /var/www/html/rockylinux/8/{BaseOS,AppStream,extras}
# Sync extras repository
dnf reposync --repoid=extras --download-metadata -p /var/www/html/rockylinux/8/

APT/dpkg (Ubuntu)

# Install .deb
dpkg -i package.deb
# Remove package
dpkg -r package_name
# List installed packages
dpkg -l
# Update package index
apt update
# Upgrade packages
apt upgrade
# Install package
apt install vim curl git

Private YUM Repository Setup

Install Apache or Nginx.

Create repository directory under the web root.

Mount installation media and copy BaseOS, AppStream, extras.

Create .repo files on client machines pointing to the server.

Run yum clean all and yum makecache to refresh metadata.

OSI Seven‑Layer Model

Physical – cables, Ethernet, Wi‑Fi.

Data Link – Ethernet, PPP, HDLC.

Network – IP, ICMP, ARP.

Transport – TCP, UDP.

Session – NetBIOS, RPC, TLS.

Presentation – JPEG, MPEG, TLS.

Application – HTTP, FTP, DNS, SMTP.

Linux Port Overview

Port ranges: 0‑1023 system, 1024‑49151 registered, 49152‑65535 dynamic.

Common commands:

# List listening TCP ports
netstat -tuln
# Add firewall rule (firewalld)
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --reload

TCP Overview

Key features: connection‑oriented, three‑way handshake, flow control, congestion control, error checking.

Three‑way handshake:

SYN from client.

SYN‑ACK from server.

ACK from client – connection established.

Four‑step termination:

FIN from client.

ACK from server.

FIN from server.

ACK from client – connection closed.

IP Address Classification

Class A: 0.0.0.0‑127.255.255.255, /8 mask.

Class B: 128.0.0.0‑191.255.255.255, /16 mask.

Class C: 192.0.0.0‑223.255.255.255, /24 mask.

Class D: 224.0.0.0‑239.255.255.255 – multicast.

Class E: 240.0.0.0‑255.255.255.255 – reserved.

Example calculation for 201.222.200.111/18:

Subnet mask: 255.255.192.0
Host bits: 14 → 2^14‑2 = 16382 usable hosts

Example: A (10.0.1.1/16) vs B (10.0.2.2/24) – different network addresses, so they are not in the same subnet, but can communicate via routing.

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.

LinuxSystem AdministrationLVMRAIDdisk-management
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

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.