About Virtual Machine Disks in Azure

Note

This article will be removed from the Azure library in the coming weeks. Newer information is available on the Azure website. See About Disks and VHDs for Virtual Machines.

Just like any other computer, virtual machines in Azure use disks as a place to store an operating system, applications, and data.

All Azure virtual machines have at least two disks – an operating system disk and a temporary disk. They also can have one or more data disks. The following diagram shows how these three types of disks appear from inside a Windows virtual machine.

Manage disks in Windows Server

The operating system disk and all data disks are actually virtual hard disks (VHDs) located in an Azure storage account. (For details, see About VHDs in Azure). The temporary disk is not stored in Azure storage.

  • Operating system disk - Every virtual machine has one attached operating system disk. It’s registered as a SATA drive and labeled as the C drive. This disk has a maximum capacity of 127 GB. When Azure creates an operating system disk, three copies of the disk are created for high durability. Additionally, if you configure the virtual machine for geo-replication, your VHD is also replicated to different sites more than 400 miles apart.

    Note

    If you need to troubleshoot issues on an operating system disk, you can attach the disk as a data disk to another running virtual machine to access the data on the disk and diagnose problems using the logs.

  • The temporary disk is automatically created for you. On Windows virtual machines, this disk is labeled as the D drive. On Linux virtual machines, the disk is typically /dev/sdb and is formatted and mounted to /mnt/resource by the Azure Linux Agent.

    Important

    Don’t store data on the temporary disk. This disk provides temporary storage for applications and processes and is used to store data that you don’t need to keep, such as page or swap files. To remap this disk for a Windows VM, see How To Change the Drive Letter of the Windows Temporary Disk.

  • Data disk – A data disk is a VHD that’s attached to a virtual machine to store application data, or other data that you need to keep. Data disks are registered as SCSI drives and are labeled with a letter that you choose. The size of the virtual machine determines how many data disks you can attach to it and the type of storage you can use to host the disks. Each data disk has maximum capacity of 1 TB. For more information, see Virtual Machine and Cloud Service Sizes for Azure.

About creating disks or using existing disks

Azure creates the operating system disk for you when you create a virtual machine. If you use an image that includes data disks, then Azure also creates the data disks when it creates the virtual machine. (You can use an image from Azure or a partner, or one you provide. For more details, see About Virtual Machine Images in Azure.) Otherwise, you add data disks after you create the virtual machine.

You can add data disks to a virtual machine at any time, by ‘attaching’ the disk to the virtual machine. You can use a VHD that you’ve uploaded or copied to your storage account, or you can have Azure create a VHD for you by attaching an empty disk. Attaching a data disk associates the VHD file from your storage account with the virtual machine, by placing a ‘lease’ on the VHD so it can’t be deleted from storage while it’s attached to a virtual machine.

For instructions, see one of the following:

Linux Windows

How to Attach a Data Disk to a Linux Virtual Machine

How to Attach a Data Disk to a Windows Virtual Machine

Creating and Uploading a Virtual Hard Disk that Contains the Linux Operating System

Create and upload a Windows Server VHD to Azure

Considerations about configuring your disks

Following are some considerations about configuring disks in Azure.

Disk Caching

The operating system disk and data disk each have a host caching setting (sometimes called host-cache mode) that can improve performance under some circumstances. However, these settings can negatively affect performance in other circumstances, depending on the application. Host caching is off by default for both read operations and write operations for data disks. Host-caching is on by default for read and write operations for operating system disks. To change the setting in data disks, use the Set-AzureDataDisk cmdlet. To change it in operating system disks, use the Set-AzureOSDisk cmdlet.

Avoid use of striped disks with geo-replication

Data loss may occur if you use striped volumes (Windows or Linux) in geo-replicated storage accounts. If a storage outage occurs that requires restoring data from a replicated copy, there is no guarantee that the write order of the stripe disk set would be intact once restored.

Manage your disks

For both operating system disks and data disks, you can view a list of disks, add and delete disks, and update disks.

You can find the disks that are attached to a virtual machine by using either the dashboard or the Disks page of Virtual Machines in the Management Portal.

Use the dashboard to find information about attached disks

  1. If you have not already done so, sign in to the Azure Management Portal.

  2. Click Virtual Machines, and then select the appropriate virtual machine.

  3. Click Dashboard. On the dashboard for the virtual machine, you can find the number of attached disks and the names of the disks. The following example shows one data disk attached to a virtual machine:

    Find the attached data disks

    Note

    The temporary local disk is not listed in the disks section.

Use the Disks page of Virtual Machines to find information about attached disks

  1. If you have not already done so, sign in to the Azure Management Portal.

  2. Click Virtual Machines, and then click Disks. This page shows a list of all disks that are available to use with virtual machines, and it shows the disks that are being used by virtual machines. The list is a combination of operating system disks and data disks. To differentiate between the two types of disks, review disk information in the dashboard.

    Note

    When you attach a new data disk to a virtual machine, you can provide a name for the .vhd file that is used for the disk, but Azure provides a name for the disk. The name consists of the cloud service name, the virtual machine name, and a numeric identifier.

Delete a disk

You can delete operating system disks and data disks if you do not need them anymore. To delete an operating system disk, you can delete it when you delete the virtual machine. You’ll need to detach the disk from the virtual machine first, unless you delete the virtual machine at the same time. For instructions, see How to Detach a Data Disk from a Virtual Machine.

To delete a disk by using the Management Portal

  1. If you have not already done so, sign in to the Azure Management Portal.

  2. Click Virtual Machines, and then click Disks.

  3. Select the disk that you want to delete, and then click Delete Disk.

For information about managing disks from the command-line or script, or programmatically, see one of these reference sets: