Saving & Protecting Data: Storage, Shares & Backups
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 ↓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.
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.
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
/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!
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.
• 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.
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/
/ 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
1. You are deploying a high-performance PostgreSQL database that needs low-latency random read/write access. Which storage type should you attach?
2. Why should you use a filesystem UUID instead of /dev/sdb1 inside
/etc/fstab?
3. Which network file-sharing protocol uses TCP port 445 and integrates natively with Windows & Active Directory?
4. In the 3-2-1-1-0 backup rule, what does the second "1" (Immutable / Offline) specifically protect you from?