Lion Cipher Lab

Partition, format, and mount storage on Linux (safely, with a loopback file)

Why it matters

Adding storage is one of those tasks that feels rare until suddenly it isn't: a VM runs out of room, a cloud volume needs attaching, a log partition fills at 3 a.m., or you're recovering data off someone else's drive. The commands — partition, format, mount, fstab — are the same on a laptop, a server, and a cloud box, and they're the exact commands sitting one layer under disk encryption, forensics imaging, and every 'the disk is full' incident. They're also genuinely dangerous: one wrong device name wipes real data with no undo. Learning them on a throwaway loopback file means you build the…

What you'll learn

Steps in this lab

  1. The one rule that makes everything else safe
  2. See what's already on the machine (lsblk, fdisk -l)
  3. Create a virtual disk as a file (truncate)
  4. Attach the file as a loop device (losetup)
  5. Partition the virtual disk (parted, GPT vs MBR)
  6. Put a filesystem on the partition (mkfs.ext4)
  7. Mount it, use it, unmount it (mount, df, du, umount)
  8. Make the mount survive a reboot — the right way (blkid, /etc/fstab, UUID)
  9. LVM in five minutes — why you'd add a layer (pvcreate, vgcreate, lvcreate)
  10. Clean up completely — leave the machine as you found it
  11. When, why, and the better way (judgment to carry out)

Open the full interactive lab →