How to Find the UUID of a Storage Drive in Ubuntu Linux

In Ubuntu Linux, storage drives are traditionally assigned block device names like /dev/sda1 or /dev/nvme0n1p1. However, these device names are not persistent. If you plug a USB drive into a different port, or add a new hard drive to your motherboard, the operating system might reassign the letters (e.g., changing sda to sdb). This can cause catastrophic boot failures if your /etc/fstab file relies on these shifting names.

The Importance of UUIDs

To solve this problem, Linux uses a Universally Unique Identifier (UUID). A UUID is a long string of letters and numbers uniquely generated for the specific filesystem on a partition (for example, 1b3c9a45-6d7e-8f9a-0b1c-2d3e4f5a6b7c). Unlike block device names, a UUID never changes unless you completely reformat the partition. When configuring automatic mounts in Linux, you should always use the UUID.

Method 1: Using the blkid Command

The fastest and most common method to find the UUID of all connected drives is using the blkid command in the terminal.

  1. Open your terminal by pressing Ctrl + Alt + T.
  2. Type the following command and press Enter: sudo blkid
  3. Enter your administrator password when prompted.

The output will list all recognized partitions. Look for the partition you need (e.g., /dev/sda1) and find the section that reads UUID="your-unique-string-here". Be careful not to confuse it with the PARTUUID (Partition UUID), which serves a different purpose.

Method 2: Using the lsblk Command

If the output of blkid is too cluttered, you can format the output into a clean, easy-to-read tree structure using lsblk.

  1. Open the terminal.
  2. Type the following command and press Enter: lsblk -o NAME,SIZE,FSTYPE,UUID,MOUNTPOINT
  3. You do not need sudo privileges for this command.

This will display a neatly formatted table showing your drive names, their size, filesystem type, and their associated UUID in a dedicated column.

Method 3: Finding UUIDs via the GUI

If you prefer not to use the command line, you can find the UUID using the graphical “Disks” utility built into Ubuntu.

  1. Press the Super key and search for Disks.
  2. Open the application.
  3. Select your drive from the left-hand menu.
  4. Click on the specific partition in the Volumes graph.
  5. Look beneath the graph. You will see the UUID clearly listed next to the UUID label. You can even highlight and copy the text directly from this window.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.