Applications, databases and services depend on reliable storage. In this chapter, you'll learn how Linux organizes disks, partitions, filesystems and mount points, forming the foundation for advanced storage administration and LVM.
Learning Objectives
- Understand Linux storage architecture and device naming.
- Create partitions with fdisk and parted.
- Create filesystems with mkfs and manage LVM volumes.
- Know when to use UUIDs; persist mounts in Chapter 9.
Prerequisites
Complete Chapters 1–6 before continuing.
1. Introduction
Linux stores application data on physical or virtual storage devices. Before creating filesystems or Logical Volumes, it is important to understand how disks are organized and presented to the operating system.
2. Linux Storage Architecture
Physical Disk ──► Partition Table ──► Partitions ──► Filesystem ──► Mount Point ──► Applications
Each layer builds upon the previous one, allowing Linux to organize and access persistent storage efficiently.
3. Linux Storage Device Naming
/dev/sda
/dev/sdb
/dev/nvme0n1
/dev/vda
| Device | Typical Usage |
|---|---|
| /dev/sdX | SATA, SAS or SCSI disks. |
| /dev/nvme0n1 | NVMe SSD devices. |
| /dev/vdX | Virtual machine disks. |
4. Partition Tables
| Feature | MBR | GPT |
|---|---|---|
| Maximum Disk Size | ~2 TB | >2 TB |
| Partition slots (typical) | 4 primary (or 3 primary + extended) | ~128 entries; no primary/extended types |
| Modern Systems | Limited | Recommended |
GPT is the preferred partition table format for modern Linux systems because it supports larger disks and more partitions.
5. Common Linux Filesystems
| Filesystem | Typical Use |
|---|---|
| ext4 | General-purpose Linux filesystem. |
| XFS | Large filesystems and enterprise servers. |
| Btrfs | Snapshots and advanced features. |
| FAT32 | Portable removable media. |
| NTFS | Windows compatibility. |
6. Viewing Storage Devices
lsblk
blkid
fdisk -l
parted -l
| Command | Purpose |
|---|---|
| lsblk | Display block devices. |
| blkid | Show UUID and filesystem type. |
| fdisk -l | List partition tables. |
| parted -l | Display disk and partition information. |
7. Understanding Mount Points
Disk ──► Partition ──► Filesystem ──► Mounted on ──► /data
A mount point is the directory where a filesystem becomes accessible within the Linux directory tree.
8. Linux vs IBM AIX
| Linux | IBM AIX |
|---|---|
| lsblk | lspv |
| blkid | lspv / lsfs (device and FS identity; not lsvg/lslv) |
| mount | mount (different options) |
9. Hands-on Practice
- List block devices using
lsblk. - Display filesystem UUIDs using
blkid. - View partition information using
fdisk -l. - Identify mounted filesystems.
- Determine whether your system uses GPT or MBR.
10. Common Mistakes
- Confusing disks with partitions.
- Formatting the wrong device.
- Ignoring UUIDs for persistent mounts.
- Assuming every filesystem behaves the same.
11. Part 1 Summary
Key Takeaways
- Linux storage consists of disks, partitions, filesystems and mount points.
- GPT is the preferred partition table for modern systems.
- ext4 and XFS are widely used Linux filesystems.
- Use
lsblk,blkid,fdisk -landparted -lto inspect storage.
12. Creating Partitions with fdisk
fdisk is commonly used to create and manage MBR and GPT partitions on Linux systems. It is interactive: you launch it against a whole disk and type single-letter commands at its prompt.
# Verify the disk name before editing (example uses /dev/sdb — replace with yours)
lsblk
sudo fdisk -l /dev/sdb
sudo fdisk /dev/sdb
m # help: list all commands
p # print the current partition table
n # create a new partition
w # write changes to disk and exit
q # quit without saving
13. Partitioning with parted
parted is recommended for modern GPT disks and large storage devices.
lsblk
sudo parted /dev/sdb print # inspect first
sudo parted /dev/sdb
print
mklabel gpt # DESTRUCTIVE: creates a new GPT label
mkpart data 1MiB 100%
quit
14. Creating Filesystems (mkfs)
Refresh the partition table first
After you write a new partition table, the kernel may still hold its old view of the disk, so the new partition device (for example /dev/sdb1) might not exist yet. Ask the kernel to re-read the table and wait for the device nodes to appear before running mkfs:
sudo partprobe /dev/sdb # tell the kernel to re-read the partition table
sudo udevadm settle # wait until the /dev entries are fully created
lsblk /dev/sdb # confirm the new partition is now listed
Choose one filesystem per partition
Pick a single filesystem for the partition. The commands below are alternatives — you run one of them, not all of them. Running a second mkfs on the same device would overwrite the first filesystem and destroy its data.
sudo mkfs.ext4 /dev/sdb1 # option A: format as ext4
sudo mkfs.xfs /dev/sdb1 # option B (instead of A): format as XFS
sudo mkfs -t ext4 /dev/sdb1 # equivalent to mkfs.ext4, choosing the type with -t
| Command | Purpose |
|---|---|
| mkfs.ext4 | Create an ext4 filesystem. |
| mkfs.xfs | Create an XFS filesystem. |
| mkfs -t | Create a filesystem using the specified type. |
15. Removing Filesystem Signatures (wipefs)
sudo wipefs /dev/sdb1 # SAFE: only lists the signatures found, changes nothing
sudo wipefs -a /dev/sdb1 # DESTRUCTIVE: erases all filesystem signatures
sudo wipefs --all /dev/sdb1 # same as -a (long form)
Run bare wipefs first: with no options it only lists the filesystem, partition-table, and RAID signatures it detects and makes no changes. Adding -a (or --all) erases those signatures so the OS no longer treats the device as that filesystem. This is not a secure wipe — underlying blocks usually remain until overwritten.
16. Filesystem Repair: Covered in Chapter 9
This chapter focuses on creating filesystems and expanding LVM storage. For unmount requirements, backups, ext4 fsck, and XFS xfs_repair procedures, continue to Chapter 9: Persistent Mounts & Storage Operations.
17. Mounting Filesystems (Quick Look)
sudo mount /dev/sdb1 /data
sudo umount /data
Temporary mounts are useful for testing. For boot-persistent mounts by UUID, fstab options, swap, NFS, and mount troubleshooting, continue to Chapter 9: Persistent Mounts & Storage Operations.
18. Logical Volume Manager (LVM)
Disk ──► Physical Volume (PV) ──► Volume Group (VG) ──► Logical Volume (LV) ──► Filesystem ──► Mount Point
LVM provides flexible storage allocations, allowing online filesystem growth. Common setup commands:
lsblk
wipefs /dev/sdb1 # list signatures only — no changes
sudo pvcreate /dev/sdb1 # create a physical volume (destructive to prior FS)
sudo vgcreate vgdata /dev/sdb1
sudo lvcreate -L 20G -n lvdata vgdata
Growing a volume is a two-step job: first enlarge the logical volume, then grow the filesystem that sits on it. The filesystem step differs by type — resize2fs takes the block device, while xfs_growfs takes the mount point:
# Step 1: extend the logical volume by 10 GiB
sudo lvextend -L +10G /dev/vgdata/lvdata
# Step 2a: for an ext4 filesystem, grow it using the device path
sudo resize2fs /dev/vgdata/lvdata
# Step 2b: for an XFS filesystem, grow it using the mount point instead
sudo xfs_growfs /data
You can also let lvextend resize the filesystem in one step with --resizefs:
sudo lvextend -r -L +10G /dev/vgdata/lvdata # -r is short for --resizefs
The --resizefs option calls the right resize helper for you, but it only supports filesystems lvextend knows how to grow (such as ext4 and XFS) and the filesystem must already exist. When in doubt, run the two steps manually so you can see each result.
19. Common Production Storage Problems
| Problem Context | Possible Root Cause | Useful Commands |
|---|---|---|
| Filesystem Full | Storage capacity exhausted | df -h, du -sh * |
| Read-only Filesystem | Filesystem metadata errors | mount, dmesg, fsck |
| Mount Failed | Bad fstab line or missing mount point | mount -a, blkid (see Chapter 9) |
Commands Covered in This Chapter
lsblk— list block devicesblkid— show UUIDs and filesystem typesfdisk/parted— create and manage partitionsmkfs— create a filesystemwipefs— remove filesystem signaturesmount/umount— mount or unmount a filesystempvcreate/vgcreate/lvcreate— create LVM physical volumes, volume groups, and logical volumeslvextend/xfs_growfs/resize2fs— grow logical volumes and filesystems onlinedf/du— check disk and directory usage