Today, in an article of little use to anyone, we’re going to learn how to change the UUID for your disk partitions. It’s not something you’ll want to do often, or even at all. There really isn’t much motivation to do so. In fact, this might just be one of the more useless articles (that isn’t a meta article) on the entire site! (I should mark it as ‘important’ for my own amusement.)
Why then is this an article? Well, it’s kinda neat, a little informative, and it was in my notes! As to why it is in my notes, I think I documented the process for a person on one of the various forums. I have no idea why they wanted to do this, but it is something you can do. I did check to ensure that it should still work.
A ‘UUID’ is a Universally Unique Identification. Your partitions have one. It’s a 128-bit alpha-numeric identification used internally seldom by you the user. At 128 bits, odds are very good that your ID is truly unique – but there’s no actual verification or anything. Your system generates ’em more or less pseudo-randomly and that’s the end of it.
If you want, run this command in your terminal (open a terminal, per my usual remarks):
That should show you your partitions and their UUID. It’ll also spit out a bunch of information that will help you identify it – such as the label field. That’s good, as you’ll want to pick one that you just don’t like and we’ll work on changing that one UUID to something new.
Change The UUID For Your Disk Partitions:
Up above, you should have opened a terminal and loaded up some information about your various partitions. Lemme see if I can get you a good example output – I’ll plug in an external drive with a bunch of partitions:
So, there… You can see some data and see the UUID. Should you want to actually change the UUID, now’s the time to pick it.
Now, we’re going to generate a new UUID. Yup, you can do that. Try one of the following two commands – though both should probably do the trick:
One, or both, of those will surely work on any modern Linux distro – unless it’s stripped down. If you don’t like the first one, you can keep generating them until you’re happy with the results. (You’re very, very unlikely to have a duplicate – as I’ll explain later, in the closure section.)
Now that you have your new UUID in hand, you’ll need to unmount the partition you’re going to change. If you don’t know how to do that, it’s just:
For example, that might be
/dev/sdb4 that you’ll use to unmount the partition.
With that unmounted, let’s go ahead and finally change the UUID! You do that with:
Be sure to change the obvious for the obvious. Copy and paste from your terminal, perhaps even using two terminals, to ensure you get all the information correct.
When you’re done, the effects should be immediate. though you may need to mount the partition first. Run the following command to check:
If you’re satisfied with the results, great! If you need to first mount the partition, you can try this:
All should be wrapped up nicely in a bow, with your UUID happily changed to something else. Again, I don’t really have any good reasons for doing this – but you can do so if you want. I did mention that this was pretty useless… You were warned!
Well, there you have it – another article? Hmm… Let’s really wrap it up. You know how it says it’s a “Universally Unique Identification? Let’s look into that with some math.
Well, it’s 128 bits. That’s 2128 (less if a signed integer) which is equal to ~3.4 x 1038. I decided to look that up and find someone who did the work for me. This is that number represented in English:
three hundred forty undecillion, two hundred eighty-two decillion, three hundred sixty-six nonillion, nine hundred twenty octillion, nine hundred thirty-eight septillion, four hundred sixty-three sextillion, four hundred sixty-three quintillion, three hundred seventy-four quadrillion, six hundred seven trillion, four hundred thirty-one billion, seven hundred sixty-eight million, two hundred eleven thousand, four hundred fifty-five
So, is the UUID you have truly unique? If you change the UUID, is it truly unique among all others? Perhaps, but you have better odds of winning the lottery multiple times in a row than you have of finding a matching UUID anywhere on the planet. 128 bits is a lot, an amount your human brain isn’t able to understand, which is also kinda why we will likely be a while longer before we move there from 64 bit. 64 bit is still pretty darned huge and there’s no real need for 128 bits at this time.