Ubuntu – Is it a problem to temporarily have the same UUID for two partitions

16.04partitioningssduuid

While following the instructions in Move your Linux installation to a new Solid State Drive – even a smaller one, I got stuck right after point "9." where I have copied the UUID of sdb6 (filesystem of the running ubuntu on HDD) on sda1 (wannabe new filesystem in the SSD) using tune2fs.

While I try to get un-stuck…(I'll post a thread soon about it) is it a problem to run the system while having the same UUID on two partitions?

If so, considering as well that I don't know the original UUID of the sda1 partition, would it be ok to just invent one, for example by changing a character of the UUID?

System information
Ubuntu 16.04

$ fdisk -l

Disk /dev/sda: 119.2 GiB, 128035676160 bytes, 250069680 sectors
...
Device     Boot Start       End   Sectors   Size Id Type
/dev/sda1        2048 225282211 225280164 107.4G 83 Linux


Disk /dev/sdb: 465.8 GiB, 500107862016 bytes, 976773168 sectors
...
Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048 318919887 318917840 152.1G  7 HPFS/NTFS/exFAT
/dev/sdb2       318920702 976771071 657850370 313.7G  5 Extended
/dev/sdb5       960151552 976771071  16619520   7.9G 82 Linux swap / Solaris
/dev/sdb6       318920704 960151551 641230848 305.8G 83 Linux

Best Answer

Some system tools refer to partitions by UUID numbers. This is common in /etc/fstab, for instance; partitions are identified for mounting by their UUID numbers rather than in some other way. Thus, duplicate UUID numbers can cause confusion and inconsistency -- on one boot, one partition might be mounted; but on another mount, the other partition might be mounted. This could create problems if files on that partition are changed, as is likely on most partitions.

You can learn what UUID a partition uses via the blkid command:

$ sudo blkid /dev/sdc3
/dev/sdc3: UUID="5028fa50-0079-4c40-b240-abfaf28693ea" TYPE="ext4" PARTLABEL="Xubuntu /boot" PARTUUID="74ed9e82-2e96-4a12-89e0-e0563c296a08"

This example reveals that /dev/sdc3 has a UUID of 5028fa50-0079-4c40-b240-abfaf28693ea.

You can change a UUID with various filesystem-specific tools. For ext2/3/4fs, this tool is called tune2fs, and you pass it the -U option to change a UUID. You will, however, need a new UUID, and you can generate this with the uuidgen tool, which you can call as part of the call to tune2fs:

$ sudo tune2fs -U $(uuidgen) /dev/sdc3

You'd need to change the device ID (/dev/sdc3 in this example) for your system, of course.

If your partition uses a filesystem other than ext2/3/4fs, you'll need to use a tool other than tune2fs, such as xfs_admin for XFS or btrfstune for Btrfs.

If the partition is being mounted in /etc/fstab, identified by UUID in a grub.cfg file, or otherwise referenced, you may need to adjust that configuration file after making your change.

Related Question