Muokkaa

Jaa


Attach or detach a data disk for a lab virtual machine in Azure DevTest Labs

This article explains how to attach and detach a lab virtual machine (VM) data disk in Azure DevTest Labs. You can create, attach, detach, and reattach multiple data disks for lab VMs that you own. This functionality is useful for managing storage or software separately from individual VMs.

Prerequisites

To attach or detach a data disk, you need to own the lab VM, and the VM must be running. The VM size determines how many data disks you can attach. For more information, see Sizes for virtual machines.

Create and attach a new data disk

Follow these steps to create and attach a new managed data disk for a DevTest Labs VM.

  1. Select your VM from the My virtual machines list on the lab Overview page.

  2. On the VM Overview page, select Disks under Settings in the left navigation.

  3. On the Disks page, select Attach new.

    Screenshot of Attach new on the V M's Disk page.

  4. Fill out the Attach new disk form as follows:

    • For Name, enter a unique name.
    • For Disk type, select a disk type from the drop-down list.
    • For Size (GiB), enter a size in gigabytes.
  5. Select OK.

    Screenshot of the Attach new disk form.

  6. After the disk is attached, on the Disks page, view the new attached disk under Data disks.

    Screenshot of the new data disk under Data disks on the Disks page.

Attach an existing data disk

Follow these steps to attach an existing available data disk to a running VM.

  1. Select your VM from the My virtual machines list on the lab Overview page.

  2. On the VM Overview page, select Disks under Settings in the left navigation.

  3. On the Disks page, select Attach existing.

    Screenshot of Attach existing on the V M's Disk page.

  4. On the Attach existing disk page, select a disk, and then select OK.

    Screenshot of attach existing data disk to a virtual machine.

  5. After the disk is attached, on the Disks page, view the attached disk under Data disks.

Detach a data disk

Detaching removes the lab disk from the VM, but keeps it in storage for later use.

Follow these steps to detach an attached data disk from a running VM.

  1. Select the VM with the disk from the My virtual machines list on the lab Overview page.

  2. On the VM Overview page, select Disks under Settings in the left navigation.

  3. On the Disks page, under Data disks, select the data disk you want to detach.

    Screenshot of selecting a data disk to detach.

  4. On the data disk's page, select Detach, and then select OK.

    Screenshot showing Detach on the Data disk page.

The disk is detached, and is available to reattach to this or another VM.

Detach or delete a data disk on the lab management page

You can also detach or delete a data disk without navigating to the VM's page.

  1. In the left navigation for your lab's Overview page, select My data disks under My Lab.

  2. On the My data disks page, either:

    • Select the disk you want to detach, and then on the data disk's page, select Detach and then select OK.

      or

    • Select the ellipsis (...) next to the disk you want to detach, select Detach from the context menu, and then select Yes.

      Screenshot of detaching a data disk from the listing's context menu.

You can also delete a detached data disk, by selecting Delete from the context menu or from the data disk page. When you delete a data disk, it is removed from storage and can't be reattached anymore.

Next steps

For information about transferring data disks for claimable lab VMs, see Transfer the data disk.