How to attach a data disk to a Linux VM in the Azure portal

This article shows you how to attach both new and existing disks to a Linux virtual machine through the Azure portal. You can also attach a data disk to a Windows VM in the Azure portal. You can choose to use either Azure Managed Disks or unmanaged disks. Managed disks are handled by the Azure platform and do not require any preparation or location to store them. Unmanaged disks require a storage account and have some quotas and limits that apply. For more information about Azure Managed Disks, see Azure Managed Disks overview.

Before you attach disks to your VM, review these tips:

Find the virtual machine

  1. Sign in to the Azure portal.
  2. On the Hub menu, click Virtual Machines.
  3. Select the virtual machine from the list.
  4. To the Virtual machines blade, in Essentials, click Disks.

    Open disk settings

Continue by following instructions for attaching either a managed disk or unmanaged disk.

Use Azure Managed Disks

Attach a new disk

  1. On the Disks blade, click + Add data disk.
  2. Click the drop-down menu for Name and select Create disk:

    Create Azure managed disk

  3. Enter a name for your managed disk. Review the default settings, update as necessary, and then click Create.

    Review disk settings

  4. Click Save to create the managed disk and update the VM configuration:

    Save new Azure Managed Disk

  5. After Azure creates the disk and attaches it to the virtual machine, the new disk is listed in the virtual machine's disk settings under Data Disks. As managed disks are a top-level resource, the disk appears at the root of the resource group:

    Azure Managed Disk in resource group

Attach an existing disk

  1. On the Disks blade, click + Add data disk.
  2. Click the drop-down menu for Name to view a list of existing managed disks accessible to your Azure subscription. Select the managed disk to attach:

    Attach existing Azure Managed Disk

  3. Click Save to attach the existing managed disk and update the VM configuration:

    Save Azure Managed Disk updates

  4. After Azure attaches the disk to the virtual machine, it's listed in the virtual machine's disk settings under Data Disks.

Use unmanaged disks

Attach a new disk

  1. On the Disks blade, click + Add data disk.
  2. Review the default settings, update as necessary, and then click OK.

    Review disk settings

  3. After Azure creates the disk and attaches it to the virtual machine, the new disk is listed in the virtual machine's disk settings under Data Disks.

Attach an existing disk

  1. On the Disks blade, click + Add data disk.
  2. Under Attach existing disk, click VHD File.

    Attach existing disk

  3. Under Storage accounts, select the account and container that holds the .vhd file.

    Find VHD location

  4. Select the .vhd file.
  5. Under Attach existing disk, the file you just selected is listed under VHD File. Click OK.
  6. After Azure attaches the disk to the virtual machine, it's listed in the virtual machine's disk settings under Data Disks.

Next steps

After the disk is added, you need to prepare it for use. For more information, see How to: Initialize a new data disk in Linux.