3

Azure ARM template allows to specify dataDisks for VMs like:

"dataDisks": [
  {
    "lun": 0,
    "name": "[concat(variables('dataDiskName'), variables('nodesSuffixes')[copyIndex()])]",
    "diskSizeGB": "[parameters('dataDiskSizeGB')]",
    "createOption": "empty",
    "managedDisk": {
        "storageAccountType": "Standard_LRS"
    }
  }
]

On VM this disk sometimes becomes sda, sometimes sdc, etc.

How to predict the name of the disk in the VM? Or how to configure it to have a predictable name in /dev/disk/by-*

4c74356b41
  • 628
  • 5
  • 10
HUB
  • 6,322
  • 3
  • 22
  • 22

2 Answers2

2

Found a rule in /etc/udev/rules.d/ that creates symlinks like /dev/disk/azure/scsi1/lun0 which is OK for using with LVM. LUN can be specified in ARM template.

HUB
  • 6,322
  • 3
  • 22
  • 22
0

Normally, when we create a new Azure VM, the VM's OS disk name is /dev/sda, the temporary disk name is /dev/sdb.

Then we add a new data disk to this VM, by default, the new data disk name will be /dev/sdc.

We can't specify the name of data disk or rename it.

root@jasonvmm:~# fdisk -l
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x31520363

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 62914526 62912479  30G 83 Linux


Disk /dev/sdb: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xf50fb2f3

Device     Boot Start       End   Sectors Size Id Type
/dev/sdb1        2048 104855551 104853504  50G  7 HPFS/NTFS/exFAT




Disk /dev/sdc: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/sdd: 60 GiB, 64424509440 bytes, 125829120 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@jasonvmm:~# 
Jason Ye
  • 2,399
  • 1
  • 8
  • 10