Tutorial / Cram Notes

When managing virtual machines (VMs) in Azure, one of the key tasks an Azure Administrator must be familiar with is the addition of data disks to existing VMs. This capability is crucial for scenarios where additional storage space or optimized disk performance is required.

Understanding Data Disks in Azure

In Azure, a data disk is a VHD (Virtual Hard Disk) that’s attached to a VM to store application data, or other data you need to keep. These disks are registered as SCSI drives and are labeled with a letter that you choose. Each data disk has a maximum capacity of 32,767 gibibytes.

Azure offers several types of data disks that vary in performance and pricing:

  • Standard HDD: Best for infrequent access or where cost is a priority.
  • Standard SSD: Balanced performance and cost, suitable for web servers, low IOPS application servers.
  • Premium SSD: High-performance SSD suitable for production and performance-sensitive workloads.
  • Ultra Disk: Highly flexible performance and IOPS, suitable for data-intensive workloads such as SAP HANA, top-tier databases, and transaction-heavy workloads.

The type of disk you choose will depend on the performance and cost needs of your application.

Adding a New Data Disk to an Azure VM

To add a new data disk to an Azure VM, follow these general steps:

  1. Select the Azure VM: Go to the Azure portal, select the desired virtual machine, and click on the option ‘Disks’ from the sidebar.
  2. Add Data Disk: Click on the ‘+ Add data disk’ button to create a new disk. You’ll be prompted to configure the new disk options.
  3. Configure the Disk: Choose the disk type (HDD, SSD, or Ultra Disk), size, and other configuration settings like encryption, host caching.
  4. Name the Disk: Provide a name for the disk and Azure will create a VHD and attach it to the VM.
  5. Save Configuration: Once you’re done with the configuration, click the ‘Save’ button to apply the changes and attach the new data disk to the VM.

Initializing and Partitioning the Data Disk in Windows VMs

Once the disk is attached, you need to initialize and partition it:

  1. Connect to your Azure VM using Remote Desktop.
  2. Open the Disk Management tool.
  3. Initialize the disk (MBR or GPT) as it will appear as ‘Unknown’ and ‘Not Initialized’.
  4. Create a new simple volume, assign a drive letter, and format the partition.

For Linux VMs, you’d use the fdisk or parted utilities to partition the new disk and then format it using the appropriate filesystem type (e.g., ext4, xfs).

Automation and Management with Azure CLI and PowerShell

Azure CLI and PowerShell cmdlets enable the automation of data disk addition:

  • Azure CLI: Use the az vm disk attach command to create and attach a new data disk to a VM.
  • PowerShell: Use the Add-AzVMDataDisk cmdlet to add a new data disk to a VM.

Scaling and Performance

It’s crucial to consider the size of the VM when adding data disks, as the size affects the number of data disks you can attach and the performance:

  • I/O throughput and the number of IOPS (Input/Output Operations Per Second) are capped based on the size of the VM.
  • Standard VMs offer limited IOPS, whereas the latest DS series VMs provide better performance.
  • The following table illustrates an example of the data disk scaling based on VM size:
VM Size Max Data Disks IOPS per Disk Throughput per Disk
Standard D2s v3 4 500 60 MB/s
Standard E32-8s v3 32 1200 150 MB/s
Standard M128s 64 5000 200 MB/s

Best Practices

  • Always keep data and OS disks separate to maximize performance and management.
  • Use Azure Backup to protect the data on your disks.
  • Leverage Azure Managed Disks for better scaling, management, and security.

Conclusion

Adding data disks to Azure VMs expands their storage capacity and performance. Whether it’s for a standard workload or a high-demand application, Azure has the disk options to meet every need. Azure Administrators must be familiar with the process of adding, initializing, and configuring data disks to ensure efficient storage management in their Azure infrastructure.

Practice Test with Explanation

True or False: You can only attach a new data disk to a VM that is in the stopped state.

  • False

You can attach a data disk to a VM that is running or stopped. Azure allows the hot addition of data disks without the need to stop the VM.

When you add a new blank data disk to a VM, which file system does it come pre-formatted with?

  • A) NTFS
  • B) ext4
  • C) FAT32
  • D) It is not pre-formatted

D

New blank data disks do not come pre-formatted. You need to initialize and format the disk with a file system of your choice once it’s attached to the VM.

True or False: You can increase the size of an existing Azure managed disk without detaching it from the VM.

  • True

Azure enables you to increase the size of an existing managed disk without detaching it, but you need to resize the partition within the operating system to use additional space.

What is the maximum number of managed data disks you can attach to an Azure VM depending on its size and series?

  • A) 2
  • B) 4
  • C) 8
  • D) It varies by VM size and series

D

The number of managed data disks you can attach to an Azure VM depends on the size and series of the VM. Each VM size has specific disk and storage throughput limits.

True or False: Azure managed disks are automatically encrypted at rest.

  • True

Azure managed disks are encrypted at rest by default using Azure Storage Service Encryption (SSE).

True or False: Once you delete an Azure VM, all data disks associated with the VM will be deleted automatically.

  • False

Deleting a VM does not delete the data disks. The disks persist in storage unless you explicitly delete them.

