Linux: How to get Harddisk UUID number

Modern Linux system uses UUID instead of traditional block name (/dev/hda1, /dev/hda5, /dev/sdb) to uniquely identify harddisk or other storage medium. This is because UUID is unique and never changes even if you switch the harddisk ordering.

So by mounting or refering your hard disk by its UUID, you are guaranteed to mount the correct storage medium no matter where its connected on your system.

Here’s how to get your harddisk UUID number

Method 1: Ubuntu and Debian Way

sudo vol_id /dev/hda1

This command display harddisk extra information including its filesystem and uuid number.

Method 2: using /dev/disk/by-uuid/

Another method which works universally on modern GNU Linux operating system is :

ls -l /dev/disk/by-uuid

which will uuid of connected storage medium to your computer.

That’s all, now you can easily identify your storage disk UUID number without much problem anymore.