DEV Community

Cover image for HOW TO ADD A DATA DISK TO A VIRTUAL MACHINE
EMMAMAG
EMMAMAG

Posted on

HOW TO ADD A DATA DISK TO A VIRTUAL MACHINE

As we all know, storage plays a vital role in a virtual machine as we need to store necessary data and as we know OS disk will not be enough and we may need extra storage to store the data. So let us see how can we attach the data disk to a VM. We already know what a data disk is. If you don't know, please go through this article, where I have explained all the basics about the Azure virtual machine.

We will learn how to create and attach a data disk to a virtual machine. Furthermore, we will also remotely access the Windows virtual machine and initialize our data disk for use.
It is important to know that there is a difference between an (operating system) OS disk and a data disk
Azure documentation explains that every virtual machine is equipped with a single (operating system) OS disk that is directly attached to it. This disk comes with a pre-installed operating system that was chosen during the creation of the virtual machine. It serves as the primary storage for the boot volume, essential for initiating the system.
While data disk is a managed disk that is attached to a virtual machine to store application data or other data you need to keep.

Let's say I have a VM named EMMAMAGDemoVM that I have already created (please refer to this article to learn about creating a virtual machine on Azure) and I want to attach an extra data disk to this VM to storage.

Let's Get Started........

a)The first step is to create our Windows 11 virtual machine

b)Once you've created your virtual machine click on it.

c) On the left sidebar click on "Disks".

Image description

e) Once you click on it, scroll down and click on Create and attach a new disk.

Image description

f)Give your new disk a name, increase the size and leave the other information as default.

g)Click on Apply as shown below.

Image description

h)You can see that the (operating system) OS disk and data disk are two different disks.

Image description

Connect to your virtual machine and download the RDP file once you've downloaded follow the prompt, input your username and password.

Image description

Now that you have been able to gain remote access to your Windows Desktop, right-click on the Windows icon and click on Disk Management.

Image description

Right click on the disk 2 below.

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

Image description

To continue click next on the new simple volume wizard.

Image description

Click "Next" on the specify volume size.

Image description

Also click "Next" on the Format Partition

Image description
To close the wizard click "finish"

Image description

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

Click on your new data disk highlighted Orange.

Image description

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

Image description

Top comments (0)