CresignSys Learn — Lesson 021

Written by

in

Course: From Basic Science to Web Hosting

Module 04 — Linux Fundamentals

How Linux Uses Storage

Difficulty: Beginner → Intermediate
Prerequisites: Lesson 020 — Linux Memory
Estimated time: 40 minutes

We now understand:

CPU
 ↓
RAM
 ↓
Processes

But your WordPress files must survive a reboot.

That requires:

Persistent Storage


1. The Basic Storage Chain

A simplified path is:

Website
 ↓
File
 ↓
Filesystem
 ↓
Mount point
 ↓
Storage device
 ↓
SSD / virtual disk

For your server:

WordPress
 ↓
/storage/websites/
 ↓
Filesystem
 ↓
Mounted storage
 ↓
Virtual disk / physical storage

2. RAM vs Storage

Remember:

RAM
= temporary working memory

while:

Storage
= persistent data

Example:

WordPress files
       ↓
Storage

Running WordPress
       ↓
RAM

3. Why Storage Is Needed

Suppose you install WordPress.

You have files such as:

wp-admin/
wp-content/
wp-includes/
index.php
wp-config.php

If these existed only in RAM:

Power off
 ↓
RAM contents disappear
 ↓
WordPress disappears

Instead:

WordPress files
 ↓
SSD
 ↓
Power off
 ↓
Files remain

4. What Is a Storage Device?

At the hardware level, a computer may have:

HDD
SSD
NVMe SSD
Flash storage

A cloud VPS normally exposes a virtual block storage device to the guest operating system, backed by the provider’s physical infrastructure.

So your Ubuntu VM may see something like:

/dev/sda

or:

/dev/vda

or:

/dev/nvme0n1

The exact device name depends on the virtualization/cloud platform.


5. What Is /dev?

We learned previously:

/dev

is a special filesystem containing device interfaces.

Storage devices can appear there.

For example:

/dev/sda

could represent an entire disk.

And:

/dev/sda1

could represent a partition on that disk.


6. Disk vs Partition

Imagine a disk:

┌──────────────────────────────┐
│          DISK                │
│                              │
│ ┌──────────┐ ┌─────────────┐ │
│ │Partition1│ │ Partition 2 │ │
│ └──────────┘ └─────────────┘ │
└──────────────────────────────┘

A partition is a defined region of a disk.

For example:

/dev/sda

might be the disk.

/dev/sda1

might be its first partition.


7. Why Partition?

Partitions allow a disk to be divided into separate logical regions.

For example:

Disk
 ├── EFI partition
 ├── Root partition
 └── Data partition

Modern systems can use different partitioning schemes and layouts.


8. GPT

A common modern partitioning scheme is:

GPT

GUID Partition Table.

It is commonly used with UEFI systems and supports large disks and many partitions.

Conceptually:

Disk
 ↓
GPT partition table
 ↓
Partitions

9. Filesystem

A partition or block device is not automatically a directory tree.

You normally create a:

Filesystem

on a storage device or partition.

Common Linux filesystems include:

ext4
XFS
Btrfs

Ubuntu commonly uses:

ext4

in many installations, though other filesystems are possible.


10. Filesystem’s Job

A filesystem organizes raw storage into structures that Linux can use as:

Files
Directories
Metadata
Permissions
Timestamps

Conceptually:

Raw storage
 ↓
Filesystem
 ↓
Files/directories

11. Raw Block Storage

A disk fundamentally provides blocks of storage.

Conceptually:

Block
Block
Block
Block
Block
...

The filesystem turns this low-level storage into a structured hierarchy.

Blocks
 ↓
Filesystem structures
 ↓
Files
 ↓
Directories

12. What Is ext4?

ext4 is a Linux filesystem.

It manages things such as:

Files
Directories
Inodes
Blocks
Metadata
Free space
Journaling

We will study these individually.


13. What Is a Mount?

This is one of the most important Linux concepts.

Suppose you have:

/dev/sdb1

containing an ext4 filesystem.

Linux can attach it to:

/storage

This is called:

Mounting

Conceptually:

