DEV Community

Oziegbe Pierre Okukpon
Oziegbe Pierre Okukpon

Posted on

HOW TO CREATE AND ATTACH A DATA DISK TO AN EXISTING WINDOWS VIRTUAL MACHINE

In cloud computing environments like Microsoft Azure, virtual machines (VMs) are often used to run various workloads. However, the storage needs of these VMs can vary, and sometimes you may need additional storage beyond what is provided by the VM's default disk. Azure allows you to attach additional data disks to your VMs to meet these storage requirements. Let's break down the differences between OS Disk, Data Disk, and Temporary Disk.

1. OS Disk (Operating System Disk): Contains the operating system files necessary for booting and running the system.
2. Data Disk: Stores user data, applications, and files separate from the operating system.
3. Temporary Disk: Used for temporary storage or caching purposes, often in cloud computing environments, and its contents are typically not persisted beyond the lifetime of a virtual machine instance.

In this guide, I'll walk through the steps involved in creating and attaching a data disk to an existing Windows virtual machine in Azure. This process enables you to expand the storage capacity of your VM, allowing you to store more data or run applications that require additional disk space. Let's dive into the steps required to accomplish this task.

1. Sign in to Azure Portal: Go to the Azure Portal (https://portal.azure.com) and sign in with your Azure account credentials.

2. Navigate to Virtual Machines: In the Azure Portal, navigate to the virtual machine to which you want to attach the data disk.

3. Select Virtual Machine: Click on the name of the virtual machine to open its overview page.

4. Attach Data Disk: In the virtual machine overview page, scroll down to the "Settings" section and click on "Disks".

Image description

5. Attach New Data Disk: Click on "+ Create and attach a new disk" to add a new data disk to the virtual machine.

Image description

6. Configure Data Disk: In the "Create and attach a new disk" panel, configure the following settings:

7. Name: Provide a name for the data disk.

8. Source type: Select "Empty disk" if you want to create a new empty disk. Alternatively, you can select "From snapshot" or "From VHD" if you want to use an existing snapshot or VHD as the data disk.

**9. Size (GiB): **Specify the size of the data disk in GiB.

10. Account type: Choose the appropriate storage account type for the data disk (Standard HDD, Standard SSD, or Premium SSD).

11. Save Changes: Click "Apply" to attach the data disk to the virtual machine.

Image description

12. Connect to Virtual Machine: Connect to the virtual machine using Remote Desktop Protocol (RDP) or any other remote access method.

13. Initialize Data Disk: Once connected to the virtual machine, open Disk Management by right-clicking on the Start button and selecting "Disk Management".

Image description

14. Initialize Disk: In Disk Management, you should see the newly attached data disk. Right-click on it and select "Initialize Disk". Choose the desired partition style (MBR or GPT) and click "OK" to initialize the disk.

15. Create Volume: After initializing the disk, right-click on the unallocated space and select "New Simple Volume". Follow the wizard to create a new volume, assign a drive letter, and format the disk with the desired file system.

Image description

Image description

16. Access Data Disk: Once the volume is created, you can access the data disk like any other disk drive on the virtual machine.

Image description

That's it! You have successfully created and attached a data disk to an existing Windows virtual machine in Azure.

Top comments (0)