Which disk type offers the highest IOPS per disk in Azure?

  • A) Standard HDD
  • B) Standard SSD
  • C) Premium SSD
  • D) Ultra Disk

D

Ultra Disks offer the highest level of IOPS and throughput per disk in Azure, designed for data-intensive workloads.

True or False: You can switch from a managed disk to an unmanaged disk without creating a snapshot.

  • False

To switch from a managed disk to an unmanaged disk, you need to create a snapshot, then create a VHD from that snapshot, which can then be used to create an unmanaged disk.

When attaching a managed disk to a VM, which of the following must you specify?

  • A) Region
  • B) Subscription
  • C) Storage account
  • D) LUN

D

When attaching a managed disk, you must specify the Logical Unit Number (LUN). Region and subscription are pre-determined, and storage accounts are not required for managed disks.

True or False: Snapshots can be used to perform point-in-time backups of data disks.

  • True

Snapshots provide point-in-time backups and are a full, read-only copy of a data disk.

What can be used to automate the backup of data disks in Azure?

  • A) Azure Policy
  • B) Azure Backup service
  • C) Azure Activity Log
  • D) Azure Service Health

B

Azure Backup service can be used to automate the backup of data disks for both managed and unmanaged disks.

True or False: Azure provides managed data disks with pre-installed applications.

  • False

Azure managed data disks are blank storage volumes that do not contain any pre-installed applications or data; you must install apps or copy data to them after attaching them to a VM.

Interview Questions

What are data disks in Azure?

Data disks in Azure are virtual hard disks (VHDs) that can be attached to virtual machines to increase their storage capacity and performance.

How do I attach a managed disk to a virtual machine in the Azure portal?

To attach a managed disk to a virtual machine in the Azure portal, navigate to the virtual machine, click on the “Disks” option in the left-hand menu, click on the “+ Add data disk” button, enter a name for the new data disk, select the size and type of the disk, choose the storage account, and click on the “OK” button to add the data disk.

How do I attach a managed disk to a virtual machine using Azure PowerShell?

To attach a managed disk to a virtual machine using Azure PowerShell, use the New-AzDisk command to create a new managed disk, use the Add-AzVMDataDisk command to attach the new managed disk to the virtual machine, and use the Update-AzVM command to apply the changes to the virtual machine.

What is the difference between managed disks and unmanaged disks?

Managed disks are a type of storage option in Azure that provide simplified management, automatic backup, and higher availability for virtual machines. Unmanaged disks require manual management and backups, but provide more control over the storage account.

How do I attach an unmanaged disk to a virtual machine in the Azure portal?

To attach an unmanaged disk to a virtual machine in the Azure portal, navigate to the virtual machine, click on the “Disks” option in the left-hand menu, click on the “+ Add data disk” button, enter a name for the new data disk, select the size and type of the disk, choose the storage account, and click on the “Create” button to create the new unmanaged disk.

How do I attach an unmanaged disk to a virtual machine using Azure PowerShell?

To attach an unmanaged disk to a virtual machine using Azure PowerShell, use the New-AzDisk command to create a new unmanaged disk, use the Add-AzVMDataDisk command to attach the new unmanaged disk to the virtual machine, and use the Update-AzVM command to apply the changes to the virtual machine.

Can I attach multiple data disks to a virtual machine?

Yes, you can attach multiple data disks to a virtual machine in Azure.

How do I remove a data disk from a virtual machine?

To remove a data disk from a virtual machine in Azure, navigate to the virtual machine, click on the “Disks” option in the left-hand menu, select the data disk you want to remove, and click on the “Detach” button to remove the data disk.

Can I change the size or type of a data disk after it has been attached to a virtual machine?

Yes, you can change the size or type of a data disk after it has been attached to a virtual machine, but this may require some additional configuration or downtime for the virtual machine.

How can I determine the available disk sizes and types for my virtual machine?

You can determine the available disk sizes and types for your virtual machine by reviewing the specifications for the virtual machine in the Azure portal or using Azure PowerShell to query the available disk sizes and types.

How can I monitor the performance and usage of my data disks in Azure?

You can monitor the performance and usage of your data disks in Azure by reviewing the metrics and logs in the Azure portal, using Azure Monitor or Azure Log Analytics, or using third-party monitoring tools.

0 0 votes
Article Rating
Subscribe
Notify of
guest
23 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Nikola Dupuis
1 year ago

Great post! Can someone explain the difference between Standard HDD and Premium SSD data disks in Azure?

Diana Edwards
1 year ago

I’m preparing for the AZ-104 exam, and this blog post helped clear up some confusion about adding data disks.

Tijana Radanović
1 year ago

How many data disks can I add to a single Azure VM?

Evelia Fajardo
2 years ago

How do I manage disk performance and costs effectively when adding data disks?

Melike Öymen
1 year ago

I’m having trouble attaching multiple data disks at once. Anyone else facing this issue?

Jessie Fox
2 years ago

Thanks for sharing this detailed guide!

Charlie Chen
1 year ago

This post is very helpful, but I noticed it’s missing information on managed disks.

Frankie Bennett
2 years ago

Can I switch from unmanaged to managed disks without downtime?

23
0
Would love your thoughts, please comment.x
()
x