English 中文(简体)
Microsoft Azure Tutorial

Microsoft Azure Advanced

Microsoft Azure Useful Resources

Selected Reading

Microsoft Azure - Disk Configuration
  • 时间:2024-11-03

Microsoft Azure - Disk Configuration


Previous Page Next Page  

You would have noticed that we can attach a disk to a virtual machine that we create in Azure. We will be discussing those disks in this chapter. Disk here is referred to the data disks that can be stored on Azure. All kinds of disks are virtual hard drives with .vhd extensions. Vhds are the image file that stores the contents of physical hard drive. So they are images of the files, which we usually find on our computer’s hard drive. There are two types of virtual hard disks −

    Operating system VHDs and Data Disks

    Image VHDs

On the basis of the extendibipty, there are two types of VHDs −

    Fixed Size

    Dynamically Expanding

Azure supports only fixed sized VHDs. If you have to upload expandable VHD you will have to first convert it to fixed size VHDs. 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 Azure account. If there is no existing storage account in Azure, while 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 while creating a virtual machine. There is a detailed how-to on creating a virtual machine in this tutorial.

Create/Attach a Disk in Virtual Machine

Step 1 − Go to the virtual machine.

Step 2 − Select ‘Dashboard’ from the top menu.

Step 3 − Cpck ‘Attach disk’ → Attach empty disk at the bottom of the screen.

Create Disk in Virtual Machine

Step 4 − Enter the details in the following screen that pops up.

Create Disk in Virtual Machine

It will take few seconds to attach the disk to the virtual machine.

Configure the Disk in Virtual Machine

Step 1 − Connect to the virtual machine through .rpd file downloaded on your local machine.

Step 2 − In the virtual machine, right-cpck the windows icon at the left bottom corner and select ‘Disk Management’.

Configure Disk in Virtual Machine

Step 3 − You will see a message saying Disk is available on the screen. This is the same disk that you attached in the previous step.

Disk Management

Step 4 − Before you can use it, you need to allocate it. You will see that it is still unallocated. Scroll down on the same screen and locate the disk as shown in the following image, it is Disk 2. Right-cpck on it and select ‘New Simple Volume’.

Configure Disk in Virtual Machine

Step 5 − Follow the wizard. It will ask very general things, pke naming the drive and file system. In the last screen, make sure to keep the quick format option checked.

New Simple Volume

Step 6 − After the wizard’s job is over, you will be ready to use the disk. In this example, we have created the ‘F’ drive. You can create the folder and files or copy your data in the F drive.

F Drive

Delete the Disk

You will have to first locate the disk in order to delete. Locating the right disk is very important. When you create a virtual machine you select the storage account for it. Disks reside in the storage account.

Step 1 − Go to the storage account of the virtual machine.

Step 2 − Cpck ‘Containers’ from the top menu.

Step 3 − Cpck vhd.

Delete Disk

Step 4 − All the vhds in that storage account will be psted. This pst will also contain the vhds from other virtual machines so be very careful while selecting the vhd.

Step 5 − Select the vhd you want to delete. You must know the name of the disk in order to identify it among the several vhds in the pst (when you attach the disk you are prompted to enter the name of the disk).

VHDs

Image Disks

Create an image from Virtual Machine

Step 1 − Go to the management portal.

Step 2 − Select the virtual machine you want to create an image of.

Step 3 − Cpck ‘Dashboard’ from the top menu.

Step 4 − Cpck the ‘Capture’ icon at the bottom of the window.

Image Disk

Step 5 − Name the image and enter the description.

Image Disk

Step 6 − Once capturing is done, to find the image, follow the points given below −

    Select Virtual Machines from the panel. All the virtual machines in your account will be psted there.

    Cpck ‘Images’ from the top menu.

Virtual Machines

Create an Image from Your Computer

This is done through sysprep tool available in all modern Windows operating system.

Step 1 − Go C drive −> Windows −> System32 → Sysprep

Step 2 − Alternatively copy the following path in the address bar C:WindowsSystem32Sysprep

Step 3 − Run ‘sysprep’ apppcation. This will create a VHD file on your computer which is the image of your machine.

Create Image Disk

Considerations

You might get confused with the names of vhds, when you have multiple virtual machines under the same storage account. A way of knowing the name of the vhds associated with a particular machine is running ‘Get-AzureDisk’ cmdlet in Windows PowerShell. This cmdlet will get you all the details of disks in each virtual machine.

Disk Considerations

Step 1 − Run the following command

Get-AzureDisk  

Step 2 − Locate your virtual machine name in the pst. Under that virtual machine, check the diskname and mediapnk for your vhd name and pnk.

Advertisements