Reader small image

You're reading from  Learn Azure Administration - Second Edition

Product typeBook
Published inDec 2023
PublisherPackt
ISBN-139781837636112
Edition2nd Edition
Right arrow
Author (1)
Kamil Mrzygłód
Kamil Mrzygłód
author image
Kamil Mrzygłód

Kamil Mrzygłód is a technical lead and technology advisor, working with multiple companies on designing and implementing Azure-based systems and platforms. He's a former Microsoft Azure Microsoft Most Valuable Professional (MVP) and certified trainer, who shares his knowledge via various channels, including conference speeches and open source projects and contributions. Kamil lives in Poland with his two cats and one dog, dedicating some of his time to video games, cooking, and traveling.
Read more about Kamil Mrzygłód

Right arrow

Configuring and Managing Disks

We had a chance to talk about Azure managed disks in Chapter 5, where we discussed Azure Virtual Machines. In this chapter, we’ll extend our knowledge by diving into more advanced and more detailed topics. Knowledge from this chapter will be helpful when you’re managing VM-based infrastructure in Azure, as lots of the operations we’ll perform are often the bread and butter of day-to-day Azure administrator tasks.

The topics that will be covered in this part of this book are aimed at operations related to Azure disks, which we can swap, optimize, and reuse across multiple machines. These operations are also important for backup and restore processes as, sometimes, you may need to move a disk from one machine to another to recover from an error or outage.

In this chapter, we’re going to cover the following main topics:

  • Expanding on OS and data disks
  • Exploring ephemeral OS disks
  • Adding, detaching, and expanding...

Technical requirements

For the exercises in this chapter, you’ll need the following:

The Code in Action video for this book can be viewed at: https://packt.link/GTX9F

Expanding on OS and data disks

You should be already familiar with two types of disks that can be provisioned in Azure (we discussed them in Chapter 5):

  • OS disk
  • Data disk

In Azure, each virtual machine can have a single OS disk attached to it, plus several data disks, which are used as additional storage units for a machine. The number of possible data disks attached to the machine relies on its family and size:

  • Memory-optimized Dv2 and Dsv2-series – 8–64 data disks
  • Ev4 and Esv4-series – 4–32 data disks
  • Mv2-series – 64 data disks
  • B-series burstable series – 2–32 data disks

You can find the full list in the Azure documentation: https://learn.microsoft.com/en-us/azure/virtual-machines/sizes. When planning your infrastructure (and considering its capabilities and capacity), this should be the first place where you consult your assumptions. Azure Virtual Machines, with their families and sizes...

Exploring ephemeral OS disks

In a standard scenario (no additional performance requirements, OS disk data persistence), you can use a typical OS disk that will be provisioned as a managed disk stored on a remote Azure Storage account. This simplifies setup and management but will also impact the latency of the input/output operations per second (IOPS) of a disk. If you’re looking for improved performance, Azure offers ephemeral OS disks, which are configured and managed differently.

An ephemeral OS disk is provisioned directly on a machine. This means that they’re collocated with your virtual machine, giving some boost to the latency of disk operations. They also have some additional traits:

  • No additional cost – ephemeral disks are free because they don’t use Azure Storage.
  • Not all virtual machine families support them.
  • The maximum size depends on the maximum size of the temporary disk of the virtual machine cache. In general, they cannot...

Adding, detaching, and expanding disks

When working with infrastructure in Azure, you rarely make a one-time setup. Some resources, including Azure Virtual Machines with disks, require constant maintenance and monitoring of utilized compute and storage. It’s important to know how to perform basic maintenance operations daily so that you can then automate them if possible.

To get started with some exercises, let’s deploy a single virtual machine using the following command:

az group create -l <location> -n <resource-group-name>
az vm create -g <resource-group-name> -n <vm-name> --image Ubuntu2204 --admin-username <username> --admin-password <password>

Once the virtual machine has been created, it’ll have no data disk and a single OS disk with default parameters. Let’s try to add new data disks to it.

Adding a disk to a virtual machine

To attach a new disk to a virtual machine, we can use two paths:

    ...

Swapping OS disks

Swapping OS disks is a simple operation that can be performed without stopping or deallocating a virtual machine. The decision of whether to stop a machine or perform a swap without downtime relies on the type of workload you have running on a machine. It’s not guaranteed that swapping operations won’t interfere with your services, so to be on the safe side, it’s recommended to plan downtime upfront. No matter whether you go for downtime or not, the operation will be performed in the same way.

The only command you need to swap OS disks is the command for updating a virtual machine’s properties:

az vm update \
   -g <resource-group-name> \
   -n <vm-name> \
   --os-disk <os-disk-resource-id>

The only difficulty in performing that operation is making sure that the virtual machine and disk are compatible. Remember that not all virtual machines support Premium disks. If...

Summary

In this chapter, we talked about performing various operations with Azure disks. You had a chance to attach and detach disks by not only performing those operations in Azure but this time, you needed to go deeper. As you learned, when administering infrastructure in Azure, you cannot just rely on cloud knowledge – experience from managing on-premises or other cloud vendors will be helpful since managing infrastructure at the OS level is cloud-agnostic.

We also talked a little bit about advanced topics surrounding disks in Azure (sharing and encryption) and realized that swapping the OS disk for a virtual machine in Azure is a piece of cake. In the next chapter, we’ll switch focus to another Azure service called Azure Storage, where we’ll talk about things such as blob storage and file shares.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learn Azure Administration - Second Edition
Published in: Dec 2023Publisher: PacktISBN-13: 9781837636112
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $19.99/month. Cancel anytime

Author (1)

author image
Kamil Mrzygłód

Kamil Mrzygłód is a technical lead and technology advisor, working with multiple companies on designing and implementing Azure-based systems and platforms. He's a former Microsoft Azure Microsoft Most Valuable Professional (MVP) and certified trainer, who shares his knowledge via various channels, including conference speeches and open source projects and contributions. Kamil lives in Poland with his two cats and one dog, dedicating some of his time to video games, cooking, and traveling.
Read more about Kamil Mrzygłód