Top Nav

Archive | Linux

How-to Change UUID Of A Disk

When cloning or restoring disk volumes is possible to run into problem which conflicting UUID values. Each disk volume needs to be assigned a unique UUID. The UUID is store on the volume. A cloned or restored disk will have the same UUID as volume from which it was generated.

By default you are not allowed to mount two volumes with the same UUID. This can overcome with the “nouuid” mount option:

Often a server will be configured to select the root partition on boot by UUID. This makes is easy to ensure that the right volume is selected as the root. But if you have two volumes with the same UUID then the kernel will randomly select which volume to mount. This situation can occur when you’ve mounted a cloned or restored copy of the root volume and then reboot without removing the clone.

To list the UUID of all devices use the “blkid” command:

A new unique UUID can be generated with the “uuidgen” command:

The UUID of an XFS volume can be changed with:

Or let xfs_admin handle generating the new UUID:

For ext2/3/4 the tune2fs command can be used:

Or in a single line:

WARNING: Changing the UUID of an actively mounted disk volume can have unpredictable effects. Always work on unmounted volumes.

0

“find” Newer Files & Sort By Date

Sort “find” results by date:

Find files newer then a specific file:

And combined:

 

 

0

Mounting cloned disk

If you try to mount a cloned disk then you may get an error about duplicate UUID values. You can override with the “nouuid” option:

If the disk is using LVM then additional steps will be required:

Now you can list the partitions with lsblk and mount the desired logical volume with the “nouuid” option.

 

 

0

Yum 404 Error On Xen-46

On CentOS 7, getting 404 error from yum when trying to update.

The error is related to Xen-46 which has been removed. The fix is to remove the repo and add the new Xen-48 repo:

 

 

0