📘 Visual Posts About Contact
Explore 📋 Cheat Sheets ✏️ Practice 🎮 Games 🎬 Simulations 🃏 Flashcards 🎯 Interactive Layers 📖 Storytelling
💜 Support my site

Saving & Protecting Data: Storage, Shares & Backups

Module 10 Zero to Hero 2026 Updated

If your server loses its data, nothing else matters. Learn how servers store bytes on disks, mount drives in Linux, share folders across Windows & Linux networks, and build ransomware-proof 3-2-1-1-0 backups.

Start Module 10 ↓
DATA LIFECYCLE: STORE → MOUNT → SHARE → PROTECT 1. DISK (/dev/sdb) Block Storage ext4 / XFS / NTFS 2. MOUNT POINT /mnt/appdata /etc/fstab (UUID) 3. NETWORK SHARE SMB & NFS Port 445 / 2049 rsync / Backup Job 4. THE 3-2-1-1-0 BACKUP FORTRESS Local NAS Fast LAN restore Copy #2 Offsite Cloud S3 Object Lock Copy #3 (Immutable) Tested Verified restore 0 Errors

01 Block vs File vs Object Storage

Define: Every byte you save on a server or in the cloud lives in one of three storage architectures: Block Storage, File Storage, or Object Storage. Choosing the wrong one makes databases crawl or storage bills explode.

Understand (The Universal Analogy): Imagine three ways to store physical items:

  • Block Storage = An Empty Plot of Land (Raw Hard Drive): You get raw space divided into equal-sized plots (blocks). There are no folders or labels yet—you build your own system (like a database or OS) directly on top of it for maximum speed.
  • File Storage = A Shared Office Filing Cabinet (Shared Folder): Everything is organized into folders and subfolders (/finance/2026/budget.xlsx). Multiple employees can open the same cabinet over the network.
  • Object Storage = A Warehouse Valet (S3 / Blob): You don't pick a shelf or folder. You hand your item (object) to a valet, who attaches a rich metadata tag and gives you a unique ticket ID (URL). When you need it back, you hand over the ticket.
THE THREE PILLARS OF SERVER STORAGE BLOCK STORAGE Analogy: Raw Hard Drive 4KB / 8KB Chunks • Lowest latency (fastest) • Needs OS format (ext4/NTFS) • Attached to 1 server USE FOR: Databases, OS Boot, VMs FILE STORAGE Analogy: Shared Folder /hr/2026/offer.pdf Folder Hierarchy • Shared by many users • Uses SMB or NFS • File locking supported USE FOR: Team Shares, Home Dirs OBJECT STORAGE Analogy: Warehouse Valet ID + Metadata + Data Flat Pool (HTTP/S3) • Scales to exabytes • Accessed via REST API • Cheap & immutable USE FOR: Backups, Video, Images

Know & When: You cannot "edit one line inside an Object"—you replace the entire object. That's why PostgreSQL or MySQL needs Block Storage (fast random writes), office teams need File Storage, and backups or media archives belong in Object Storage (like AWS S3, Cloudflare R2, or MinIO).

🧠 Memory Trick: B-F-O = "Bricks, Folders, Objects"

Block = Bricks (raw building blocks for databases & OS). File = Folders (shared network cabinets). Object = Online Valet (ticket-based warehouse via HTTP).

02 Disks, Partitions, Mounting & /etc/fstab

Define: In Windows, plugging in a new drive gives it a letter like D:\. In Linux, there are no drive letters. Everything lives under one giant tree starting at /. To use a new disk, you attach ("mount") it to an empty folder.

Understand (The USB Stick Analogy): Plugging a physical disk into a Linux server is like bringing a locked suitcase into your house. Until you open it and place it in a room (a mount point like /mnt/data), nobody can put things inside it.

FROM RAW DISK TO USABLE LINUX FOLDER 1. RAW DISK /dev/sdb 500 GB NVMe Check: lsblk 2. PARTITION /dev/sdb1 GPT Table Tool: parted 3. FILESYSTEM ext4 / xfs Assigns UUID mkfs.ext4 4. MOUNT POINT /mnt/appdata Ready for files Check: df -h PERSIST ACROSS REBOOTS: /etc/fstab UUID=a1b2c3d4-... /mnt/appdata ext4 defaults,nofail 0 2

Execute: Essential Linux Storage Commands

# 1. List all disks and partitions (like Disk Management in Windows)
lsblk -f

# 2. Check free space on currently mounted filesystems (human-readable)
df -h

# 3. Format a new partition as ext4 (WARNING: erases all data on /dev/sdb1!)
sudo mkfs.ext4 /dev/sdb1

# 4. Create a mount folder and mount it temporarily
sudo mkdir -p /mnt/appdata
sudo mount /dev/sdb1 /mnt/appdata

# 5. Find the permanent UUID so it never breaks if drive letters shift
sudo blkid /dev/sdb1
Why use UUID instead of /dev/sdb1 in /etc/fstab?
If you plug in another drive or reboot, Linux might rename /dev/sdb to /dev/sdc. A UUID (Universally Unique Identifier) is stamped inside the filesystem itself, so it never changes. Always test your fstab edits with sudo mount -a before rebooting—and add nofail for non-OS data drives so a missing disk won't freeze server boot!

03 Network File Sharing: SMB vs NFS

Define: When multiple servers or employees need to read and write the exact same folder over the network, you expose a folder as a Network Share using either SMB (Server Message Block) or NFS (Network File System).

Understand (The Language Analogy): Think of SMB and NFS as two different office languages. SMB (used by Windows & Linux Samba) speaks "Windows"—it understands Active Directory usernames, passwords, and Windows file permissions. NFS (native to Linux/Unix) speaks "Linux"—it trusts server IP addresses or Kerberos tickets and maps directly to Linux user IDs (UIDs).

