Export (0) Print
Expand All
22 out of 29 rated this helpful - Rate this topic

Manage Disks and Images

Updated: April 2, 2014

This article provides details about managing virtual hard disks, images, and disks in Windows Azure, and links to instructions on working with them.

All virtual machines in Windows Azure are configured with at least two disks when you create the virtual machine – one is an operating system disk and the other is a temporary local disk, sometimes called a resource disk. The drive letter or mount point of a temporary disk is assigned automatically. To reassign it for a Windows VM, see Change the drive letter of the Windows temporary disk, later in this article.

ImportantImportant
Do not store data on the temporary disk. This disk provides temporary storage for applications and processes and is used to store transient data such as page or swap files.

All images and disks, except the temporary disk, are created from virtual hard disks (VHDs). Data disks are also created from VHDs. The virtual hard disks are .vhd files stored as page blobs in a storage account in Windows Azure. For more information about page blobs, see Understanding Block Blobs and Page Blobs.

After you create a virtual machine, you can also configure it with one or more data disks. For more information about configuring a virtual machine, see Virtual Machines.

Outside of Windows Azure, virtual hard disks can use either a VHD or a VHDX format. They can also be fixed, dynamically expanding, or differencing. Windows Azure supports VHD format, fixed disks. The fixed format lays the logical disk out linearly within the file, so that disk offset X is stored at blob offset X. A small footer at the end of the blob describes the properties of the VHD. Often, the fixed format wastes space because most disks have large unused ranges in them. However, Windows Azure stores .vhd files in a sparse format, so you receive the benefits of both the fixed and dynamic disks at the same time. For more information about VHDs, see Getting Started with Virtual Hard Disks.

All .vhd files in Windows Azure that are intended for use as a source for creating disks or images are read only. When you create a disk or image, Windows Azure makes copies of the .vhd files. These copies can be read only or read and write, depending on how you use the VHD.

You can use your own VHD that contains an operating system or data by uploading the VHD to a Windows Azure storage account. Various tools are available to create VHDs. For example, you can use Hyper-V or the Disk Management snap-in available in recent versions of Windows. To upload the disk, use Add-AzureVHD. This cmdlet is available in the Windows Azure PowerShell module. You can download the module from the “Command Line Tools” section of the Downloads page on WindowsAzure.com.

noteNote
If your VHD is a dynamic disk, convert it to a fixed disk before you try to upload it. You can use Hyper-V Manager or the convert-vhd cmdlet to do this.

After you upload a VHD, you can use it as a source to create an image or operating system disk. Or, if it contains data, you can attach it to a virtual machine as a data disk.

The .vhd files are stored as page blobs. Several tools are available for you to use to manage blobs in storage.

You can use elements in the Blob Service Rest API to work with blobs in storage. For more information, see Operations on Blobs. You can also copy blobs across storage accounts. For more information about copying blobs, see Introducing Asynchronous Cross-Account Copy Blob.

noteNote
Only storage accounts created on or after June 7th, 2012 allow the Copy Blob operation to copy from another storage account.

When you create a virtual machine from an image, Windows Azure creates a disk for the virtual machine that is a copy of the source .vhd file. To protect against accidental deletion, Windows Azure places a lease on any source .vhd file that’s used to create an image, an operating system disk, or a data disk.

Before you can delete a source .vhd file, you’ll need to remove the lease by deleting the disk or image. To delete a .vhd file that is being used by a virtual machine as an operating system disk, you can delete the virtual machine, the operating system disk, and the source .vhd file all at once by deleting the virtual machine and deleting all associated disks. However, deleting a .vhd file that’s a source for a data disk requires several steps in a set order -- detach the disk from the virtual machine, delete the disk, and then delete the .vhd file.

An image is a .vhd file that you can use as a template to create a new virtual machine. An image is a template because it doesn’t have specific settings like a configured virtual machine, such as the computer name and user account settings. You can use images available through the Windows Azure Management Portal, or you can create your own images:

noteNote
You can also use the Management Portal to create an image from a .vhd file that already exists in a storage account. See “Add the Image to Your List of Custom Images” in Creating and Uploading a Virtual Hard Disk that Contains the Windows Server Operating System.

You can add and delete images, list images that you have added, and update images. After you upload a .vhd file into a storage account, the following resources can help you manage the image:

You can easily delete an image if you don’t need it as a template for creating virtual machines. If you create a virtual machine from an image, an operating system disk is created when the virtual machine is created. If you delete the image, the operating system disk is not deleted, which means you can create another image or a virtual machine from the disk. A .vhd file that you upload to create an image is not deleted when an image is deleted. You must delete an image before you can delete the .vhd file that is the source of the image.

  1. If you have not already done so, sign in to the Windows Azure Management Portal.

  2. Click Virtual Machines, and then click Images.

  3. Select the image that you want to delete, and then click Delete Image.

You use disks in different ways with a virtual machine in Windows Azure. An operating system disk is a VHD that you use to provide an operating system for a virtual machine. A data disk is a VHD that you attach to a virtual machine to store application data.

You choose from multiple ways to create disks depending on the needs of your application. For example, a typical way to create a disk is to use an image from the Image Gallery when you create a virtual machine and an operating system disk is created for you. A typical way for you to create a data disk is to attach an empty disk to a virtual machine and a new data disk is created for you. You can create a disk by using a .vhd file that has been uploaded or copied to a storage account that is related to your subscription. You can’t use the portal to upload .vhd files, but you can use other tools that work with Windows Azure storage to upload or copy the file.

