Attach a data disk to a Windows virtual machine created with the classic deployment model
Azure has two different deployment models for creating and working with resources: Resource Manager and classic. This article covers using the classic deployment model. Microsoft recommends that most new deployments use the Resource Manager model. Learn how to perform these steps using the Resource Manager model.
If you need an additional data disk, you can attach an empty disk or an existing disk with data to a VM. In both cases, the disks are .vhd files that reside in an Azure storage account. In the case of a new disk, after you attach the disk, you'll also need to initialize it so it's ready for use by a Windows VM.
For more details about disks, see About Disks and VHDs for Virtual Machines.
Here's a video walkthrough of the steps in this tutorial.
Attaching an empty disk is a simple way to add a data disk, because Azure creates the .vhd file for you and stores it in the storage account.
Click Virtual Machines, and then select the appropriate VM.
On the command bar, click Attach, and then click Attach Empty Disk.
The Attach an Empty Disk dialog box appears.
Do the following:
- In File Name, accept the default name or type another one for the .vhd file. The data disk uses an automatically generated name, even if you type another name for the .vhd file.
- Type the Size (GB) of the data disk.
- Click the check mark to finish.
After the data disk is created and attached, it's listed in the dashboard of the VM.
After you add a new data disk, you'll need to log on to the VM and initialize the disk so that it can be used.
Attaching an existing disk requires that you have a .vhd available in a storage account. Use the Add-AzureVhd cmdlet to upload the .vhd file to the storage account. After you've created and uploaded the .vhd file, you can attach it to a VM.
Click Virtual Machines, and then select the appropriate virtual machine.
On the command bar, click Attach, and then select Attach Disk.
Select the data disk and then click the check mark to attach the data disk.
After the data disk is attached, it's listed in the dashboard of the VM.
Connect to the virtual machine. For instructions, see How to log on to a virtual machine running Windows Server.
After you log on to the virtual machine, open Server Manager. In the left pane, select File and Storage Services.
Expand the menu and select Disks.
The Disks section lists the disks. In most cases, it will have disk 0, disk 1, and disk 2. Disk 0 is the operating system disk, disk 1 is the temporary disk, and disk 2 is the data disk you just attached to the VM. The new data disk will list the Partition as Unknown. Right-click the disk and select Initialize.
You're notified that all data will be erased when the disk is initialized. Click Yes to acknowledge the warning and initialize the disk. Once complete, the Partion will be listed as GPT. Right-click the disk again and select New Volume.
Complete the wizard using the default values. When the wizard is done, the Volumes section lists the new volume. The disk is now online and ready to store data.
The size of the VM determines how many disks you can attach to it. For details, see Sizes for virtual machines.