You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/virtual-machines/linux/disks-upload-vhd-to-managed-disk-cli.md
+27-23Lines changed: 27 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,58 +1,60 @@
1
1
---
2
-
title: Upload a VHD using the Azure CLI
3
-
description: Learn how to upload a vhd to an Azure managed disk and copy a managed disk across regions, using the Azure CLI, via direct upload.
2
+
title: Upload a VHD to Azure or copy a disk across regions - Azure CLI
3
+
description: Learn how to upload a VHD to an Azure managed disk and copy a managed disk across regions, using the Azure CLI, via direct upload.
4
4
services: "virtual-machines,storage"
5
5
author: roygara
6
6
ms.author: rogarana
7
-
ms.date: 03/13/2020
7
+
ms.date: 03/27/2020
8
8
ms.topic: article
9
9
ms.service: virtual-machines
10
10
ms.subservice: disks
11
11
---
12
12
13
-
# Upload a vhd to Azure using Azure CLI
13
+
# Upload a VHD to Azure or copy a managed disk to another region - Azure CLI
14
14
15
-
This article explains how to upload a vhd from your local machine to an Azure managed disk. Previously, you had to follow a more involved process that included staging your data in a storage account, and managing that storage account. Now, you no longer need to manage a storage account, or stage data in it to upload a vhd. Instead, you create an empty managed disk, and upload a vhd directly to it. This simplifies uploading on-premises VMs to Azure and enables you to upload a vhd up to 32 TiB directly into a large managed disk.
16
-
17
-
If you are providing a backup solution for IaaS VMs in Azure, we recommend you use direct upload to restore customer backups to managed disks. If you are uploading a VHD from a machine external to Azure, speeds will depend on your local bandwidth. If you are using an Azure VM, then your bandwidth will be the same as standard HDDs.
18
-
19
-
Currently, direct upload is supported for standard HDD, standard SSD, and premium SSD managed disks. It is not yet supported for ultra SSDs.
- Download the latest [version of AzCopy v10](../../storage/common/storage-use-azcopy-v10.md#download-and-install-azcopy).
24
20
-[Install the Azure CLI](/cli/azure/install-azure-cli).
25
-
- A vhd file, stored locally
26
-
- If you intend to upload a vhd from on-premises: A fixed size vhd that [has been prepared for Azure](../windows/prepare-for-upload-vhd-image.md), stored locally.
21
+
- If you intend to upload a VHD from on-premises: A fixed size VHD that [has been prepared for Azure](../windows/prepare-for-upload-vhd-image.md), stored locally.
27
22
- Or, a managed disk in Azure, if you intend to perform a copy action.
28
23
29
-
## Create an empty managed disk
24
+
## Getting started
25
+
26
+
If you'd prefer to upload disks through a GUI, you can do so using Azure Storage Explorer. For details refer to: [Use Azure Storage Explorer to manage Azure managed disks](disks-use-storage-explorer-managed-disks.md)
30
27
31
-
To upload your vhd to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
28
+
To upload your VHD to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
32
29
33
30
This kind of managed disk has two unique states:
34
31
35
32
- ReadToUpload, which means the disk is ready to receive an upload but, no [secure access signature](https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1) (SAS) has been generated.
36
33
- ActiveUpload, which means that the disk is ready to receive an upload and the SAS has been generated.
37
34
38
-
While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
35
+
> [!NOTE]
36
+
> While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
39
37
40
-
Before you can create an empty standard HDD for uploading, you'll need to have the file size of the vhd you want to upload, in bytes. To get that, you can use either `wc -c <yourFileName>.vhd` or `ls -al <yourFileName>.vhd`. This value is used when specifying the **--upload-size-bytes** parameter.
38
+
## Create an empty managed disk
39
+
40
+
Before you can create an empty standard HDD for uploading, you'll need the file size of the VHD you want to upload, in bytes. To get that, you can use either `wc -c <yourFileName>.vhd` or `ls -al <yourFileName>.vhd`. This value is used when specifying the **--upload-size-bytes** parameter.
41
41
42
42
Create an empty standard HDD for uploading by specifying both the **-–for-upload** parameter and the **--upload-size-bytes** parameter in a [disk create](/cli/azure/disk#az-disk-create) cmdlet:
43
43
44
+
Replace `<yourdiskname>`, `<yourresourcegroupname>`, `<yourregion>` with values of your choosing. The `--upload-size-bytes` parameter contains an example value of `34359738880`, replace it with a value appropriate for you.
45
+
44
46
```azurecli
45
-
az disk create -n mydiskname -g resourcegroupname -l westus2 --for-upload --upload-size-bytes 34359738880 --sku standard_lrs
47
+
az disk create -n <yourdiskname> -g <yourresourcegroupname> -l <yourregion> --for-upload --upload-size-bytes 34359738880 --sku standard_lrs
46
48
```
47
49
48
-
If you would like to upload either a premium SSD or a standard SSD, replace **standard_lrs** with either **premium_LRS** or **standardssd_lrs**. Ultra SSD is not yet supported.
50
+
If you would like to upload either a premium SSD or a standard SSD, replace **standard_lrs** with either **premium_LRS** or **standardssd_lrs**. Ultra disks are not supported for now.
49
51
50
-
You have now created an empty managed disk that is configured for the upload process. To upload a vhd to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
52
+
Now that you've created an empty managed disk that is configured for the upload process, you can upload a VHD to it. To upload a VHD to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
51
53
52
-
To generate a writable SAS of your empty managed disk, use the following command:
54
+
To generate a writable SAS of your empty managed disk, replace `<yourdiskname>`and `<yourresourcegroupname>`, then use the following command:
53
55
54
56
```azurecli
55
-
az disk grant-access -n mydiskname -g resourcegroupname --access-level Write --duration-in-seconds 86400
57
+
az disk grant-access -n <yourdiskname> -g <yourresourcegroupname> --access-level Write --duration-in-seconds 86400
56
58
```
57
59
58
60
Sample returned value:
@@ -63,7 +65,7 @@ Sample returned value:
63
65
}
64
66
```
65
67
66
-
## Upload vhd
68
+
## Upload a VHD
67
69
68
70
Now that you have a SAS for your empty managed disk, you can use it to set your managed disk as the destination for your upload command.
After the upload is complete, and you no longer need to write any more data to the disk, revoke the SAS. Revoking the SAS will change the state of the managed disk and allow you to attach the disk to a VM.
79
81
82
+
Replace `<yourdiskname>`and `<yourresourcegroupname>`, then use the following command to make the disk usable:
83
+
80
84
```azurecli
81
-
az disk revoke-access -n mydiskname -g resourcegroupname
85
+
az disk revoke-access -n <yourdiskname> -g <yourresourcegroupname>
82
86
```
83
87
84
88
## Copy a managed disk
@@ -116,5 +120,5 @@ az disk revoke-access -n $targetDiskName -g $targetRG
116
120
117
121
## Next steps
118
122
119
-
Now that you've successfully uploaded a vhd to a managed disk, you can attach the disk as a [data disk to an existing VM](add-disk.md) or [attach the disk to a VM as an OS disk](upload-vhd.md#create-the-vm), to create a new VM.
123
+
Now that you've successfully uploaded a VHD to a managed disk, you can attach the disk as a [data disk to an existing VM](add-disk.md) or [attach the disk to a VM as an OS disk](upload-vhd.md#create-the-vm), to create a new VM.
Copy file name to clipboardExpand all lines: articles/virtual-machines/windows/disks-upload-vhd-to-managed-disk-powershell.md
+31-26Lines changed: 31 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,18 @@
1
1
---
2
-
title: Upload a vhd to Azure using Azure PowerShell
3
-
description: Learn how to upload a vhd to an Azure managed disk and copy a managed disk across regions, using Azure PowerShell, via direct upload.
2
+
title: Upload a VHD to Azure or copy a disk across regions - Azure PowerShell
3
+
description: Learn how to upload a VHD to an Azure managed disk and copy a managed disk across regions, using Azure PowerShell, via direct upload.
4
4
author: roygara
5
5
ms.author: rogarana
6
-
ms.date: 03/13/2020
6
+
ms.date: 03/27/2020
7
7
ms.topic: article
8
8
ms.service: virtual-machines-linux
9
9
ms.tgt_pltfrm: linux
10
10
ms.subservice: disks
11
11
---
12
12
13
-
# Upload a vhd to Azure using Azure PowerShell
13
+
# Upload a VHD to Azure or copy a managed disk to another region - Azure PowerShell
14
14
15
-
This article explains how to upload a vhd from your local machine to an Azure managed disk. Previously, you had to follow a more involved process that included staging your data in a storage account, and managing that storage account. Now, you no longer need to manage a storage account, or stage data in it to upload a vhd. Instead, you create an empty managed disk, and upload a vhd directly to it. This simplifies uploading on-premises VMs to Azure and enables you to upload a vhd up to 32 TiB directly into a large managed disk.
16
-
17
-
If you are providing a backup solution for IaaS VMs in Azure, we recommend you use direct upload to restore customer backups to managed disks. If you are uploading a VHD from a machine external to Azure, speeds with depend on your local bandwidth. If you are using an Azure VM, then your bandwidth will be the same as standard HDDs.
18
-
19
-
Currently, direct upload is supported for standard HDD, standard SSD, and premium SSD managed disks. It is not yet supported for ultra SSDs.
@@ -25,42 +21,49 @@ Currently, direct upload is supported for standard HDD, standard SSD, and premiu
25
21
- If you intend to upload a VHD from on-premises: A fixed size VHD that [has been prepared for Azure](prepare-for-upload-vhd-image.md), stored locally.
26
22
- Or, a managed disk in Azure, if you intend to perform a copy action.
27
23
28
-
## Create an empty managed disk
24
+
## Getting started
25
+
26
+
If you'd prefer to upload disks through a GUI, you can do so using Azure Storage Explorer. For details refer to: [Use Azure Storage Explorer to manage Azure managed disks](disks-use-storage-explorer-managed-disks.md)
29
27
30
-
To upload your vhd to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
28
+
To upload your VHD to Azure, you'll need to create an empty managed disk that is configured for this upload process. Before you create one, there's some additional information you should know about these disks.
31
29
32
30
This kind of managed disk has two unique states:
33
31
34
32
- ReadToUpload, which means the disk is ready to receive an upload but, no [secure access signature](https://docs.microsoft.com/azure/storage/common/storage-dotnet-shared-access-signature-part-1) (SAS) has been generated.
35
33
- ActiveUpload, which means that the disk is ready to receive an upload and the SAS has been generated.
36
34
37
-
While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
35
+
> [!NOTE]
36
+
> While in either of these states, the managed disk will be billed at [standard HDD pricing](https://azure.microsoft.com/pricing/details/managed-disks/), regardless of the actual type of disk. For example, a P10 will be billed as an S10. This will be true until `revoke-access` is called on the managed disk, which is required in order to attach the disk to a VM.
38
37
39
-
Before you create an empty standard HDD for uploading, you'll need the file size in bytes of the vhd you want to upload. The example code will get that for you but, to do it yourself you can use: `$vhdSizeBytes = (Get-Item "<fullFilePathHere>").length`. This value is used when specifying the **-UploadSizeInBytes** parameter.
38
+
## Create an empty managed disk
39
+
40
+
Before you can create an empty standard HDD for uploading, you'll need the file size of the VHD you want to upload, in bytes. The example code will get that for you but, to do it yourself you can use: `$vhdSizeBytes = (Get-Item "<fullFilePathHere>").length`. This value is used when specifying the **-UploadSizeInBytes** parameter.
40
41
41
-
Now, on your local shell, create an empty standard HDD for uploading by specifying the **Upload** setting in the **-CreateOption** parameter as well as the **-UploadSizeInBytes** parameter in the [New-AzDiskConfig](https://docs.microsoft.com/powershell/module/az.compute/new-azdiskconfig?view=azps-1.8.0) cmdlet. Then call [New-AzDisk](https://docs.microsoft.com/powershell/module/az.compute/new-azdisk?view=azps-1.8.0) to create the disk:
42
+
Now, on your local shell, create an empty standard HDD for uploading by specifying the **Upload** setting in the **-CreateOption** parameter as well as the **-UploadSizeInBytes** parameter in the [New-AzDiskConfig](https://docs.microsoft.com/powershell/module/az.compute/new-azdiskconfig?view=azps-1.8.0) cmdlet. Then call [New-AzDisk](https://docs.microsoft.com/powershell/module/az.compute/new-azdisk?view=azps-1.8.0) to create the disk.
43
+
44
+
Replace `<yourdiskname>`, `<yourresourcegroupname>`, and `<yourregion>` then run the following commands:
If you would like to upload either a premium SSD or a standard SSD, replace **Standard_LRS** with either **Premium_LRS** or **StandardSSD_LRS**. Ultra SSD is not yet supported.
54
+
If you would like to upload either a premium SSD or a standard SSD, replace **Standard_LRS** with either **Premium_LRS** or **StandardSSD_LRS**. Ultra disks are not yet supported.
52
55
53
-
You have now created an empty managed disk that is configured for the upload process. To upload a vhd to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
56
+
Now that you've created an empty managed disk that is configured for the upload process, you can upload a VHD to it. To upload a VHD to the disk, you'll need a writeable SAS, so that you can reference it as the destination for your upload.
54
57
55
-
To generate a writable SAS of your empty managed disk, use the following command:
58
+
To generate a writable SAS of your empty managed disk, replace `<yourdiskname>`and `<yourresourcegroupname>`, then use the following commands:
After the upload is complete, and you no longer need to write any more data to the disk, revoke the SAS. Revoking the SAS will change the state of the managed disk and allow you to attach the disk to a VM.
76
79
80
+
Replace `<yourdiskname>`and `<yourresourcegroupname>`, then run the following command:
Direct upload also simplifies the process of copying a managed disk. You can either copy within the same region or cross-region (to another region).
88
+
Direct upload also simplifies the process of copying a managed disk. You can either copy within the same region or copy your managed disk to another region.
84
89
85
-
The follow script will do this for you, the process is similar to the steps described earlier, with some differences since you're working with an existing disk.
90
+
The follow script will do this for you, the process is similar to the steps described earlier, with some differences, since you're working with an existing disk.
86
91
87
92
> [!IMPORTANT]
88
93
> You need to add an offset of 512 when you're providing the disk size in bytes of a managed disk from Azure. This is because Azure omits the footer when returning the disk size. The copy will fail if you do not do this. The following script already does this for you.
Now that you've successfully uploaded a vhd to a managed disk, you can attach your disk to a VM and begin using it.
127
+
Now that you've successfully uploaded a VHD to a managed disk, you can attach your disk to a VM and begin using it.
123
128
124
129
To learn how to attach a data disk to a VM, see our article on the subject: [Attach a data disk to a Windows VM with PowerShell](attach-disk-ps.md). To use the disk as the OS disk, see [Create a Windows VM from a specialized disk](create-vm-specialized.md#create-the-new-vm).
This article explains how to either upload a VHD from your local machine to an Azure managed disk or copy a managed disk to another region, using AzCopy. This process, direct upload, also enables you to upload a VHD up to 32 TiB in size directly into a managed disk. Currently, direct upload is supported for standard HDD, standard SSD, and premium SSD managed disks. It isn't supported for ultra disks, yet.
14
+
15
+
If you're providing a backup solution for IaaS VMs in Azure, we recommend using direct upload to restore customer backups to managed disks. When uploading a VHD from a source external to Azure, speeds would depend on your local bandwidth. When uploading or copying from an Azure VM, then your bandwidth would be the same as standard HDDs.
0 commit comments