Servers Using UUID to Deal With Disks

Using UUID to Deal With Disks

Juliet Kemp

UUID (Universal Unique Identifier) notation is another way provided by
Linux to access your disks. Unlike the standard /dev/hda1,
/dev/sda2 notation, it is linked specifically to a particular piece
of hardware (whereas /dev/ notation can shift between disks depending
on how they’re plugged in). This means you don’t have the risk of a
system reconfiguration causing disks to be renamed, and thus causing
knock-on breakage of things that reference that disk.

Tip of the Trade: UUID notation is one way to access your disks when using Linux. But first you must find the identifier.

OK, so, first, how do you find out the UUID of your disk? The command
blkid can be used — here’s its output for one of my disks:

# blkid /dev/hda1
/dev/hda1: UUID="0ef96300-36c0-4575-8a1d-2d36ff4cd585" SEC_TYPE="ext2" TYPE="ext3"

Alternatively, you can look at the /dev/disk/by_uuid/ directory to
see which UUID is associated with which disk. (Use df to find out
what device names you currently have mounted.)

Recent Tips
» Sysreq Key
» tcpdump
» superblock

Read All Tips of the Trade

You can also do this the other way around, starting from the UUID:
findfs UUID=uuid will tell you which disk is associated with that

Once you have the UUID of a device, you can use it with mount by
using the -U switch:

mount -U 0ef96300-36c0-4575-8a1d-2d36ff4cd585 /mnt/disk1

or, you can use it in your /etc/fstab by putting UUID=uuid at
the start of the relevant line, instead of /dev/hdaX.

To assign a UUID to a disk, use tunefs. You can generate your own
UUID with the command uuidgen. Then type:

tune2fs -U uuid /dev/sda2

This might come in handy if, say, you’ve cloned your disk (e.g., by using
dd) and must be able to mount both the original and the clone.
Assign it a new UUID and you’re away!

Latest Posts

Installing and Activating Hyper-V Linux Integration Services

Editor's Note: Updated to reflect changes with the Hyper-V Linux Integration Services 4.3 release. Microsoft developers have designed components that help in improving the performance of...

What is a Hypervisor Server?

At its most basic, a hypervisor is the “manager” of a software-hardware stack. The term “hypervisor” derives from the word “supervisor.” What is a Hypervisor? When...

HPE SimpliVity 380 Server Review

The HPE SimpliVity 380 Server was designed to deliver the high performance required by enterprise data centers in a simplified package. One of the...

What is Server Virtualization?

Server virtualization is essential for the efficient operation of any datacenter. But what exactly is server virtualization and is it right for your business?...

Using Netsh Commands for Wi-Fi Management in Windows 10

In this Server Tutorial, we’ll show you how to use Netsh Commands for Wi-FI management in Windows 10. Some basic networking settings and functionality...

Related Stories