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 /dev/sdb1 -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 Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

5 Responses

  1. sitaram says:

    First, even if you think all your readers will only be using ext2/3/4, you should at least mention that this only works for those filesystems.

    Second, you’ve not said anything about *why* someone might want to *change* a UUID! I have never encountered a reason to do this, in real life (and the few instances that this may be needed are NOT for ext2/3/4 systems anyway!)

  2. Donald L Wilson says:

    You could also do this to make it easy to remember:
    # tune2fs /dev/sda2 -U 12345678-abcd-1234-abcd-12ab34cd56ef

  3. andy says:

    so, how to change uuid of root (/) partition?

    I got a message “The UUID may only be changed when the filesystem is unmounted” when I typed the tune2fs command with parameters.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.