Linux Disk Management – Understanding Linux Storage
Applications, databases and services depend on reliable storage[cite: 20]. In this chapter, you'll learn how Linux organizes disks, partitions, filesystems and mount points, forming the foundation for advanced storage administration and LVM[cite: 20].
🎯 Learning Objectives
- Understand Linux storage architecture[cite: 20].
- Identify common Linux storage devices[cite: 20].
- Learn MBR and GPT partition tables[cite: 20].
- Compare common Linux filesystems[cite: 20].
- Understand mount points and storage inspection tools[cite: 20].
📋 Prerequisites
Complete Chapters 1–6 before continuing[cite: 20].
1. Introduction
Linux stores application data on physical or virtual storage devices[cite: 20]. Before creating filesystems or Logical Volumes, it is important to understand how disks are organized and presented to the operating system[cite: 20].
2. Linux Storage Architecture
Physical Disk ──► Partition Table ──► Partitions ──► Filesystem ──► Mount Point ──► Applications[cite: 20]
Each layer builds upon the previous one, allowing Linux to organize and access persistent storage efficiently[cite: 20].
3. Linux Storage Device Naming
/dev/sda
/dev/sdb
/dev/nvme0n1
/dev/vda
| Device | Typical Usage |
|---|---|
| /dev/sdX | SATA, SAS or SCSI disks[cite: 20]. |
| /dev/nvme0n1 | NVMe SSD devices[cite: 20]. |
| /dev/vdX | Virtual machine disks[cite: 20]. |
4. Partition Tables
| Feature | MBR | GPT |
|---|---|---|
| Maximum Disk Size | ~2 TB[cite: 20] | >2 TB[cite: 20] |
| Primary Partitions | 4[cite: 20] | 128 (typical)[cite: 20] |
| Modern Systems | Limited[cite: 20] | Recommended[cite: 20] |
GPT is the preferred partition table format for modern Linux systems because it supports larger disks and more partitions[cite: 20].
5. Common Linux Filesystems
| Filesystem | Typical Use |
|---|---|
| ext4 | General-purpose Linux filesystem[cite: 20]. |
| XFS | Large filesystems and enterprise servers[cite: 20]. |
| Btrfs | Snapshots and advanced features[cite: 20]. |
| FAT32 | Portable removable media[cite: 20]. |
| NTFS | Windows compatibility[cite: 20]. |
6. Viewing Storage Devices
lsblk
blkid
fdisk -l
parted -l
| Command | Purpose |
|---|---|
| lsblk | Display block devices[cite: 20]. |
| blkid | Show UUID and filesystem type[cite: 20]. |
| fdisk -l | List partition tables[cite: 20]. |
| parted -l | Display disk and partition information[cite: 20]. |
7. Understanding Mount Points
Disk ──► Partition ──► Filesystem ──► Mounted on ──► /data[cite: 20]
A mount point is the directory where a filesystem becomes accessible within the Linux directory tree[cite: 20].
8. Linux vs IBM AIX
| Linux | IBM AIX |
|---|---|
| lsblk[cite: 20] | lspv[cite: 20] |
| blkid[cite: 20] | lsvg / lslv[cite: 20] |
| mount[cite: 20] | mount (different options)[cite: 20] |
9. Hands-on Practice
- List block devices using
lsblk[cite: 20]. - Display filesystem UUIDs using
blkid[cite: 20]. - View partition information using
fdisk -l[cite: 20]. - Identify mounted filesystems[cite: 20].
- Determine whether your system uses GPT or MBR[cite: 20].
10. Common Mistakes
- Confusing disks with partitions[cite: 20].
- Formatting the wrong device[cite: 20].
- Ignoring UUIDs for persistent mounts[cite: 20].
- Assuming every filesystem behaves the same[cite: 20].
11. Part 1 Summary
📌 Key Takeaways
- Linux storage consists of disks, partitions, filesystems and mount points[cite: 20].
- GPT is the preferred partition table for modern systems[cite: 20].
- ext4 and XFS are widely used Linux filesystems[cite: 20].
- Use
lsblk,blkid,fdisk -landparted -lto inspect storage[cite: 20].
12. Creating Partitions with fdisk
fdisk is commonly used to create and manage MBR and GPT partitions on Linux systems[cite: 20]. Toggles inside the interactive menu include:
fdisk /dev/sdb
m # help[cite: 20]
n # new partition[cite: 20]
p # print table[cite: 20]
w # write changes[cite: 20]
q # quit without saving[cite: 20]
13. Partitioning with parted
parted is recommended for modern GPT disks and large storage devices[cite: 20].
parted /dev/sdb
print[cite: 20]
mklabel gpt[cite: 20]
mkpart primary ext4 1MiB 100%[cite: 20]
quit[cite: 20]
14. Creating Filesystems (mkfs)
mkfs.ext4 /dev/sdb1
mkfs.xfs /dev/sdb1
mkfs -t ext4 /dev/sdb1
| Command | Purpose |
|---|---|
| mkfs.ext4 | Create an ext4 filesystem[cite: 20]. |
| mkfs.xfs | Create an XFS filesystem[cite: 20]. |
| mkfs -t | Create a filesystem using the specified type[cite: 20]. |
15. Removing Filesystem Signatures (wipefs)
wipefs /dev/sdb1
wipefs -a /dev/sdb1
wipefs removes filesystem signatures so a device can be reused safely[cite: 20].
16. Checking & Repairing Filesystems (fsck, xfs_repair)
fsck /dev/sdb1
fsck.ext4 /dev/sdb1
xfs_repair /dev/sdb1
| Tool | Target Filesystem |
|---|---|
| fsck / fsck.ext4 | ext4[cite: 20] |
| xfs_repair | XFS[cite: 20] |
17. Mounting Filesystems & Persistent Mounts
mount /dev/sdb1 /data
umount /data
The /etc/fstab file handles automatic boot mounts[cite: 20]. Write absolute UUID entries to avoid naming drift, and always test files using mount -a before triggering system reboots[cite: 20].
UUID=1234-ABCD /data ext4 defaults 0 2[cite: 20]
18. Logical Volume Manager (LVM)
Disk ──► Physical Volume (PV) ──► Volume Group (VG) ──► Logical Volume (LV) ──► Filesystem ──► Mount Point[cite: 20]
LVM provides flexible storage allocations, allowing online filesystem updates[cite: 20]. Management triggers include[cite: 20]:
pvcreate /dev/sdb1 # Setup a Physical Volume[cite: 20]
vgcreate vgdata /dev/sdb1 # Setup a Volume Group[cite: 20]
lvcreate -L 20G -n lvdata vgdata # Carve out a Logical Volume[cite: 20]
Extend allocations via lvextend -L +10G /dev/vgdata/lvdata, and expand the file structure online using resize2fs (for ext4) or xfs_growfs (for XFS layouts)[cite: 20].
19. Common Production Storage Problems
| Problem Context | Possible Root Cause | Useful Commands |
|---|---|---|
| Filesystem Full | Storage capacity exhausted | df -h, du -sh *[cite: 20] |
| Read-only Filesystem | Internal block structure metadata errors | mount, dmesg, fsck[cite: 20] |
| Mount Failed | Invalid or corrupted fstab configuration line | mount -a, blkid[cite: 20] |
Commands Covered in This Chapter
lsblk- Display detailed block device topologies[cite: 20]blkid- Show unique device UUIDs and filesystem type signatures[cite: 20]fdisk/parted- Disk layout partition generators[cite: 20]mkfs- Construct filesystems over raw devices[cite: 20]wipefs- Remove old filesystem signature tables[cite: 20]fsck/xfs_repair- Audit and restore damaged partition structures[cite: 20]mount/umount- Bind or detach active storage sectors[cite: 20]pvcreate/vgcreate/lvcreate- Structural LVM environment triggers[cite: 20]lvextend/xfs_growfs/resize2fs- Dynamic online storage capacity expanders[cite: 20]df/du- Space allocation monitoring logs[cite: 20]