SMB (WINDOWS / SAMBA) VS NFS (LINUX / UNIX) FILE SERVER / NAS 10.0.20.50 Samba: /srv/finance NFS: /srv/web-uploads SMB · TCP 445 Windows / macOS / Office PCs \\10.0.20.50\finance Auth: Username / Active Directory NFSv4 · TCP 2049 Linux Web & App Servers mount 10.0.20.50:/srv/web-uploads Auth: Subnet IP / Kerberos
Feature SMB / CIFS (Samba on Linux) NFS (v4.1 / v4.2)
Default Port TCP 445 TCP 2049
Primary Ecosystem Windows, macOS, mixed office networks Linux, Unix, Kubernetes/VMware
Authentication User/Password, NTLM, Active Directory Client IP allowlist (/etc/exports) or Kerberos
Best Use Case Department shared drives, user home folders Shared Linux app uploads, container volumes
Security Rule: Never expose TCP 445 (SMB) or TCP 2049 (NFS) directly to the public internet! Always restrict them to your internal LAN/VLAN or a private VPN tunnel (WireGuard/Tailscale).

04 The 3-2-1-1-0 Backup Rule & Snapshots

Define: A backup is an independent, restorable copy of your data stored separately from your production server. In 2026, the gold-standard framework against hardware failure, human mistakes, and ransomware is the 3-2-1-1-0 Rule.

Critical Beginner Trap: RAID is NOT a Backup! A Snapshot is NOT a Backup!
• RAID (mirroring two disks) protects against a dead hard drive. If you accidentally run rm -rf /data or ransomware encrypts your files, RAID faithfully mirrors the deletion/encryption to both drives in milliseconds.
• Snapshots live on the same storage pool as the live data. If the storage array dies or an attacker gains admin access and deletes the volume, every snapshot vanishes with it.
THE 3-2-1-1-0 BACKUP RULE (RANSOMWARE-PROOF) 3 Total Copies 1 Live Prod + 2 Backups No single point of failure 2 Media Types Local NAS Disk + Cloud Object Survives media defects 1 Offsite Copy Different city or cloud region Survives fire, flood & theft 1 Immutable Air-gapped or WORM Object Lock Ransomware cannot delete! 0 Test Errors Regularly test a full restore Untested backup = Schrödinger's!

Checkpoint: RPO vs RTO (Two Numbers Every Boss Asks For)

  • RPO (Recovery Point Objective): "How much data can we afford to lose?" If you back up once every 24 hours, your RPO is 24 hours.
  • RTO (Recovery Time Objective): "How fast must we be back online?" Downloading 2 TB from slow tape takes days (high RTO); restoring from a local NAS takes minutes (low RTO).

05 Practical Lab: rsync Incremental Backups & Restore

Execute: rsync is the Swiss Army knife of Linux backups. Unlike cp, which copies every file from scratch every time, rsync checks file sizes and timestamps and transfers only the changed bytes—saving time and bandwidth.

# Step 1: Dry-Run first! (-n = simulate, -a = archive/preserve permissions, -v = verbose)
rsync -avzn --delete /srv/appdata/ [email protected]:/backups/appdata/

# Step 2: Run the real incremental backup (remove 'n' after verifying dry-run)
rsync -avz --delete /srv/appdata/ [email protected]:/backups/appdata/

# Step 3: Verify & Test Restore into a temporary sandbox folder (NEVER overwrite live data blindly!)
mkdir -p /tmp/restore-test
rsync -avz [email protected]:/backups/appdata/ /tmp/restore-test/
ls -lh /tmp/restore-test/
Watch that trailing slash / in rsync!
rsync -av /srv/appdata/ /backups/ copies the contents inside appdata into /backups/. Without the trailing slash (/srv/appdata), it creates /backups/appdata/. Always run --dry-run (-n) first when using --delete!

🛠️ Practice Scenario: Fix the Disappearing Mount

You added a 1 TB disk (/dev/sdb1) to your Ubuntu server and ran sudo mount /dev/sdb1 /mnt/backups. Everything worked all week. Last night the server rebooted for kernel updates, and today /mnt/backups is completely empty! Did you lose your data?

Show Solution

No, your data is still safe on /dev/sdb1! The mount command is temporary—it resets on reboot unless you register the disk's UUID in /etc/fstab.

Fix: Run sudo blkid /dev/sdb1 to grab the UUID, add UUID=<your-uuid> /mnt/backups ext4 defaults,nofail 0 2 to /etc/fstab, and run sudo mount -a.

🎯 Knowledge Check

Test your mastery of Module 10 before moving to Identity & Active Directory. Score: 0 / 4

1. You are deploying a high-performance PostgreSQL database that needs low-latency random read/write access. Which storage type should you attach?

Block Storage (e.g., NVMe / SAN LUN)
Object Storage (e.g., Amazon S3)
SMB File Share over Wi-Fi

2. Why should you use a filesystem UUID instead of /dev/sdb1 inside /etc/fstab?

UUIDs automatically encrypt the disk at boot
Device names like /dev/sdb can change across reboots, while UUIDs stay fixed
Linux only allows UUIDs for ext4 partitions

3. Which network file-sharing protocol uses TCP port 445 and integrates natively with Windows & Active Directory?

NFSv4
rsync
SMB / CIFS (Samba)

4. In the 3-2-1-1-0 backup rule, what does the second "1" (Immutable / Offline) specifically protect you from?

Ransomware or attackers deleting your backups after compromising admin credentials
A single hard drive failing inside your server
Forgetting to test whether your backup files are corrupted