Add Data Disk
Updated: July 18, 2012
The Add Data Disk operation adds a data disk to a virtual machine.
Request
The Add Data Disk request is specified as follows. Replace <subscription-id> with your subscription ID, <service-name> with the name of your service, <deployment-name> with the name of the deployment, and <role-name> with the name of the role to add the data disk to:
| Method | Request URI | HTTP Version |
|---|---|---|
|
POST |
|
HTTP/1.1 |
URI Parameters
None.
Request Headers
The following table describes the request headers.
| Request Header | Description |
|---|---|
|
x-ms-version |
Required. Specifies the version of the operation to use for this request. Currently this header should be set to 2012-03-01. |
Request Body
The format of the request body is as follows:
<DataVirtualHardDisk xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <HostCaching>ReadOnly|ReadWrite</HostCaching> <DiskLabel>new-name-for-disk-disk</DiskLabel> <DiskName>name-of-disk-in-image-repository</DiskName> <Lun>0-to-15</Lun> <LogicalDiskSizeInGB>size-in-gb-of-the-data-data-disk</LogicalDiskSizeInGB> <MediaLink>uri-of-the-blob</MediaLink> <SourceMediaLink>uri-of-the-blob</SourceMediaLink> </DataVirtualHardDisk>
The following table describes the key elements of the request body:
| Element name | Description | ||
|---|---|---|---|
|
HostCaching |
Required. Specifies the platform caching behavior of data disk blob for read/write efficiency. The default vault is ReadOnly. Possible values are:
|
||
|
DiskLabel |
Optional. Specifies the description of the data disk. When you attach a disk, either by directly referencing a media using the MediaLink element or specifying the target disk size, you can use the DiskLabel element to customize the name property of the target data disk. |
||
|
DiskName |
Optional. Specifies the name of the disk. Windows Azure uses the specified disk to create the data disk for the machine and populates this field with the disk name. |
||
|
Lun |
Optional. Specifies the Logical Unit Number (LUN) for the disk. The LUN specifies the slot in which the data drive appears when mounted for usage by the virtual machine. Valid LUN values are 0 through 15. |
||
|
LogicalDiskSizeInGB |
Optional. Specifies the size, in GB, of an empty disk to be attached to the role. The disk can be created as part of disk attach or create VM role call by specifying the value for this property. Windows Azure creates the empty disk based on size preference and attaches the newly created disk to the Role. |
||
|
MediaLink |
Required. Specifies the location of the blob in Windows Azure blob store where the media for the disk is located. The blob location must belong to the storage account in the subscription specified by the Example: http://example.blob.core.windows.net/disks/mydisk.vhd |
||
|
SourceMediaLink |
Optional. Specifies the location of a blob in account storage which is mounted as a data disk when the virtual machine is created. |
Response
The response includes an HTTP status code and a set of response headers.
Status Code
A successful operation returns status code 201 (Created). For information about status codes, see Service Management Status and Error Codes.
Response Headers
The response for this operation includes the following headers. The response may also include additional standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.
| Response Header | Description |
|---|---|
|
x-ms-request-id |
A value that uniquely identifies a request made against the Management service. For an asynchronous operation, you can call get operation status with the value of the header to determine whether the operation is complete, has failed, or is still in progress. See Tracking Asynchronous Service Management Requests for more information. |
Response Body
None.
Authorization
Only the account owner may call this operation.
Remarks
There are three ways to create the data disk using the Add Data Disk operation.
Option 1 – Attach an empty data disk to the role by specifying the disk label and location of the disk image.
-
Do not include the DiskName and SourceMediaLink elements in the request body.
-
Include the MediaLink element and reference a blob that is in the same geographical region as the role.
-
You can also omit the MediaLink element. In this usage, Windows Azure will create the data disk in the storage account configured as default for the role.
Option 2 – Attach an existing data disk that is in the image repository.
-
Do not include the DiskName and SourceMediaLink elements in the request body.
-
Specify the data disk to use by including the DiskName element.
Note |
|---|
| If included the in the response body, the MediaLink and LogicalDiskSizeInGB elements are ignored. |
Option 3 - Specify the location of a blob in your storage account that contain a disk image to use.
-
Include the SourceMediaLink element.
Note |
|---|
| If the MediaLink element is included, it is ignored. |
Warning
Note