This lab walks through the storage on a real host, from the mount point down to the physical disk, and designs a partition scheme for a new disk.
Objective
By the end of this lab, you can:
- Map every mount point to its physical disk.
- Verify that /etc/fstab uses stable identifiers.
- Design a partition scheme for a new disk and justify each choice.
- Demonstrate the safe use of wipefs to repurpose a disk.
Architecture
The host has these storage components:
- A boot disk (sda) with a GPT partition table.
- A data disk (sdb) with one large ext4 partition.
- An optional NVMe device (nvme0n1) used for fast data.
Tasks
Task 1: Map every mount point to its physical disk
For each mount point, trace from mount through filesystem through LV/partition to disk:
df -h
lsblk -o name,size,fstype,mountpoint
findmnt /
lvs -o+devices vg0
Write down the chain for each mount: e.g. /var -> vg0-var -> /dev/sda2 partition 2 -> /dev/sda (SATA port 1).
Task 2: Verify /etc/fstab uses stable identifiers
cat /etc/fstab
for fstab_entry in $(grep -v '^#\|^$' /etc/fstab | awk '{print $1}'); do
if [[ "$fstab_entry" =~ ^UUID= ]]; then
echo "OK: $fstab_entry uses UUID"
elif [[ "$fstab_entry" =~ ^LABEL= ]]; then
echo "OK: $fstab_entry uses LABEL"
else
echo "WARNING: $fstab_entry does NOT use a stable identifier"
fi
done
If any entry uses /dev/sd* or other device names, the host
will not boot after a hardware change. Fix the entry and run
mount -a to verify.
Task 3: Identify a new disk and design a partition scheme
If a new disk is available (loop device or attached USB):
lsblk -d -o name,size,tran,model
Design a partition scheme with rationale:
- Partition 1: small, FAT32, EFI System Partition (if the host uses UEFI).
- Partition 2: rest of disk, ext4 or xfs, for data.
- OR partition 2: LVM PV for flexible storage.
Write down the fstab entry you would use, with the UUID you expect to find after mkfs.
Task 4: Demonstrate safe wipefs usage
If a candidate disk is available (a loop device created from a spare file is fine):
# Create a small file to use as a loop device
truncate -s 1G /tmp/safety-disk.img
LOOP=$(sudo losetup --find --show /tmp/safety-disk.img)
echo "Loop device: $LOOP"
# Give it a signature to find. A blank file has none.
sudo mkfs.ext4 -q "$LOOP"
# Inspect signatures before wiping
sudo blkid "$LOOP" # TYPE="ext4" UUID="..."
# List mode: no options, nothing is erased
sudo wipefs "$LOOP" # prints offset / uuid / type / label
# Real dry run of the erase: -n with -a
sudo wipefs -n -a "$LOOP"
# Now actually wipe. -a erases ALL signatures; -b writes a
# restorable backup per signature into $HOME.
sudo wipefs -a -b "$LOOP"
sudo blkid "$LOOP" # now returns nothing, exit status 2
ls ~/wipefs-*.bak # the undo file
# Clean up
sudo losetup -d "$LOOP"
rm /tmp/safety-disk.img
rm -f ~/wipefs-*.bak
Two flags carry this task.
-a is what erases. Bare wipefs DEVICE is list mode — the
man page says so plainly — and it prints a tidy table of
signatures that reads exactly like a confirmation of work done.
It is not. Without -a, blkid afterwards still reports the
original TYPE=, and the step above would fail its own check.
-b is what makes the erase reversible. It writes
~/wipefs-<devname>-<offset>.bak for each signature it removes.
Restore with:
sudo dd if=~/wipefs-sdb-0x00000438.bak of=/dev/sdb \
seek=$((0x00000438)) bs=1 conv=notrunc
Without -b there is no undo. Type both flags every time.
The dry run is wipefs -n -a, not wipefs --no-act on its own:
--no-act suppresses the write, but with no -a there was never
going to be a write to suppress.
Validation
- Every mount point in the host maps to a physical disk via a traceable chain.
- /etc/fstab has zero entries using
/dev/sd*device names (unless the disk is a removable device that is always inserted the same way, which is rare). - The new-disk design has a written rationale for each partition.
- The wipefs walkthrough produced a clear before/after blkid
output:
TYPE="ext4"before, no output after. If blkid still reports a type,-awas omitted and nothing was erased. ls ~/wipefs-*.baklists at least one backup file, proving the erase was reversible.
Cleanup
If you used a loop device for Task 4, the losetup -d and rm steps
above clean up. The fstab changes from Task 2 may need to be
reverted if you did not commit them with intent (use git diff /etc/fstab to inspect).
What you learned
- The host’s storage can be traced from mount point to physical disk through a chain of layers (filesystem, LV, PV, partition, device).
- /etc/fstab should always use UUID or LABEL. /dev/sd* names are not stable.
- Partition design starts with the disk’s role (boot, data, swap) and ends with a partition scheme.
- wipefs has two modes. No options is a read-only listing;
-ais the one that erases. Reading the listing as proof of a wipe is a common and expensive mistake. wipefs -a -bwrites a per-signature backup to$HOME, so the erase can be undone withdd. Without-bthere is no undo.- The genuine dry run is
wipefs -n -a, and it is the safety net.