Mounting Filesystems with UUID-Based fstab Entries
I mounted filesystems reliably by referencing UUIDs in /etc/fstab instead of device names, then validated mounts without rebooting. UUID-based entries kept boot mounts correct even after disks were reordered or added.
Objective & Context
Device names like /dev/sdb are not stable across reboots; UUIDs are. This lab mounts manually, then persists with UUID fstab entries and validates safely, the durable-storage step the LVM and server labs depend on.
Environment & Prerequisites
- Linux with util-linux and a spare formatted device.
- Root access to edit fstab and mount.
- blkid to read UUIDs.
flowchart LR
B[blkid -> UUID] --> F[/etc/fstab entry]
F --> V[mount -a validate]
V --> Boot[stable boot mount]
Step-by-Step Execution
1. Read the device UUID
blkid /dev/sdb12. Add a UUID fstab entry [ROOT REQUIRED]
echo 'UUID=1234-5678 /mnt/data ext4 defaults,noatime 0 2' >> /etc/fstab3. Validate without rebooting
mount -a && findmnt /mnt/dataTARGET SOURCE FSTYPE OPTIONS
/mnt/data /dev/sdb1 ext4 rw,noatime
Validation & Testing
Run mount -a to confirm the fstab entry is valid (no errors), then verify with findmnt. Pass criteria: the filesystem mounts via UUID, survives a simulated device reorder, and mount -a reports no errors that would block boot.
Advanced: Troubleshooting
- Boot hangs on bad fstab: add
nofailfor non-critical mounts and always test withmount -afirst. - Wrong device after reboot: use UUID or LABEL, never /dev/sdX.
- Permission/owner issues: set mount options or post-mount chown as needed.
Key Results
- Made boot mounts resilient to device renaming via UUIDs.
- Validated fstab safely with
mount -abefore reboot. - Applied
noatime/nofailoptions for performance and safety. - Confirmed mounts with findmnt rather than assumptions.