When you clone a disk, everything gets cloned, including the disk and partition UUIDs. That becomes a problem when both disks are connected to the system at the same time.
You need to change the UUID on the original disk, or the clone disk. However, if you change the UUID on the original disk, you'll have to also edit /etc/fstab. If you change the UUID on the clone disk, no /etc/fstab edits are required (unless the clone disk is eventually installed into the system, in place of the original disk, and then /etc/fstab will need to be updated with the new UUID, or /dev/sdaX device name).
Note: There should be no reason to mount both the original disk, and the cloned disk, by additional edits to /etc/fstab. A clone disk is normally used to create a backup, or to transfer from a smaller original disk, to a larger clone disk, and then exchanged in the system.
Note: Clone disk booting issues can normally be fixed by the use of boot-repair
.
There are two commands required to make UUID changes. See the following man pages...
man uuidgen
man tune2fs
uuidgen
example: uuidgen -r
or uuidgen -t
-r, --random
Generate a random-based UUID. This method creates a UUID con‐
sisting mostly of random bits. It requires that the operating
system have a high quality random number generator, such as
/dev/random.
-t, --time
Generate a time-based UUID. This method creates a UUID based on
the system clock plus the system's ethernet hardware address, if
present.
tune2fs
example: sudo tune2fs -U new_UUID /dev/sdbX
-U UUID
Set the universally unique identifier (UUID) of the filesystem
to UUID. The format of the UUID is a series of hex digits sepa‐
rated by hyphens, like this:
"c1b9d5a2-f162-11cf-9ece-0020afc76f16". The UUID parameter may
also be one of the following:
clear clear the filesystem UUID
random generate a new randomly-generated UUID
time generate a new time-based UUID
The UUID may be used by mount(8), fsck(8), and /etc/fstab(5)
(and possibly others) by specifying UUID=uuid instead of a block
special device name like /dev/hda1.
See uuidgen(8) for more information. If the system does not
have a good random number generator such as /dev/random or
/dev/urandom, tune2fs will automatically use a time-based UUID
instead of a randomly-generated UUID.
Update #1:
corrected fstab of ubuntu of 20.04 on NVME
Note: there should be no TABS in fstab, only spaces
#/etc/fstab: static file system information.
#Use 'blkid' to print the universally unique identifier for a
#device; this may be used with UUID= as a more robust way to name devices
#That works even if disks are added and removed. See fstab(5).
#<file system> <mount point> <type> <options> <dump> <pass>
#/ was on /dev/nvme0n1p2 during installation
UUID=5d01e76f-5114-4416-b810-5de33dafa914 / ext4 errors=remount-ro 0 1
/swapfile none swap sw 0 0
UUID=4860-509F /boot/efi vfat defaults 0 1