VM OS disk is "sdb" sometimes ?!

RomainA 1 Reputation point
2021-12-21T10:28:25.55+00:00

Hi,

When I create a Virtual Machine Linux and attach a data disk, using cli, OS disk might be "sdb" sometimes (and data disk is "sda").
Why is that happened ? I didn't fin any documentation on that. And I haven't seen this with another cloud provider.

I tried to add a sleep of 30 seconds before adding data disk, but result is the same, sometimes OS disk is "sdb".

Here are commands used:

`
az vm create -g testrg -n test --nics test-nic \
 --public-ip-sku Standard --image almalinux:almalinux:8_4-gen2:8.4.20210729 --size Standard_D2s_v5 \ 
--storage-sku Standard_LRS --os-disk-size-gb 64 --os-disk-name test --availability-set test
az vm disk attach -g testrg -n data --vm-name test --sku Standard_LRS --size-gb 128 --new

Thank you for your help.

Have a good day

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
9,035 questions
Azure Disk Storage
Azure Disk Storage
A high-performance, durable block storage designed to be used with Azure Virtual Machines and Azure VMware Solution.
668 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. Manu Philip 20,206 Reputation points MVP Volunteer Moderator
    2021-12-21T10:46:30.493+00:00

    The term sd stands for SCSI disk. In most cases the OS disk is /dev/sda and in some odd cases it can be /dev/sdb also. This is not controlled by any Azure specific thing. This is a default Linux behavior. The ordering in which Linux enumerates SCSI devices is nondeterministic. It scans SCSI devices in the order they appear on the PCI Bus. Therefore, whichever disk is enumerated first is /dev/sda

    In a nut shell, The designation /dev/sda and /dev/sdb can be arbitrary as you can see in this documentation: Persistent_block_device_naming

    If the Answer is helpful, please click "Accept Answer" and upvote it

    1 person found this answer helpful.
    0 comments No comments

  2. Manu Philip 20,206 Reputation points MVP Volunteer Moderator
    2021-12-22T11:08:55.703+00:00

    I understand your concern. To address the issue, Microsoft has published an article here: https://learn.microsoft.com/en-us/troubleshoot/azure/virtual-machines/troubleshoot-device-names-problems
    Hope, this can help you !

    1 person found this answer helpful.
    0 comments No comments

  3. RomainA 1 Reputation point
    2021-12-22T09:49:38.31+00:00

    I'm not expert in this part, but I'm still very surprised about this behavior in Azure Cloud. It never happened for me in another other clouds with linux VM.

    Any ideas what I could do to avoid this ? Is there specific type of disk or VM ?

    It not accept


  4. RomainA 1 Reputation point
    2021-12-22T09:49:38.65+00:00

    Thank you for the answer.
    However, It not acceptable since deployment of tools are based on the fact that OS disk will be sda.

    I'm not expert in this part, but I'm still very surprised about this behavior in Azure Cloud. It never happened for me in another other clouds with linux VM.

    Any ideas what I could do to avoid this ? Is there specific type of disk or VM ?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.