Mastering Linux Storage: Why You Should Use UUIDs
Jan 10, 2026
When we attach a new raw disk to a Linux system, we can’t just start storing files on it right away. At first, the disk shows up as a block device under /dev/, but it’s completely uninitialized.
The Workflow: Disk → Partition → Format (Filesystem) → Mount → Use
1. View Your Disks
First use lsblk or fdisk -l to see all our disks:
sda 8:0 0 30G 0 disk
├─ sda1 8:1 0 29.9G 0 part /
└─ sda15 8:15 0 106M 0 part /boot/efi
sdb 8:16 0 4G 0 disk New disk shows up as sdb (could be sdc, sdd..). But right now, it’s just a block of raw space. We can’t use it yet.
2. Partition the Disk
Partitioning is basically “carving” the disk into usable slices. We’ll use fdisk to create a single partition:
sudo fdisk /dev/sdb Choose n for new, p for primary, accept the defaults, then w to write changes.
Now lsblk shows:
sdb 8:16 0 4G 0 disk
└─sdb1 8:17 0 4G 0 part 3. Format & Mount the Partition
Use sudo mkfs.ext4 /dev/sdb1 to format the partition in ext4 file system.
In Linux, everything is a file, and the whole system is a single directory tree rooted at /. Disks don’t “appear” on their own; we must mount them into this tree.
sudo mkdir -p /mnt/datadisk1
sudo mount /dev/sdb1 /mnt/datadisk1 Verify via df -h.
4. The Reboot Trap
Manual mounts vanish after a reboot. To make it permanent, you might add a line to /etc/fstab:
/dev/sdb1 /mnt/datadisk1 ext4 defaults 0 2 All good… RIGHT? Wrong.
After rebooting, the disk order might change. My 4 GB disk could become /dev/sda and my OS disk /dev/sdb. Suddenly, my entire root filesystem gets mounted into /mnt/datadisk1. 😭
5. The Fix: Use UUIDs Instead
Every partition gets a UUID (Universally Unique Identifier) when it’s formatted. It’s written into the filesystem metadata and doesn’t change even if the device name does.
You can see it with:
sudo blkid /dev/sda1 Instead of using /dev/sdb1 in /etc/fstab, use the UUID:
UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx /mnt/datadisk1 ext4 defaults 0 2 Remount and our data is back, and now it’ll stay mounted correctly across reboots! 🥳
If you’re new to managing storage on Linux, I hope this saves you a couple of reboots and a mild heart attack 🫶