Module 4 · Labs
These five labs make storage tangible: you’ll resize a volume while it’s live, pull a disk out of a running mirror and watch it heal, and — the module’s centerpiece — actually delete something and restore it from backup, timed. Then you’ll turn your server into a hypervisor and build the snapshot-before-risk habit you’ll use for the rest of the curriculum.
Lab 1 · Disk surgery
Section titled “Lab 1 · Disk surgery”Goal: take a fresh disk from raw hardware to a mounted, resizable filesystem — and grow it live. Exercises Lesson 4.1.
- Attach a spare disk (second SSD, HDD, or a USB drive). Identify it:
lsblk— note its name and confirm it’s the spare, not your system disk. - Create a GPT partition table and one partition (
sudo fdisk /dev/sdX). - Make it an LVM stack:
pvcreate→vgcreate data-vg→lvcreate -L 5G -n data-lv data-vg. - Format and mount:
mkfs.ext4the logical volume,mkdir /mnt/data,mountit, and add a UUID-based entry to/etc/fstab. Test withsudo mount -abefore trusting it. - Write a test file to
/mnt/datato confirm it works. - Grow it live:
sudo lvextend -L +2G /dev/data-vg/data-lv --resizefs, thendf -hto confirm the mounted filesystem is now larger — while still mounted and holding your test file.
Verify
Section titled “Verify”-
lsblkshows your partition → LVM → mounted filesystem. - The mount survives a reboot (fstab entry by UUID, verified with
mount -a). - You grew the volume and filesystem live, confirmed with
df -h, without losing data.
Commit
Section titled “Commit”labs/04-01-disk-surgery.md: the commands, the lsblk/df -h before-and-after, and what LVM
let you do that raw partitions wouldn’t.
Lab 2 · Kill a mirror
Section titled “Lab 2 · Kill a mirror”Goal: build a RAID 1 mirror, fail a disk while it runs, and rebuild it — so redundancy stops being theoretical. Exercises Lesson 4.2.
Pick either tool:
mdadm route:
- With two spare disks:
sudo mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdX /dev/sdY. - Format and mount
/dev/md0; write test data. - Check health:
cat /proc/mdstat(shows the array status). - Fail a disk:
sudo mdadm /dev/md0 --fail /dev/sdX --remove /dev/sdX(or physically pull it if hot-swap). Confirm the data is still readable — the mirror kept you running. - Rebuild: re-add the disk (
sudo mdadm /dev/md0 --add /dev/sdX) and watch it resync in/proc/mdstat.
ZFS route:
sudo zpool create tank mirror /dev/sdX /dev/sdY; write test data to/tank.zpool statusto see the healthy mirror.- Fail/offline a disk (
sudo zpool offline tank /dev/sdX), confirm data still reads. - Bring it back (
sudo zpool online) and watch the resilver inzpool status. Bonus: run asudo zpool scrub tank.
Verify
Section titled “Verify”- You built a working 2-disk mirror and wrote data to it.
- With one disk failed/removed, your data was still accessible (redundancy proven).
- You rebuilt/resilvered the array back to healthy and watched the progress.
Commit
Section titled “Commit”labs/04-02-mirror.md: a timeline of degrade → survive → rebuild, and — in your own words — why
this protects you from a disk failure but not from deleting a file.
Lab 3 · The restore drill
Section titled “Lab 3 · The restore drill”This is the module’s deliverable. Set up real backups, then prove them by deleting and restoring — timed. Exercises Lesson 4.3.
- Set up restic to an external/second disk:
restic init, then back up real things (/etc, your git repos, a service’s data):restic backup .... - Automate it with a systemd timer (or cron) so it runs nightly, and (bonus) make it notify you on failure.
- Confirm snapshots exist:
restic snapshots. - The drill — do this for real:
- Pick something important that’s in the backup.
- Delete it (or, safer while learning, restore to a separate path and diff against the original).
- Start a timer.
- Restore it from the backup:
restic restore .... - Stop the timer. Verify the restored data is complete and correct (diff it).
- Write the runbook as you go — the exact steps to restore, so 3am-you can follow it.
Verify
Section titled “Verify”- Automated, encrypted backups run on a schedule to a separate disk.
- You restored real data from a backup and verified it matches the original.
- You have a recovery time (RTO) — an actual number — and a written restore runbook.
Commit
Section titled “Commit”blog/04-verified-restore.md — the deliverable. Include: a Mermaid diagram of your backup
architecture (which copies live where, mapped to 3-2-1), your restore runbook, and the
evidence — timestamps and terminal output of the real restore. Publish it later; “here’s my
tested restore procedure, with receipts” is a standout portfolio piece because almost no junior
candidate has one.
Lab 4 · Hypervisor install
Section titled “Lab 4 · Hypervisor install”Goal: turn your micro PC into a Proxmox hypervisor and recreate your Module 2 server as a VM. Exercises Lesson 4.4.
- Back up first — this reinstalls the machine. Ensure your data and configs are safely backed up (Lab 3) and your build log (Module 2) is current, so you can rebuild.
- Install Proxmox VE on the micro PC (from its ISO, like the Debian install in Lesson 2.1). Confirm CPU virtualization is enabled in BIOS.
- Reach the Proxmox web UI over the network; set it up, and harden host SSH as in Lesson 2.3 (Proxmox is Debian underneath).
- Recreate your server as a VM: create a Debian VM inside Proxmox and install + harden it using your Module 2 skills and build log. Give it a DHCP reservation (Module 3).
- Confirm the VM behaves like the real server did —
sshin, services run.
Verify
Section titled “Verify”- The micro PC runs Proxmox; you manage it from the web UI.
- Your Module 2 Debian server now exists as a VM, hardened, reachable over SSH.
- You understand this VM is the same abstraction the cloud rents you.
Commit
Section titled “Commit”labs/04-04-hypervisor.md: the install, and a note on how recreating the server as a VM went —
what your Module 2 build log let you reproduce quickly.
Lab 5 · Snapshot safety net
Section titled “Lab 5 · Snapshot safety net”Goal: internalize the snapshot-before-risk reflex by breaking a VM on purpose and rolling it back. Exercises Lesson 4.4.
- Pick a VM (the one from Lab 4, or a throwaway test VM).
- Take a snapshot, named meaningfully (e.g.
before-experiment). - Break it deliberately — something you’d normally never risk: mangle its bootloader, delete a critical package, botch a config so it won’t boot.
- Confirm it’s broken (won’t boot / service dead).
- Roll back to the snapshot. Confirm the VM returns to its exact pre-break state, as if nothing happened.
- Reflect: note how this changes what you’re willing to try.
Verify
Section titled “Verify”- You snapshotted, broke the VM, and rolled back to a working state.
- You can articulate the habit: snapshot before any risky change, every time.
Commit
Section titled “Commit”labs/04-05-snapshot.md: what you broke, the rollback, and why this habit accelerates learning
for the rest of the curriculum.
Module 4 checkpoint
Section titled “Module 4 checkpoint”- I can partition, format, mount, and resize storage without a tutorial open (Lab 1)
- I can explain why RAID is not backup in one sentence to a non-engineer (Lab 2)
- My homelab has automated, encrypted, tested backups (Lab 3)
- I have performed a timed restore and have the runbook to prove it (Lab 3)
- My physical server runs a hypervisor; my services now live in VMs/containers (Lab 4)
- I snapshot before risky changes, reflexively (Lab 5)
Deliverable
Section titled “Deliverable”Your verified restore demo (Lab 3): the backup architecture diagram, the restore runbook, and the timestamped evidence of a real restore — the artifact that most cleanly proves operational maturity to an employer.
Next module: Module 5 · Overlay Networks → — where you reach your homelab securely from anywhere, without opening a single port.