ASM到ARM遷移(二)
阿新 • • 發佈:2017-06-24
settings ger vnet ups finished pad oca 一中 rem
在一中討論了通過Azure平臺的工具進行遷移的方案。
本文將討論另外一種遷移方式。通過磁盤復制的方式,把部分VM遷移到ARM的Managed Disk模式。
一. 獲得ASM中Disk的信息
在管理界面上,獲取VM的Disk信息
二. 通過這個Disk的URL,創建Managed Disk
[email protected]:~# az disk create -g hwfdsk -n hwmd01 --source https://h2portalvhdsn6t2ktgjscst.blob.core.chinacloudapi.cn/vhds/hwfdsk-hwfdsk-2017-06-23.vhd{/ Finished .. "accountType": "Premium_LRS", "creationData": { "createOption": "Import", "imageReference": null, "sourceResourceId": null, "sourceUri": "https://h2portalvhdsn6t2ktgjscst.blob.core.chinacloudapi.cn/vhds/hwfdsk-hwfdsk-2017-06-23.vhd", "storageAccountId": null }, "diskSizeGb": null, "encryptionSettings": null, "id": "/subscriptions/xxxx/resourceGroups/hwfdsk/providers/Microsoft.Compute/disks/hwmd01", "location": "chinanorth", "name": "hwmd01", "osType": null, "ownerId": null, "provisioningState": "Succeeded", "resourceGroup": "hwfdsk", "tags": {}, "timeCreated": "2017-06-23T14:52:46.629909+00:00", "type": "Microsoft.Compute/disks" }
此時可以通過命令行獲得這個Disk的信息:
[email protected]:~# az disk list -o table AccountType Location Name ProvisioningState ResourceGroup TimeCreated DiskSizeGb OsType OwnerId ------------- ---------- ----------------- ------------------- --------------- -------------------------------- ------------ -------- --------------------------------------------------------------------------------------------------------------------------- Premium_LRS chinanorth hwmd01 Succeeded HWFDSK 2017-06-23T14:52:46.629909+00:00
因為創建是沒有制定sku,所以默認創建了Premium的Disk。是在Managed Disk的管理模式下,非常方便的可以更改其SKU。具體命令如下:
[email protected]:~# az disk update -n hwmd01 -g hwfdsk --sku Standard_LRS { "accountType": "Standard_LRS", "creationData": { "createOption": "Import", "imageReference": null, "sourceResourceId": null, "sourceUri": "https://h2portalvhdsn6t2ktgjscst.blob.core.chinacloudapi.cn/vhds/hwfdsk-hwfdsk-2017-06-23.vhd", "storageAccountId": null }, "diskSizeGb": null, "encryptionSettings": null, "id": "/subscriptions/xxxx/resourceGroups/hwfdsk/providers/Microsoft.Compute/disks/hwmd01", "location": "chinanorth", "name": "hwmd01", "osType": null, "ownerId": null, "provisioningState": "Succeeded", "resourceGroup": "hwfdsk", "tags": {}, "timeCreated": "2017-06-23T14:52:46.629909+00:00", "type": "Microsoft.Compute/disks" }
此時Disk已經變成HDD的了。
三 通過這個Disk創建VM
創建VM前,先查詢在ARM中的VNet信息:
在Portal頁面上找到Vnet信息:
然後,用命令行創建VM:
[email protected]:~# az vm create -n hwfdsk01 -g hwfdsk --attach-os-disk hwmd01 --size Standard_D1 --vnet-name hwazcopy-vnet --subnet default --os-type linux {/ Finished .. "fqdns": "", "id": "/subscriptions/xxxx/resourceGroups/hwfdsk/providers/Microsoft.Compute/virtualMachines/hwfdsk01", "location": "chinanorth", "macAddress": "00-17-FA-00-A7-B6", "powerState": "VM running", "privateIpAddress": "10.0.0.4", "publicIpAddress": "139.219.108.26", "resourceGroup": "hwfdsk" }
命令格式非常簡單,由於是已經有的Disk,所以不用指定用戶名和密碼,只需要指定:
- 機器名稱
- 資源組
- 掛載的OSDisk信息
- VM的Size
- Vnet信息,包括Subnet信息
- OS類型
Protal上可以看到機器已經運行起來了,並且剛剛配置的幾個參數,都可以找到:
四 總結
通過ASM中VM的VHD鏈接創建Managed Disk,在通過這個Manage Disk方便的創建一臺VM。實現快速的VM從ASM到ARM的遷移。
ASM到ARM遷移(二)