How to Change UUID on Linux

Although it’s not really common for Linux users, you can change UUID on Linux when you wish to do so. It might offer a challenging impression at first, but the job becomes seamless with the help of the tune2fs command.

The Universally Unique Identifier, aka UUID, refers to a directory labeling ID. It is a 128-bit label that is majorly used for tagging the information that sits in the partitions of computer systems. You might have encountered the term globally unique identifier or GUID, and both terms actually mean the same thing.

The usage of UUIDs can extend in various directions. When the identifier is generated according to the standard methods and the associated practical purposes, it is always unique. However, it is worth noting that the uniqueness of UUID is entirely independent of any central registration authority. 

In simple words, UUIDs don’t depend on the existing coordination that happens to exist among the users generating them.

UUID is a flexible entity. Almost anyone can make use of it and make the process of identifying something around the filesystem. Remember, there are a number of situations when a change in UUID can take place. We’ve got formatting a drive and even bringing partitioning, to name a few.

More amazingly, there exists a genuine possibility of changing the ID as well. Yes, you read that right, bringing alteration is pretty straightforward, and that’s what you’ll be learning in this write-up. 

Pre Requisites

Before you change UUID on Linux, it is crucial that you’re aware of the procedures that will help you figure out your system’s UUID. Doing so is pretty easy. Just launch the Terminal using the “Ctrl+Alt+T” key combination followed by running the blkid command alongside the grep UUID option.

Input:

$ blkid | grep UUID
change UUID on Linux 1

In case you don’t have the blkid Command-line utility installed, simply have that done by invoking the sudo-apt install command.

How to Change UUID on Linux: Quick Easy Steps

Once you’ve identified your system UUID, you’re now ready to bring the required alterations. No doubt, the query itself sounds too challenging to deal with, but in reality, you can change UUID on Linux in just a couple of minutes without even getting involved in any kind of complexities along the way.

Step 1: Deciding the Alteration Route

First things first, decide where you want the UUID to change. For instance, I’m choosing to change the UUID on my second partition, which is /dev/sdb2. Remember, the same may vary for your system, so make sure you grab the desired directory properly.

Step 2: Unmount the File System

To change the UUID on Linux, you’ll need to unmount the desired partition. Figure out the mount point and use the unmount command in the following manner

Input:

$ unmount [mount point]
change UUID on Linux

Step 3: Using the tune2fs Command

With the tune2fs command, you’re looking at the utility that will  help you a lot in changing the UUID on Linux. The tune2fs is a brilliant tool that makes the system administrator capable of adjusting all sorts of tunable filesystem parameters available on Linux-based systems. It is through that functionality that makes UUID change attainable.

While passing the command, invoke the -U flag and instruct the system to generate a random UUID.

Input:

$ tune2fs -U random /dev/sdb2
how to use tune2fs command

Step 4: Verification

As soon as the tune2fs command concludes its operation, run the blkid command one more time and verify if you’ve successfully altered the UUID with the use of this command:

$ blkid | grep UUID

4 Ways to Retrieve the UUID 

Now that you know how to change the UUID on your Linux system, it is now the perfect time to also learn the best way to retrieve the identity whenever you want to. Read further and we’ll introduce you to the four unique ways that will help you get the job done in minutes.

Method 1. Invoking blkid Command

One of the most basic ways to retrieve the system UUID is by invoking the blkid command inside the Terminal. You can either run the code alone or specify the desired partition.

Input:

$ blkid [partition]
Method 2. Listing the Content

Listing the content is another excellent way to grab hold of the system UUID. For that, you can use the ls command alongside the -l flag in the following manner:

$ ls -l /dev/disk/by-uuid/
Method 3. Running the udevadm Command

Bringing the udevadm command to the scene will help you seamlessly retrieve the UUID. Pass the info option and the -q flag in the following manner:

$ udevadm info -q all -n /dev/sda2/ | grep uuid
Method 4. Using the hwinfo Command

The hwinfo is a brilliant utility if you’re willing to grab the UUID. But make sure you’ve got it installed before invoking. Here is what the command looks like:

$ hwinfo --block

Your system hard drive depends heavily on UUID for unique tags. These unique strings of characters help make the user’s life easy in case they face concerns regarding the identification of various storage-related components and hard disk partitions. 

And that is pretty much how you can change UUID on Linux. As you can understand from going through this article, getting the system UUID altered isn’t a hefty task, provided that you know the necessary changes and which commands to use, basically anyone can configure their UUID by themselves..

If this guide helped you, please share it.

Leave a Reply
Related Posts