When you managing IaaS Virtual Machines – you may need to perform a quite a regular maintenance task to update or change the disk layout or increase the disk size.

While it is quite straightforward operation within Azure, it may become slightly complicated if you need to update a VM that has quite a few disks attached, especially if they hare the same size.

In my example below, we have a VM with four data disks attached:

VM disk layout

I needed to replace three of four disks with new raw disks, leaving one of the disks, listed on the VM as “sfd” unaffected. So I had to find which disk in azure is that.

On linux VM it turned out to be an easy tasks. You just need to list the block devices information as below:

List block devices and their information

# ls -ld /sys/block/sd*/device
lrwxrwxrwx. 1 root root 0 Jul 16 12:09 /sys/block/sda/device -> ../../../2:0:0:0
lrwxrwxrwx. 1 root root 0 Jul 16 12:09 /sys/block/sdb/device -> ../../../3:0:1:0
lrwxrwxrwx. 1 root root 0 Jul 9 18:34 /sys/block/sdc/device -> ../../../5:0:0:18
lrwxrwxrwx. 1 root root 0 Jul 16 12:09 /sys/block/sdd/device -> ../../../5:0:0:17
lrwxrwxrwx. 1 root root 0 Jul 9 18:34 /sys/block/sde/device -> ../../../5:0:0:16
lrwxrwxrwx. 1 root root 0 Jul 16 12:09 /sys/block/sdf/device -> ../../../5:0:0:15

As you can see from the output – it shows you what “Lun” each device is using. That can be correlated with the information from the Azure Portal. In my case sdf was listed as connected via LUN 15, which was correlating to “Disk One” in Azure Portal.

So I just had to replace 3 other disks.