If you create a disk from a snapshot of a disk on a Linux instance and attach the created disk to the Linux instance, the universally unique identifier (UUID) of the disk conflicts with that of the disk from which the snapshot is created. This topic describes how to modify the UUID of a disk.

Background information

After a disk is created from a snapshot of a disk on a Linux instance, the UUID of the created disk is the same as that of the disk from which the snapshot is created. If you attach the created disk to the Linux instance, the UUID of the disk conflicts with that of the disk from which the snapshot is created. The following issues may occur:
  • If you create a disk from a system disk snapshot of a Linux instance and attach the created disk to the Linux instance, Linux may be started from the newly attached data disk rather than the system disk.
  • If your disk uses the XFS file system, the mount operation is prohibited due to a UUID conflict. The "mount: wrong fs type, bad option, bad superblock on /dev/vdd1," message appears.
Therefore, after you create a disk from a snapshot of a disk on a Linux instance and attach the created disk to the Linux instance in the console, you must log on to the instance to modify the UUID of the created disk before you perform the mount operation. To modify the UUID of your disk, you can run the blkid command to query its file system type and choose one of the following methods based on the command output:

Modify the UUID of an ext2, ext3, or ext4 file system

Note In this example, /dev/vdb1 is used. You must modify the related commands based on your device name.
  1. Remotely connect to an ECS instance. For more information, see Connect to a Linux instance by using password authentication.
  2. Run the following command to query the UUID of the created disk:
    blkid
    The following command output shows that the UUID of the disk created from a snapshot is the same as that of the disk from which the snapshot is created.The UUID information
  3. Run the following command to check the file system:
    e2fsck -f /dev/vdb1
  4. Run the following command to generate a new UUID for the created disk:
    uuidgen | xargs tune2fs /dev/vdb1 -U
  5. Run the following command to check whether the UUID is modified:
    blkid
    The following command output shows that the UUID of /dev/vdb1 is modified.The UUID is changed
  6. Run the following command to attach the created disk:
    mount /dev/vdb1 /mnt
  7. Configure the /etc/fstab file to automatically attach the created disk on startup.
    For information about how to configure the /etc/fstab file, see Configure UUIDs in the fstab file to automatically attach data disks.

Modify the UUID of an XFS file system

Note In this example, /dev/vdd1 is used. You must modify the related commands based on your device name.
  1. Remotely connect to an ECS instance. For more information, see Connect to a Linux instance by using password authentication.
  2. Run the following command to query the UUID of the created disk:
    blkid
    The following command output shows that the UUID of the disk created from a snapshot is the same as that of the disk from which the snapshot is created.xfs-uuid
  3. Run the following command to generate a new UUID for the created disk:
    xfs_admin -U generate /dev/vdd1
  4. Run the following command to check whether the UUID is modified:
    blkid
    The following command output shows that the UUID of /dev/vdd1 is modified.The UUID result - XFS
  5. Run the following command to attach the created disk:
    mount /dev/vdd1 /mnt
  6. Configure the /etc/fstab file to automatically attach the created disk on startup.
    For information about how to configure the /etc/fstab file, see Configure UUIDs in the fstab file to automatically attach data disks.

References