Attach or detach a data disk for a lab VM in Azure DevTest Labs
This article explains how to attach and detach a lab virtual machine (VM) data disk in Azure DevTest Labs by using the Azure portal. Depending on the VM size, you can create, attach, detach, and reattach multiple data disks. Data disks let you manage storage or software separately from individual VMs.
Prerequisites
To attach or detach a data disk, you must have ownership permissions on 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.
In the Azure portal, select your VM from the My virtual machines list on your lab Overview page.
On the VM Overview page, select Disks under Settings in the left navigation.
On the Disks page, select Attach new.
On the Attach new disk page:
- For Name, enter a unique name.
- For Disk type, select a disk type from the dropdown list.
- For Size (GiB), enter the disk size in gigabytes.
Select OK.
After the disk is attached, on the Disks page, view the new attached disk under Data disks.
Attach an existing data disk
Follow these steps to attach an existing available data disk to a running VM.
In the Azure portal, select your VM from the My virtual machines list on the lab Overview page.
On the VM Overview page, select Disks under Settings in the left navigation.
On the Disks page, select Attach existing.
On the Attach existing disk page, select a disk, and then select OK.
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.
Select the VM with the disk from the My virtual machines list on the lab Overview page.
On the VM Overview page, select Disks under Settings in the left navigation.
On the Disks page, under Data disks, select the data disk you want to detach.
On the data disk's page, select Detach, then respond OK to Are you sure you want to detach it.
The disk detaches, and is available to reattach to this or another VM.
Detach or delete a data disk from the lab page
You can also detach or delete a data disk by using the lab's Overview page.
On the lab Overview page in the Azure portal, select My data disks under My Lab in the left navigation.
On the My data disks page, either:
Select the ellipsis (...) next to the disk you want to detach, select Detach from the context menu, and then select Yes.
Or, select the disk name, and on the disk's page, select Detach and then select OK.
To delete a detached data disk, select Delete from the context menu on the My data disks page, or select Delete on the disk's page. Deleting a data disk removes it from storage. If you want to attach the disk again, you must add it as a new disk.
Related content
For information about transferring data disks for claimable lab VMs, see Transfer the data disk.