Difference between revisions of "Azure Disk"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-disk-storage | https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-disk-storage | ||
+ | |||
+ | |||
+ | # Restore disk | ||
+ | |||
+ | https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-manage-disks#take-a-disk-snapshot | ||
+ | ``` | ||
+ | #Create snapshot | ||
+ | osdiskid=$(az vm show \ | ||
+ | -g myResourceGroupDisk \ | ||
+ | -n myVM \ | ||
+ | --query "storageProfile.osDisk.managedDisk.id" \ | ||
+ | -o tsv) | ||
+ | |||
+ | az snapshot create \ | ||
+ | --resource-group myResourceGroupDisk \ | ||
+ | --source "$osdiskid" \ | ||
+ | --name osDisk-backup | ||
+ | |||
+ | #Create disk from snapshot | ||
+ | az disk create \ | ||
+ | --resource-group myResourceGroupDisk \ | ||
+ | --name mySnapshotDisk \ | ||
+ | --source osDisk-backup | ||
+ | |||
+ | #Create a new virtual machine from the snapshot disk. | ||
+ | az vm create \ | ||
+ | --resource-group myResourceGroupDisk \ | ||
+ | --name myVM \ | ||
+ | --attach-os-disk mySnapshotDisk \ | ||
+ | --os-type linux | ||
+ | ``` |
Revision as of 18:44, 24 October 2021
https://blog.mycloudit.com/4-differences-between-the-azure-vm-storage-types
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-disk-storage
Restore disk
#Create snapshot osdiskid=$(az vm show \ -g myResourceGroupDisk \ -n myVM \ --query "storageProfile.osDisk.managedDisk.id" \ -o tsv) az snapshot create \ --resource-group myResourceGroupDisk \ --source "$osdiskid" \ --name osDisk-backup #Create disk from snapshot az disk create \ --resource-group myResourceGroupDisk \ --name mySnapshotDisk \ --source osDisk-backup #Create a new virtual machine from the snapshot disk. az vm create \ --resource-group myResourceGroupDisk \ --name myVM \ --attach-os-disk mySnapshotDisk \ --os-type linux