How to Change UUID of Partition in Linux Filesystem

In this short tutorial, you are going to learn how to change the UUID of a Linux partition. This can help you in a less likely to happen scenario when the UUID of two partitions are the same.

In reality, this is really hard to happen, but it is still possible, if for example you copy a partition using dd command.

What is UUID?

UUID stands for Universally Unique IDentifier of a partition. This ID is used in few different places to identify the partition. Most commonly this would be /etc/fstab.

How to Find UUID of Your Filesystems

To find the UUID of your partitions, you can use blkid command as shown.

# blkid|grep UUID
Find Partition UUID in Linux
Find Partition UUID in Linux

How to Change UUID of Your Filesystems

Changing UUID of a filesystem is fairly easy. To do this, we are going to use tune2fs. For the purpose of this tutorial, I will change the UUID on my second partition /dev/sdb1, yours may vary, thus make sure you are changing the UUID of the desired filesystem.

The partition has to be unmounted prior apply the new UUID:

# umount /dev/sdb1
# tune2fs -U random /dev/sdb1 
# blkid | grep sdb1
Change Partition UUID in Linux
Change Partition UUID in Linux

The UUID has been successfully changed. Now you can mount the filesystem back again.

# mount /dev/sdb1

You can also update your /etc/fstab if needed, with the new UUID.

Conclusion

This was a short tutorial how to change a Linux partition UUID. The scenarios to use this are very rare and chances are that you will most probably use this on a local machine.

If you read this far, tweet to the author to show them you care. Tweet a thanks
Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

22 thoughts on “How to Change UUID of Partition in Linux Filesystem”

  1. This isn’t about changing the partition UUID at all (PARTUUID in blkid output), but the *filesystem* UUID within the partition.

    Reply
    • Exactly, I was searching for ways to change a PARTUUID, I already know how to change filesystem UUIDs.

      So this page is totally misleading.

      Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.