Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Did you consider using a disk label instead? – Marco Mar 4 '12 at 15:22
Dang Marco, you got there before I did ;) – Chuck R Mar 4 '12 at 15:24
see also: – Takkat Mar 4 '12 at 15:48
up vote 1 down vote accepted

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

share|improve this answer
Thanks mate!I bookmarked the website for the next time! – el10780 Mar 4 '12 at 20:27

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.

share|improve this answer
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.

share|improve this answer
You are absolutely right!I did it and the changes took effect!Thanks. – el10780 Mar 4 '12 at 21:20
Cool I'll take that answered your question (accepted) – Ringtail Mar 4 '12 at 21:32
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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