The following diagram shows the disks that are used by a virtual machine.

Manage disks in Windows Server
  • Operating system disk - Every virtual machine has one attached operating system disk. You can upload a VHD that can be used as an operating system disk, or you can create a virtual machine from an image and a disk is created for you. This disk is a copy of a source .vhd file and the new copy is registered as an operating system disk. An operating system disk can be a maximum of 127 GB. When Windows Azure creates an operating system disk, three copies of the disk are created for high durability. Additionally, if you choose to use disaster recovery that is geo-replication based, your VHD is also replicated at a distance of greater than 400 miles. Operating system disks are registered as SATA drives and are labeled as the C drive.

    noteNote
    When troubleshooting issues on an operating system disk, you can attach the disk as a data disk to a running virtual machine to access the data on the disk and diagnose problems using the logs.

  • The temporary disk is automatically created for you. On Windows virtual machines, this disk is labeled as the D drive. On Linux virtual machines, the disk is typically /dev/sdb and is formatted and mounted to /mnt/resource by the Windows Azure Linux Agent.

    ImportantImportant
    Do not store data on the temporary disk. This disk provides temporary storage for applications and processes and is used to store transient data such as page or swap files.

  • Data disk – A data disk is a VHD that can be attached to a running virtual machine to persistently store application data. You can upload and attach a data disk that already contains data to the virtual machine, or you can use the Windows Azure Management Portal to attach an empty disk to the machine. The maximum size of a data disk is 1 TB. Data disks are registered as SCSI drives and are labeled with a letter that you choose.

    The size of the virtual machine determines the number of disks that you can attach to it. For more information, see Virtual Machine Sizes for Windows Azure

    See the following articles for instructions:

Following are some considerations about disks in Windows Azure.

The operating system disk and data disk has a host caching setting (sometimes called host-cache mode) that enables improved performance under some circumstances. However, these settings can negatively affect performance in other circumstances, depending on the application. Host caching is OFF by default for both read operations and write operations for data disks. Host-caching is ON by default for read and write operations for operating system disks. To change the setting in data disks, use the Set-AzureDataDisk cmdlet. To change it in operating system disks, use the Set-AzureOSDisk cmdlet.

Data loss may occur if you use striped volumes (Windows or Linux) in geo-replicated storage accounts. If a storage outage occurs that requires restoring data from a replicated copy, there is no guarantee that the write order of the stripe disk set would be intact once restored.

For both operating system disks and data disks, you can view a list of disks, add and delete disks, and update disks. For Windows virtual machines, you also can change the drive letter of the temporary disk.

You can find the disks that are attached to a virtual machine by using either the dashboard or the Disks page of Virtual Machines in the Management Portal.

  1. If you have not already done so, sign in to the Windows Azure Management Portal.

  2. Click Virtual Machines, and then select the appropriate virtual machine.

  3. Click Dashboard. On the dashboard for the virtual machine, you can find the number of attached disks and the names of the disks. The following example shows one data disk attached to a virtual machine:

    Find the attached data disks
    noteNote
    The temporary local disk is not listed in the disks section.

  1. If you have not already done so, sign in to the Windows Azure Management Portal.

  2. Click Virtual Machines, and then click Disks. This page shows a list of all disks that are available to use with virtual machines, and it shows the disks that are being used by virtual machines. The list is a combination of operating system disks and data disks. To differentiate between the two types of disks, review disk information in the dashboard.

    noteNote
    When you attach a new data disk to a virtual machine, you can provide a name for the .vhd file that is used for the disk, but Windows Azure provides a name for the disk. The name consists of the cloud service name, the virtual machine name, and a numeric identifier.

You can delete operating system disks and data disks if you do not need them anymore. To delete an operating system disk, you can delete it when you delete the virtual machine. You can delete a data disk after you detach it from the virtual machine, unless you’re also deleting the virtual machine.

  1. If you have not already done so, sign in to the Windows Azure Management Portal.

  2. Click Virtual Machines, and then click Disks.

  3. Select the disk that you want to delete, and then click Delete Disk.

See the following resources for more information about managing disks:

You can change the drive letter of the temporary disk if you need to use the D drive for another purpose. Most likely this would be to support an application or service that uses the D drive as a permanent storage location. To prepare for this change, make sure you’ve got the following:

  • One attached data disk that you can use to store the Windows page file (pagefile.sys) during this procedure.

  • If you want to use an existing data disk on the D drive, the uploaded VHD available in the storage account.

  1. Log in to the virtual machine.

  2. Move pagefile.sys from the D drive to another drive.

  3. Restart the virtual machine.

  4. Log in again and change the drive letter D to E.

  5. From the Management Portal, attach an existing data disk or an empty data disk. (For instructions, see How to Attach a Data Disk to a Virtual Machine.)

  6. Log in to the virtual machine, initialize the disk, and assign D as the drive letter for the disk you just attached.

  7. From the Management Portal, restart the virtual machine.

  8. Log back in to the virtual machine and verify that E is mapped to the Temporary Storage disk.

  9. Move pagefile.sys from the other drive to the E drive.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.