Storage and data
Inventory storage devices
Identify disks, partitions, filesystems, mount points, capacity, and models before changing anything.
10 minute lesson
Before you format, partition, or mount anything, you need a complete picture of what storage the machine has and what each device is for.
Linux storage names can change between boots or attachments. The disk called /dev/sdb today can become /dev/sdc after you plug in a USB stick. That’s why the inventory records stable identifiers, and why mounts later use filesystem UUIDs instead of device names.
List storage without modifying it
All of these commands are read-only:
lsblk -o NAME,SIZE,TYPE,FSTYPE,UUID,MOUNTPOINTS,MODEL
findmnt
df -h
lsblk is the main view: every disk, its partitions, sizes, filesystem types, UUIDs, and the drive model. findmnt shows the tree of what’s currently mounted where. df -h adds how full each mounted filesystem is.
A healthy small server might show:
NAME SIZE TYPE FSTYPE UUID MOUNTPOINTS MODEL
sda 465.8G disk Samsung SSD 870
├─sda1 1G part vfat 9F1C-42A0 /boot/efi
└─sda2 464.8G part ext4 6d5f0a2e-... /
sdb 3.6T disk WDC WD40EFRX
└─sdb1 3.6T part ext4 3f6c9d81-...
Match every device to a purpose
Now write the mapping down: sda is the Samsung SSD holding the operating system, sdb is the 4 TB data drive. Mark the system disk clearly. It’s the one mounted at /, and it’s the one you must never format by accident.
Save the inventory before partitioning or formatting:
lsblk -o NAME,SIZE,TYPE,FSTYPE,UUID,MOUNTPOINTS,MODEL > ~/storage-inventory.txt
That file becomes part of your runbook later, and it’s your reference when a drive fails and you need to know which physical unit to pull.
The mistake this prevents
The classic storage disaster is running a format command against the wrong device, because “it was sdb yesterday”. The wrong disk is erased in seconds and there is no undo.
So the rule: never run a formatting command until the exact target has been resolved, right now, in this boot, by size, model, and UUID, and its data is recoverable. If the sizes in lsblk don’t match what you expect, stop and figure out why before typing anything destructive.
Lesson completed