/dev/sdb1
     ↓
  ext4 filesystem
     ↓
   mount
     ↓
/storage

14. Why Is Mounting Needed?

Linux uses a single unified filesystem hierarchy.

You don’t normally access storage as:

C:
D:
E:

as in traditional Windows drive-letter notation.

Instead:

/
├── etc
├── var
├── home
└── storage

A separate filesystem can be mounted into this tree.


15. Example

Suppose:

/dev/sdb1

is mounted at:

/storage

Then:

/storage/websites/

is actually stored on the filesystem provided by /dev/sdb1.

Conceptually:

/dev/sdb1
     ↓
   mount
     ↓
/storage
     ↓
/storage/websites

16. Your /storage Directory

Your hosting architecture uses:

/storage/websites/

There are two possibilities:

Case A

/storage is simply a directory inside your root filesystem.

Case B

/storage is a separate filesystem mounted there.

These are very different at the storage level.


17. How Do We Find Out?

Use:

df -h

You might see:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        80G   30G   46G  40% /

Or you might see a separate entry:

/dev/sdb1       200G   50G  150G  25% /storage

Then you know /storage is a separate mounted filesystem.


18. df

df means:

Disk Free

Use:

df -h

It shows filesystem capacity and usage.

Important columns:

Filesystem
Size
Used
Avail
Use%
Mounted on

19. df -h /storage

You can directly check the filesystem containing /storage:

df -h /storage

This is useful because the directory itself doesn’t tell you which device backs it.


20. lsblk

Another important command:

lsblk

This displays block devices and their relationships.

Example:

sda
├─sda1
└─sda2

A more useful version:

lsblk -f

It can show:

NAME
FSTYPE
LABEL
UUID
MOUNTPOINTS

21. Block Device

A block device is a device that provides storage in addressable blocks.

Examples:

SSD
HDD
Virtual disk

Linux exposes these through device nodes such as:

/dev/sda
/dev/nvme0n1

22. NVMe

Modern SSDs often use NVMe.

You may see:

/dev/nvme0n1

and partitions:

/dev/nvme0n1p1
/dev/nvme0n1p2

The naming differs from traditional SCSI-style names such as /dev/sda1.


23. Cloud VPS Storage

Your server is running as a virtual machine.

Therefore:

Your VM
 ↓
Virtual block device
 ↓
Cloud infrastructure
 ↓
Physical storage

You normally interact with the virtual device, not directly with the provider’s physical SSD.


24. Storage Abstraction

This is another important computer-science concept.

You see:

/storage/websites/

but underneath:

Directory
 ↓
Filesystem
 ↓
Block device
 ↓
Virtualization
 ↓
Cloud storage infrastructure
 ↓
Physical hardware

Each layer hides details from the layer above it.


25. Inodes

A filesystem needs to keep metadata about files.

One important structure is an:

Inode

An inode can contain information such as:

File type
Permissions
Owner
Group
Timestamps
File size
Pointers/references to file data

The exact internal structure depends on the filesystem.


26. Filename vs Inode

A useful conceptual distinction:

Filename
   ↓
Directory entry
   ↓
Inode
   ↓
File data

The filename is not the complete identity of the file’s underlying filesystem metadata.

This explains several Linux filesystem behaviors.


27. Hard Links

A hard link allows multiple directory entries to refer to the same inode.

Conceptually:

fileA
   \
    → inode → data
   /
fileB

Therefore:

fileA

and:

fileB

can refer to the same underlying file data.

This is a deeper filesystem concept.


28. Symbolic Links

A symbolic link is different.

It contains a path reference to another file/directory.

Example:

link
 ↓
/some/other/path

You can create one with:

ln -s /source /destination

29. Why Symlinks Matter for Nginx

Linux server configurations often use symbolic links.

For example, Nginx commonly uses:

/etc/nginx/sites-available/

and:

/etc/nginx/sites-enabled/

A site configuration can be stored in one location and linked into the enabled directory.

Conceptually:

sites-available
       ↓
configuration file
       ↑
       │ symlink
       │
sites-enabled
       ↓
Nginx loads enabled configuration

Your:

