Microsoft Azure - Disk Configuration
You would have noticed that we can attach a disk to a virtual machine that we create in Azure. We will discuss these discs in this chapter. Disk here refers to data disks that can be stored on Azure. All types of disks are virtual hard disks with .vhd extensions. Vhds is the image file that stores the contents of the physical hard drive. These are therefore images of the files, which we usually find on our computer's hard drive. There are two types of virtual hard disks -
- Operating system VHD and data disks
- Image VHD
Based on scalability, there are two types of virtual hard disks -
- Fixed size
- Dynamic expansion
Azure only supports fixed-size virtual hard disks. If youneed to download an expandable VHD, you will need to convert it to a fixed size VHD first. The maximum size supported by Azure is 1 terabyte for a disk.
Virtual machine and disks
When we create a virtual machine, it always resides in a storage account in an Azure account. If there is no existing storage account in Azure, when attempting to create a virtual machine, Azure will automatically create one. If you already have a storage account, it will ask you to choose the storage account when creating a virtual machine. There is a detailed procedure on creating a virtual machine in this tutorial.
Create / Attach a disk in a virtual machine
Step 1 - Go to the virtual machine.
Step 2 - Select "Dashboard" from the top menu.
Step 3 - Click on "Attach disk '→ Attach empty diskat the bottom of the screen.
Step 4 - Enter details in the next screen that appears.
It will take a few seconds to attach the disk to the virtual machine.
Configure the disk in the virtual machine
Step 1 - Connect to the virtual machine via the .rpd file downloaded to your local machine.
Step 2 - In the virtual machine, right click on the Windows icon in the lower left corner and select 'Disk Management '.
Step 3 - You will see a message indicating that the disk is available on the screen. It is the same disk that you attached in the previous step.
Step 4 -Before you can use it, you must allocate it. You will see that it is still not allocated. Scroll down on the same screen and locate the disk as shown in the following image, it is disk 2. Right click on it and select "New Simple Volume".
Step 5 - Follow the wizard. It will ask very general questions, like naming the drive and file system. In the last screen, make sure to keep the quick format option checked.
Step 6 - Once the wizard 's job is done, you will be ready to use the disk. In this example we have created drive "F". You can create the folder and files or copy your data to drive F.
You will need to locate the disk first to remove it. It is very important to locate the correct drive. When you create a virtual machine, you select the storage account for it. The disks reside in the storage account.
Step 1 - Access the virtual machine storage account.
Step 2 - Click on "Containers " in the top menu.
Step 3 - Click on vhd.
Step 4 - All vhds in this storage account will be listed. This list will also contain vhds from other virtual machines, so be very careful when selecting the vhd.
Step 5 - Select the vhd you want to remove. You need to know the name disk to be able to identify it among the different vhds in the list (when you attach the disk, you are prompted toenter the name of the disc).
Create an image of the virtual machine
Step 1 - Access the management portal.
Step 2 - Select the desired virtual machine to create an image of.
Step 3 - Click on "Dashboard " in the top menu.
Step 4 - Click on the 'Capture ' icon at the bottom of the window.
Step 5 - Name the image and enter the deion.
Step 6 - Once the capture is complete, find the image, follow the g iven points below -
Create an image from your Computer
This is done through the sysprep tool available in all modern Windows operating systems.
Step 1 - Go C drive - > Windows -> System32 → Sysprep
Step 2 - You can also copy the following path to the C address bar: Windows System32 Sysprep
Step 3 - Run the 'sysprep ' application. This will create a VHD file on your computer which is the image of your machine.
You might be confused with vhds names, when you have multiple VMs under the same storage account. One way to find out the names of the vhds associated with a particular machine is to run the "Get-AzureDisk" cmdlet in Windows PowerShell.This cmdlet will give you full details of the disks in each virtual machine.
Step 1 - Run the following command
Step 2 - Locate your virtual machine name in the list. Under that virtual machine, check the disk name and medial link for your name and vhd link.