[Solved] How to change UUID

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Chemical_Ali
Level 2
Level 2
Posts: 67
Joined: Wed Jun 05, 2013 9:27 am

[Solved] How to change UUID

Post by Chemical_Ali » Fri Apr 07, 2017 7:39 am

Good morning,

For backup purposes, I created clone of one of my internal HDD. However, whilst the internal HDD is mounted (it is automatically mounted on startup), I cannot mount the backup drive, because there are two identical UUIDs.

/dev/sdd: LABEL="Toshiba" UUID="f32c5394-5b1a-4111-9a5e-389cb8f7f16b" TYPE="ext4" PTUUID="08d1c1a2" PTTYPE="dos"
/dev/sdg: LABEL="blue" UUID="f32c5394-5b1a-4111-9a5e-389cb8f7f16b" TYPE="ext4"

I tried using uuidgen to generate a new UUID, then tune2fs to change UUID:

sudo tune2fs /dev/sdg -U 89b7abcb-3223-4383-9673-7a163326e8b

But, tune2fs keeps telling me to run e2fsck on the filesystem.

Any ideas? Thanks.
Last edited by Chemical_Ali on Fri Apr 07, 2017 7:51 pm, edited 1 time in total.

Cosmo.
Level 23
Level 23
Posts: 17830
Joined: Sat Dec 06, 2014 7:34 am

Re: How to change UUID

Post by Cosmo. » Fri Apr 07, 2017 7:55 am

There is an easy way to change the UUID with gparted in the context menu of the partition in gparted. The partition must not be mounted for this task.

Chemical_Ali
Level 2
Level 2
Posts: 67
Joined: Wed Jun 05, 2013 9:27 am

Re: How to change UUID

Post by Chemical_Ali » Fri Apr 07, 2017 8:02 am

I tried Gparted. But it looks like Gparted also calls tune2fs, so I am getting the same error message.

Cosmo.
Level 23
Level 23
Posts: 17830
Joined: Sat Dec 06, 2014 7:34 am

Re: How to change UUID

Post by Cosmo. » Fri Apr 07, 2017 8:19 am

This sounds, as if the file system on this partition is corrupted. Run in the terminal fsck /dev/sdaX. You have to replace aX with the proper values. Important: The partitions must not be mounted! Alternatively you run in the terminal sudo touch /forcefsck; with the next reboot all partitions get checked.

User avatar
Flemur
Level 17
Level 17
Posts: 7370
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to change UUID

Post by Flemur » Fri Apr 07, 2017 9:59 am

Chemical_Ali wrote:I tried using uuidgen to generate a new UUID, then tune2fs to change UUID:
sudo tune2fs /dev/sdg -U 89b7abcb-3223-4383-9673-7a163326e8b.
/dev/sdg is the whole disk. Try that command with the correct partition number, e.g. /dev/sdg1
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

Chemical_Ali
Level 2
Level 2
Posts: 67
Joined: Wed Jun 05, 2013 9:27 am

Re: How to change UUID

Post by Chemical_Ali » Fri Apr 07, 2017 7:37 pm

Flemur wrote:/dev/sdg is the whole disk. Try that command with the correct partition number, e.g. /dev/sdg1
Yep. I am using a 6TB HDD that only has one partition.

Chemical_Ali
Level 2
Level 2
Posts: 67
Joined: Wed Jun 05, 2013 9:27 am

Re: How to change UUID

Post by Chemical_Ali » Fri Apr 07, 2017 7:49 pm

Cosmo. wrote:This sounds, as if the file system on this partition is corrupted. Run in the terminal fsck /dev/sdaX. You have to replace aX with the proper values. Important: The partitions must not be mounted! Alternatively you run in the terminal sudo touch /forcefsck; with the next reboot all partitions get checked.
I tried the terminal command, which ran for a second and didn't report any errors. But, I was still unable to change the UUID using the terminal.

However, I ran 'Check' from GParted, which ran for a bit longer. Then I was able to change the UUID using GParted. Unfortunately, I forgot to copy and paste the log files, but there were no errors as far as I recall. Now I am able to mount both backup drive and internal drive without any issues.

It has been a good learning experience. Thank you and Flemur for your help. :)

User avatar
Flemur
Level 17
Level 17
Posts: 7370
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: How to change UUID

Post by Flemur » Sat Apr 08, 2017 9:49 am

Chemical_Ali wrote:Yep. I am using a 6TB HDD that only has one partition.
That would be /dev/sdg1, NOT /dev/sdg.
However, I ran 'Check' from GParted, which ran for a bit longer. Then I was able to change the UUID using GParted.
Your terminal command was referencing the whole disk, not a partition. Partitions are what gets mounted; gparted assigned the UUID to the partition.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?

Post Reply

Return to “Newbie Questions”