I did a small research before making the question,but I couldn't find an answer.My question is how can I change the uuid (universally unique identifier) of a hard drive disk.I am asking this because every time I want to access a hard drive from terminal I have to find these random uuid which the system has generated automatically which are quite long.Also,I want to know the dangers of making this kind of change.

  • Did you consider using a disk label instead? – Marco Mar 4 '12 at 15:22
  • 1
    Dang Marco, you got there before I did ;) – Chuck R Mar 4 '12 at 15:24
  • see also: askubuntu.com/a/49296/3940 – Takkat Mar 4 '12 at 15:48

You can change a partition UUID or label, how to do so is dependent on the file system.

For changing the label see


For changing the uuid, you can use uudigen and tune2fs


tune2fs /dev/hdb1 -U `uuid`

Change "/dev/sdb1" to the device you wish to change the uuid on.

You almost certainly will need to update /etc/fstab if you change the UUID on a partition that is mounted by fstab, such as / or /home or /swap


If you add a label to your partition using a tool like gparted, parted, etc. your disk will show up as /media/mydisklabel instead of /media/somerandomhex-digits-38characters

If you're in the terminal you could also do something like:

disk=/media/fb0* #If your UUID starts with fb0

to set a variable and instead of using cd /media/somerandomhex-digits-38characters you can use cd $disk. Or, if you memorize the first few characters, cd /media/fb0* works too.

The only way I know of to change a UUID is to re-format the disk, but it will just result in a different 38-character UUID, so it doesn't solve the problem.

  • Okay guys!I did it the relabeling with gparted and it worked.Thank you all for your answers! BTW,IS THERE ANYWAY TO CHANGE THE LABEL OF THE HDD THAT I HAVE INSTALLLED THE UBUNTU,WHICH I AM CURRENTLY RUNNING? – el10780 Mar 4 '12 at 15:53
  • yeah you are right Githlar!But I just want to organize my hdd space according to hdd labels.Like SecA(for the first hard drive),SecB (for the second hard drive) etc.... – el10780 Mar 4 '12 at 20:25
  • The hard drives themselves cannot be changed, they are referenced as /dev/sdX (IDE may still be /dev/hdX, but I don't own any IDE drives to check that). The X is either it's order in the SATA/IDE array (0=a, 1=b, 2=c, etc) or the order in which it was hot-plugged in the case of fireware/USB. This is a udev/kernel function and cannot be easily changed without hacking some source code. Even then I'm not sure how you'd identify a specific drive, but if you did manage it would make that kernel specific to that computer and you'd have to re-hack it for each computer you intend to install on. – Chuck R Mar 5 '12 at 7:51

You can change the LABELS of the hard drives but when doing so they will have to be unmounted. If you are booted into the system then it is not able to be revised. Recommend using Gparted Live CD because it will do the job an not regress the installed system.

  • You are absolutely right!I did it and the changes took effect!Thanks. – el10780 Mar 4 '12 at 21:20
  • A screen-shot could be very helpful. Please post a screen-shot of the changed hdd label. – Curious Apprentice May 8 '12 at 15:54

When I had faced the same problem, I've also tried to find solution for my question here. The question is just about how to identify HDD disk. So the solution for me was just to set identify as a "LABEL" instead of "UUID" in the Disks -> Mount Options. The details can be found here: How to change mounted HDD UUID to human-readable?

  • How is your answer different from the accepted answer? – user68186 Feb 21 at 16:55
  • I just give another simple solution which worked for me, and that I wish I found here in this post. But unfortunately was forced to find a solution by myself. That's why some people may find it useful. – Ivan Sidaruk Feb 21 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.