When working with Virtual Machines (VMs) in Azure, storage needs almost always grow over time. Whether you're hosting applications, running databases, or storing logs, the default OS disk may not be enough. That’s where data disks come in.
In this guide, you’ll learn exactly how to add a data disk to an Azure VM and configure it inside both Windows and Linux. The steps are simple, clear, and perfect for anyone learning Azure or managing cloud workloads.
Why Add a Data Disk?
Adding a data disk helps you:
- Expand VM storage beyond the OS disk
- Organize data better by separating system files from application data
- Improve performance — apps often run faster on dedicated data disks
- Enhance reliability by isolating workloads
- Optimize cost by selecting the right disk type
Disk Types in Azure
Before adding a disk, it helps to understand the storage options:
- Standard HDD — Cheapest; best for low-usage scenarios
- Standard SSD — Balanced performance vs cost
- Premium SSD — High performance for production workloads
- Ultra Disk — Extreme performance and ultra-low latency
Step-by-Step: How to Add a Data Disk to an Azure VM
Step 1: Create a Virtual Machine
We’ve created virtual machines several times already, so here’s a quick overview:
Search and create the virtual machine:
Input your VM details:
After creating the virtual machine:
- Go to Virtual Machines
- Select the VM where you want to add the disk
Step 2: Attach a New Data Disk
Inside the VM blade:
- Click Disks
- Select Add data disk
Choose Create and attach a new disk:
Enter the Disk Name, choose Disk Type, and select Size:
(Optional) Set a Performance Tier
Then click Save:
This attaches the disk to your VM — but you must still configure it inside the operating system.
Step 3A: Configure the Disk in a Windows VM
Connect to the VM using RDP:
Open Disk Management:
Press Windows + R, type diskmgmt.msc.
You’ll see the new disk marked Unallocated.
Right-click the disk → Initialize Disk
Select GPT (recommended)
Right-click unallocated space → New Simple Volume
Choose a drive letter → Format with NTFS
Click Finish, and the disk appears in File Explorer:
Step 3B: Configure the Disk in a Linux VM
If your virtual machine runs on Linux, the steps to set up the new data disk are slightly different. Let’s walk through the process.
1. Connect to the VM
Use SSH to connect:
ssh azureuser@<public-ip>
2. List available disks
lsblk
Find the new disk (e.g., /dev/sdc).
3. Create a new partition
sudo fdisk /dev/sdc
Inside fdisk:
- Press n → new partition
- Press p → primary
- Accept defaults
- Press w → write changes
4. Format the disk
sudo mkfs -t ext4 /dev/sdc1
5. Create a mount point
sudo mkdir /mnt/data
sudo mount /dev/sdc1 /mnt/data
6. Make the mount permanent
echo "/dev/sdc1 /mnt/data ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab
Verify the Disk
Windows:
Open File Explorer — the new drive is visible.
Linux:
df -h
You should see /mnt/data.
Your new data disk is now ready to use!
Conclusion
Adding a data disk to an Azure Virtual Machine is a simple yet powerful way to expand storage, improve performance, and organize workloads more effectively. Whether you’re using Windows or Linux, the workflow is the same: attach the disk in Azure, then configure it inside the OS.
Mastering VM storage is an essential skill for anyone working in Azure — and it sets the foundation for better performance, optimized workloads, and long-term scalability.

























Top comments (0)