/etc/nginx/sites-enabled/templates.cresignsys.com

is part of this style of configuration organization.


30. File Size vs Disk Usage

These are not always identical concepts.

A file may have:

Logical size

and:

Actual allocated blocks

Sparse files are one example where these can differ significantly.

For ordinary beginner use, ls -lh shows the logical file size, while du shows disk usage.


31. du

Use:

du -sh /storage/websites/

This estimates the amount of disk space consumed by that directory.

Compare:

df -h

with:

du -sh

df

Filesystem-level free/used space.

du

Space consumed by files/directories.

This distinction is extremely important.


32. Example

Suppose:

df -h /

shows:

80G total
60G used
20G available

But:

du -sh /storage/websites/

shows:

25G

The other space may be used by:

Operating system
Logs
Databases
Caches
Other files
Filesystem metadata

33. Finding Large Directories

You can inspect:

du -h --max-depth=1 /storage

This can show which directories consume space.

For example:

2G   /storage/websites/site1
10G  /storage/websites/site2
5G   /storage/websites/site3

34. Why Disk Space Matters for WordPress

A WordPress site may accumulate:

Images
Videos
Plugins
Themes
Backups
Logs
Cache
Database files
Temporary files

Therefore:

Disk usage

can grow over time.


35. Database Storage

MySQL also stores persistent data on disk.

Conceptually:

WordPress
 ↓
MySQL
 ↓
Database files
 ↓
Storage

The exact internal storage layout depends on MySQL/InnoDB configuration.


36. Disk I/O

Reading/writing storage requires:

I/O

Input/Output.

For example:

Read:
SSD → RAM

Write:
RAM/application → filesystem → SSD

37. Why Disk I/O Can Slow a Server

Suppose MySQL performs many disk operations.

Then:

MySQL
 ↓
Storage requests
 ↓
SSD
 ↓
waiting

The CPU may have little work to do while the process waits for I/O.

This can contribute to:

High I/O wait
Slow applications
Slow database queries
Slow websites

38. CPU Utilization vs I/O Wait

This distinction is important.

A server can feel slow even if:

CPU usage = 20%

because processes may be waiting for:

Disk I/O
Network I/O
Other resources

So server performance isn’t just:

CPU percentage

39. iostat

A useful tool for storage monitoring is:

iostat

It may be provided by the sysstat package.

A more detailed command:

iostat -xz 1

can show storage-device performance statistics.

You may need to install sysstat if it isn’t already installed.


40. Storage Performance

Storage has several important characteristics:

Capacity
Latency
IOPS
Throughput

41. Capacity

How much data can be stored?

Example:

100 GB
500 GB
1 TB

42. Latency

How long does an operation take?

Conceptually:

Request
 ↓
Wait
 ↓
Response

Lower latency generally means faster response for individual operations.


43. IOPS

IOPS means:

Input/Output Operations Per Second

It measures how many I/O operations a storage system can handle under specified conditions.

Database workloads can be sensitive to IOPS and latency.


44. Throughput

Throughput measures how much data can be transferred per unit time.

For example:

500 MB/s

A large sequential file transfer may care strongly about throughput.

A database performing many small random operations may care more about latency and IOPS.


45. Sequential vs Random I/O

Sequential

Block 1
Block 2
Block 3
Block 4

Random

Block 900
Block 12
Block 5000
Block 77

Different workloads produce different performance characteristics.


46. Mount Points

Let’s return to the key concept.

Suppose:

/dev/sdb1

contains a filesystem.

You mount it:

/storage

Then:

/storage

becomes the entry point into that filesystem.

Conceptually:

/dev/sdb1
      ↓
   filesystem
      ↓
    mount
      ↓
  /storage

47. /etc/fstab

Linux can define persistent mounts in:

/etc/fstab

This file describes filesystems that should be mounted automatically according to system configuration.

A conceptual entry might contain:

UUID=...
/storage
ext4
defaults
0 2

The exact syntax and options depend on the filesystem and desired configuration.


48. Why UUID?

Instead of relying only on:

/dev/sdb1

Linux can identify a filesystem using a:

UUID

Universally Unique Identifier.

For example:

UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

This can be more stable across device enumeration changes.

You can inspect filesystem UUIDs with:

lsblk -f

49. Check Your Mounts

Useful commands:

findmnt

and:

df -h

and:

lsblk -f

Together they help answer:

What storage devices exist?
 ↓
What filesystems exist?
 ↓
Where are they mounted?
 ↓
How much space is available?

50. Your Hosting Storage Architecture

Your system may look conceptually like:

Cloud VM
   ↓
Virtual disk
   ↓
Partition / volume
   ↓
Filesystem
   ↓
Mount point
   ↓
/storage
   ↓
/storage/websites
   ↓
templates.cresignsys.com
   ↓
public
   ↓
WordPress

The exact device/partition structure should be discovered from your server using:

lsblk -f
df -h
findmnt

rather than assumed.


51. Website Files vs Storage Device

This is an important distinction.

When you run:

cd /storage/websites/templates.cresignsys.com/public

you are navigating the filesystem namespace.

You are not directly navigating:

SSD sectors

The filesystem and kernel translate your path into storage operations.

Conceptually:

Path
 ↓
Directory entry
 ↓
Inode
 ↓
Filesystem
 ↓
Block device
 ↓
Storage

52. The Complete Storage Chain

Now connect everything:

WordPress
 ↓
PHP
 ↓
Filesystem API
 ↓
Linux kernel
 ↓
Virtual filesystem
 ↓
Filesystem driver
 ↓
Block layer
 ↓
Device driver
 ↓
Virtual disk
 ↓
Cloud storage
 ↓
Physical storage

This is the deep connection between:

wp-config.php

and:

physical storage hardware

53. Storage + Memory + CPU

A running application continuously moves through these resources:

              CPU
               ↑
               │
               ↓
              RAM
               ↑
               │
               ↓
            Storage

For example:

WordPress file
 ↓
Storage
 ↓
RAM
 ↓
CPU
 ↓
execution

Results may then be:

CPU
 ↓
RAM
 ↓
Network
 ↓
Browser

54. Full Web Hosting Resource Model

Your server is now understandable as four major resource areas:

                SERVER
                  │
      ┌───────────┼───────────┐
      ↓           ↓           ↓
     CPU          RAM       Storage
      │            │           │
      └────────────┼───────────┘
                   ↓
                Network

Web hosting performance depends on all of them.


55. Practical Commands to Learn

Run these on your Ubuntu server:

lsblk -f
df -h
df -h /storage
findmnt
du -sh /storage/websites/
du -h --max-depth=1 /storage/websites/

These commands let you begin understanding your actual storage architecture rather than just memorizing theory.


56. Quick Check

What is persistent storage?

Storage that retains data when power is removed.

What is a filesystem?

A system that organizes persistent storage into files, directories, and metadata.

What is a mount point?

A directory in the filesystem hierarchy where another filesystem is attached.

What does df -h show?

Filesystem capacity and space usage.

What does du -sh show?

Approximate disk space consumed by a file/directory tree.

What does lsblk -f show?

Block devices and filesystem information such as filesystem type, UUID, and mount points.

What is an inode?

A filesystem structure containing metadata about a file and references to its data.

What is I/O?

Input/output operations such as reading and writing storage.


Next Lesson — 022

Linux Networking Fundamentals

Now we have completed the major local-server foundations:

CPU
 ↓
RAM
 ↓
Processes
 ↓
Storage
 ↓
Filesystem
 ↓
Users
 ↓
Permissions
 ↓
Services

Now we can finally move outside the computer:

Server
 ↓
Network Interface
 ↓
Ethernet
 ↓
MAC Address
 ↓
IP Address
 ↓
Subnet
 ↓
Gateway
 ↓
Router
 ↓
Internet

Then we will build progressively toward:

IP
 ↓
TCP
 ↓
UDP
 ↓
DNS
 ↓
HTTP
 ↓
TLS
 ↓
HTTPS
 ↓
Nginx
 ↓
Domain
 ↓
Web Hosting

This will connect directly to how templates.cresignsys.com reaches your Ubuntu server.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *