What is a Virtual Machine:
A virtual machine (VM) in the Azure portal is a fully configurable, cloud-based computing resource that emulates a physical computer, enabling users to deploy and manage applications with customizable processing power, memory, and storage, all accessible through a secure, browser-based interface designed for efficient workload management and global scalability.
What is a Datadisk in Azure
A data disk in Azure is an extra storage space you can add to a virtual machine to save files, apps, or data, separate from the main system disk, and it can be resized or customized to fit your needs.
Adding a data disk in Microsoft Azure means attaching extra storage to your virtual machine through the Azure Portal, where you select your VM, go to "Disks," and create a new disk with a chosen size and type. After attaching it, you set it up inside the VM using the Azure Portal or tools like Disk Management for Windows or commands for Linux to make it ready for storing files.
In this article, we will be focusing on:
Prerequisites
Before you begin, make sure you have:
An active Azure account. You can sign up for a free trial if you don’t have one.
Step-by-Step Guide to Create a Virtual Machine
Step 1: Sign in to the Azure Portal
- Step 2: Navigate to Virtual Machines In the left-hand navigation pane, click on "Virtual Machines". If it’s not visible, use the search bar at the top to search for “Virtual Machines.
- Step 3: Click on "Create" Click the "+ Create" button and select "Azure virtual machine".
- Create a Resource Group and give your resource group a name
- Choose region
- Give your Virtual machine a name
- Choose Availability Options (Zones)
- Choose Image (Software that will run the Virtual Machine)
- To Save cost, select/click Run with Azure Spot discount
- To access internet, select Public inbound ports, for testing choose to allow selected ports, for real live, choose none and create your own as a professional
- Select inbound ports, choose HTTP for windows and SSH for Linux, RDP will be automatically selected
Click to confirm the Licensing
Go to Monitoring and Select Disable to disable the virtual Machine from running
- Go to Tags, under Name put Department, under value, put the name of your department
- Review and Create to complete the Deployment
Step-by-Step Guide to Adding a Data Disk to a Virtual Machine
Step 1: Access Your Virtual Machine in Azure
Log in to the Azure Portal 👉 portal.azure.com
Navigate to Virtual Machines and select the VM where you want to add the disk.
Step 2: Attach a New Data Disk
- In the VM settings, click on "Disks".
- Click "Add Data Disk", then select "Create and Attach a New Disk".
- Choose a Disk Name, Storage Type, and Size (GB).
Set the Disk Performance Tier (if applicable).
Click "Save" to attach the disk to your VM.
- Increase the Virtual machine idle time from 4 minutes to 30 minutes, go to Virtual machine ip address- overview-configuration-ip address-increase the idle time
Step 3: Configure the Data Disk in the OS
After attaching the disk, you need to initialize and format it within the VM’s operating system.
Windows VM Configuration
- Connect to the VM using Remote Desktop (RDP).
Open Disk Management (diskmgmt.msc).
The new disk appears as Unallocated.
Right-click and select "Initialize Disk".
Choose GPT (recommended) or MBR as the partition style.
Right-click the unallocated space and select "New Simple Volume".
Assign a drive letter, select NTFS as the file system, and format the disk.
Click "Finish" and confirm the disk is now ready for use.
Linux VM Configuration
Connect to the VM using SSH.
Run lsblk to list available disks.
Identify the new disk (e.g., /dev/sdc).
Use fdisk or parted to create a new partition:
sudo fdisk /dev/sdcPress n for a new partition, p for primary, and choose the default options.
Press w to save changes.
Format the disk with EXT4 or XFS:
sudo mkfs -t ext4 /dev/sdc1Create a mount point and mount the disk:
sudo mkdir /mnt/data
sudo mount /dev/sdc1 /mnt/dataTo make the mount persistent, add an entry to /etc/fstab:
echo "/dev/sdc1 /mnt/data ext4 defaults,nofail 0 2" | sudo tee -a /etc/fstab
Step 4: Verify & Start Using the Disk
Windows: Open File Explorer, and you should see the new drive.
Linux: Run df -h to confirm the disk is mounted.
Your new data disk is now ready to store applications, logs, or data separately from the OS disk!
Best Practices for Managing Data Disks in Azure
Monitor Disk Usage: Regularly check disk performance using Azure Monitor
Choose the Right Disk Type: Optimize cost and performance based on workload.
Enable Backup & Disaster Recovery: Use Azure Backup to protect your data.
Automate Disk Scaling: Use Azure Disk Auto Expansion for dynamic storage needs.
Ensure Security: Encrypt disks with Azure Disk Encryption for added protection.
Key Takeaways
Adding a data disk enhances VM storage capacity and performance
Windows & Linux require different setup steps after attaching a disk.
Proper disk management improves efficiency and reduces operational risks.
Azure offers flexible storage options to match workload demands.
Pro Tip: If your application has high IOPS needs, consider Azure Ultra Disks for ultra-fast performance!
Now you're all set! 🚀 Start expanding your VM storage and optimizing your Azure workloads today!
Top comments (0)