0

I've have recreated a virtual machine in azure, when I did it azure assigned an OS disk to the VM which is normal and obvious, and I have a disk from my previous virtual machine.

for now I got two disks in the panel: - OS disk - Data Disk

azure disks

what I want is to delete the "current OS disk" and Set data disk as OS disk is that possible?

pedrommuller
  • 279
  • 5
  • 13

1 Answers1

2

You can't swap the disks in a VM, but you can register the data disk as an OS disk and build a new VM while using the newly registered disk.

What you need to do is:

  1. Delete the VM while keeping the disks.
  2. (Optional) Create a backup copy of the data disk, use the PowerShell command Start-AzureStorageBlobCopy, more information here: http://blogs.technet.com/b/heyscriptingguy/archive/2014/01/24/create-backups-of-virtual-machines-in-windows-azure-by-using-powershell.aspx.
  3. Convert the data disk to an OS disk, use the PowerShell command Add-AzureDisk -DiskName "MyLinuxDisk" -MediaLocation "http://yourstorageaccount.blob.core.azure.com/vhds/linuxsys.vhd" -OS "Linux", more information here: http://msdn.microsoft.com/en-us/library/azure/dn495252.aspx
  4. Create a new custom VM, where you will use the newly added OS disk, you will find it under the "My Images" section in the Azure portal.

Hope this helps.

Noor Khaldi
  • 3,829
  • 3
  • 18
  • 28