DEV Community

Cover image for HOW TO ATTACH A DATA DISK TO A VIRTUAL MACHINE AND INITIALIZE IT FOR USE
Adeyemi A
Adeyemi A

Posted on

HOW TO ATTACH A DATA DISK TO A VIRTUAL MACHINE AND INITIALIZE IT FOR USE

This step-by-step 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 virtual machine (VM), using the Azure portal.

Types of Data Disks

- Ultra disks: designed to meet the demand of mission-critical applications requiring extremely low latency(easily accessible / fast response time) and high IOPS(Input/Output Operations Per second)

- Standard HDD : Cost-effective, suitable for low I/O Workloads

- Standard SSD : Balance between cost and performance

- Premium SDD : High-performance, suitable for high I/O workloads.

There are three main disk roles in Azure namely OS Disk, the Data Disk and the Temporary Disk

disk roles

- OS DISK : The operating system (OS) disk is the primary disk for the VM. It contains the OS and is used to boot the VM. It is created automatically when you deploy a VM.

- Data disks : used to store application data, databases, logs, or other files. They are separate from the OS disk and allow for scalable storage. You can attach multiple data disks to a VM, depending on its size (e.g., the number of data disks varies with VM SKU).

- The Temporary Disk : provides non-persistent storage for temporary data, such as swap files, page files, or application caches. For Windows VMs, it appears as the D: drive.

Attaching a Data Disk to your Windows Virtual Machine

i) Sign in to your Azure portal and Create a Windows Virtual Machine

ii) Navigate to the left pane of your VM Dashboard, Click "Settings" dropdown and select "Disks"

Step 1

iii) Scroll down the Disks page and select "Create and attach a new Disk"

Step 2

iv) Name your new Data disk, Ignore the other information as the default and Apply accordingly

Step 3

  • Notice how the Operating System Disk and the Data Disk are two different disks

Initializing a Data Disk in a Windows Virtual Machine
When you attach a new data disk to your Windows virtual machine (VM), it’s not immediately ready for use. You need to initialize and format the disk to start using it for storing data. In this guide, we’ll walk you through the simple steps to prepare a data disk in a Windows environment.

Steps to Initialize and Use a Data Disk in a Windows VM

1. Connect and Log Into Your Windows Virtual Machine
Click "Connect" on your VM page, download the RDP File, and proceed to log into your Windows Virtual Machine
Enter your VM’s IP address or hostname, along with your login credentials.



2. Open Disk Management
Once logged in:

Right-click the Start button (or press Win + X).
Select Disk Management from the menu.

Disk Management

3. Initialize the New Disk
When Disk Management opens:

A pop-up window may prompt you to initialize the newly attached disk.
If you don’t see this prompt, locate the disk manually:
Look for the disk labeled Unknown and Not Initialized.
Right-click the new disk and select Initialize Disk.
Choose a partition style:

  • GPT (GUID Partition Table)
    : Recommended for modern systems and larger disks.

  • MBR (Master Boot Record)
    : Use for compatibility with older systems.

Click OK to complete the initialization.

Step5



4. Create and Format a New Volume
Scroll down and Locate the initialized disk’s Unallocated space.

selection

  • Right-click the unallocated space and select "New Simple Volume".
    simple volume

  • Follow the New Simple Volume Wizard:
    Assign a volume size (use the default to allocate the entire disk).

next

volume size selection

  • Choose a drive letter (e.g., D: or E:).

drive letter

  • Select a file system:
  • NTFS: Recommended for most use cases.

  • exFAT: Useful for cross-platform compatibility.

file system

  • Optionally, add a volume label (e.g., "DataDisk").

  • Click Finish to format the disk and create the volume.

Finish

  • In the new volume highlighted Blue, you can see that our new volume has been initialized.
  • To confirm Initialization , Double Click on your new data disk highlighted Blue

final 2



6. Verify the Disk
Once the process is complete:

Open File Explorer.
You should see the new disk with the assigned drive letter and label.
The disk is now ready for use!

Finish

Best Practices for Managing Data Disks

  • Back Up Your Data:
    Regularly back up critical files to protect against accidental loss.

  • Monitor Disk Performance:
    Use built-in tools like Performance Monitor to ensure optimal disk usage.

  • Resize When Needed:
    In cloud environments, you can easily resize data disks to accommodate growing storage needs.


    Conclusion
    Initializing and formatting a data disk in a Windows virtual machine is quick and easy. By following these steps, you can prepare your disk for use, ensuring your VM has the storage it needs to run efficiently. Properly managing your data disks will improve organization, performance, and scalability.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay