Attach a DATA disk to a Windows VM using the Azure portal And Initialize It for Usage
Published: 2024-04-13 12:26:14

This article describes the different types of Disks of a virtual machine (VM) and shows how to attach a new managed data disk to a Windows 11 virtual machine (VM), using the Azure portal. 
 
## Disk Types and Roles
There are three main disk types attachable to virtual machines in Azure, referred to as Disk roles. These are the OS disk, the data disk, and the temporary disk.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1uduvwk1e8za1u6r5hat.png)

## OS disk
OS stands for operating system, every virtual machine has one attached operating system disk. That OS disk has a pre-installed OS, which was selected when the VM was created. This disk contains the boot volume and OS information. User's data stored here is lost at vm shutdown or deletion.

## Data disk
A data disk is a managed disk that's attached to a virtual machine to store user's data, application data, or other data 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. Its persistent, user data stored here is retained at vm shutdown or vm deletion and can be reattached to other vm. The size of the VM determines how many data disks you can attach.

## Temporary disk
Most VMs contain a temporary disk, which is not a managed disk. The temporary disk provides short-term storage for applications and processes, which is intended only to store data such as page files, swap files, or SQL Server tempdb. Data on the temporary disk may be lost during a maintenance event, when you redeploy a VM, or when you stop the VM. During a successful standard reboot of the VM, data on the temporary disk will persist. It's not persistent.

## Add a data disk
-Sign in to the Azure portal.
-Create our windows 11 virtual machine.
 _To create your windows virtual machine see my blog on how to 
  create a Windows 11 Virtual 
  Machine.https://dev.to/sangifeanyi/how-to-create-a-windows-11- 
  virtual-machine-2l8f
-Search for and select your Virtual machine from the list.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k0naf3jvp9en19qn2iop.png)

-On the Virtual machine pane, select Disks.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b5kbck90b7ov4z22ll4k.png)

-On the Disks pane, select Create and attach a new disk.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r8wdkubfupoxere1ppb0.png)

In the drop-downs for the new disk, make the selections you want, and name the disk.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9i8b5wowkug1fd0dl5xi.png)

Select Apply to create and attach the new data disk to the VM. 
This creates and attaches the new data disk to your vm as shown bellow ;

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d5859s9q4i5p26jqkzmg.png)

## Initializing a new data disk
-Connect to the VM.
see my blog on how to 
  create a Windows 11 Virtual 
  Machine.https://dev.to/sangifeanyi/how-to-create-a-windows-11- 
  virtual-machine-2l8f

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iuzl69zst2xt5y0tr21p.png)

-Select the Windows Start menu inside the running VM and enter diskmgmt.msc in the search box or right click on the Windows icon and click on Disk Management.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ilb9tm8q5aoy9yl7csun.png)

-Disk Management recognizes that you have a new, uninitialized disk and the Initialize Disk window appears.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hdh2swauhxfxegu3rirs.png)

-Verify that the new disk is selected, then click OK to initialize it.

-Right click on the disk 2 below.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5jfeabb4yyhh7bw1hkih.png)

-From the drop down click on "new simple volume".

-The New Simple Volume Wizard window opens.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nyv69d45tmv16qw5bwka.png)

-Proceed through the wizard, keeping all of the defaults.
-You may choose to change your volume size when prompted or accept the default and click next to continue.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e4yp8ycpjoany1q0it33.png)

-To complete and close the wizard click Finish.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nmhrvdj06z07nmq2h1aa.png)

In the displayed volumes lists, you can see that our new volume has been initialized, highlighted Red.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bfkhbgwdtem1o6lr9qjg.png)

Close Disk Management and open file explorer and select the new volume (F) drive.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/knsqmnjke0wmeh78gp1p.png)

As shown above, our new data disk is available and ready for use.