Disk UUIDs and Linux on Azure
I recently ran a few tests to figure out how UUIDs behave on Azure when we capture VM Images, copy VHDs, move Virtual Machines and re-provision them in different data centers.
My observations have shown me that UUIDs do not change unless one of the following actions is performed on the VHD partition:
- UUIDs are assigned when we create a File System.
- UUIDs change if we use tune2fs to change the UUID or if we use mkfs to replace the File System.
Each Virtual Machine has a Temp Disk (sdb). This is a physical disk, and we should never take a UUID dependency on it. The reason for this warning, is that its UUID is to be considered volatile. It changes every time Azure moves the Virtual Machine to a host. It may also change if the Azure Fabric replaces the Temp Disk File System.
Lastly, it’s important to note that the UUID of a Virtual Machine OS Disk is assigned when it is created. On CentOS Virtual Machines, the root is mounted using the UUID. Don’t worry thought, it will not change.
In the following scenarios, I noticed that the UUIDs are unaffected:
- When we copy VHDs, the UUIDs do not change.
- When we deploy a VM using a VM Image, the UUIDs remain the identical.
- When we capture an image with attached data disks, the OS Disk UUID remains, and we must make copies of the attached Data Disks.
In this last scenario, a copy of the Data Disks is required to keep the Data Disk UUIDs. Without these disks, a Virtual Machine created from the VM Image would result in a prompt a boot time. This prompt appears because the Virtual Machine is unable to find the Partition UUIDs that match the UUIDs from the fstab. Ultimately, this can result in a failed deployment and create can be challenging to troubleshoot and fix.