How to Quickly Find Disk UUIDs and Verify Filesystem Presence on Linux
This guide explains several command‑line techniques for retrieving a Linux disk’s UUID and determining whether a partition is formatted with a filesystem, covering blkid, lsblk, /etc/fstab inspection, and the file command with practical examples.
Managing disks and filesystems is a core task for Linux system administrators. Knowing how to identify a device’s UUID and confirm that a partition is formatted helps avoid mounting errors and supports data recovery.
1. View Disk UUID
The UUID (Universally Unique Identifier) uniquely identifies storage devices, allowing the system to reference them reliably. Common ways to display UUIDs are:
Use blkid command: sudo blkid This prints all block devices with their UUIDs and associated filesystem types.
Use lsblk command: lsblk -o NAME,FSTYPE,UUID,MOUNTPOINT The output shows device name, filesystem type, UUID, and mount point.
Inspect /etc/fstab file: cat /etc/fstab This file lists devices that are automatically mounted at boot, often referencing their UUIDs.
2. Check Whether a Partition Contains a Filesystem
Before mounting or performing data recovery, verify that a partition is formatted. Useful commands include:
Use lsblk -f : lsblk -f /dev/sdc The command displays the filesystem type for each partition; an empty type indicates the partition is unformatted.
Use blkid again: sudo blkid If a partition lacks a filesystem, its entry may be missing or show no type.
Use file command: sudo file -s /dev/sdXN Replace /dev/sdXN with the actual partition device name. The output reports whether the partition contains recognizable filesystem data.
root@heaven:~# file -s /dev/sdc
/dev/sdc: Linux rev 1.0 ext4 filesystem data, UUID=7fa787b7-de75-40f7-b3ce-9944a2241cd8 (needs journal recovery) (extents) (64bit) (large files) (huge files)By applying these commands, administrators can accurately manage disks, ensure correct mounting configurations, and maintain system reliability.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Ops Development & AI Practice
DevSecOps engineer sharing experiences and insights on AI, Web3, and Claude code development. Aims to help solve technical challenges, improve development efficiency, and grow through community interaction. Feel free to comment and discuss.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
