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.

3 Replies to “Linux: How to get Harddisk UUID number”

  1. Thanks; I tried that but it it didn’t work for me originally. I had to use

    sudo /lib/udev/vol_id /dev/hda1

    since the vol_id program wasn’t in my path. I found it using “locate vol_id”.

  2. Hey, thanks, I always read your post, they are always useful, concise, effective… great, in one world.
    This is one of the most useful to me.

    See you! Some channel, same time! :-)


Comments are closed.