Attaching restored OS disk to existing VM

六眼飞鱼酱① 提交于 2019-12-25 16:54:26

问题


I have one VM with a daily backup scheduled. Today I deleted a file in that VM and changed some configuration. I restored yesterday's data disk from my recovery service vault and changed the names of the recovered data disk.

Now I want to attach yesterday's restored backup to my existing VM. Is it possible?

If not then suppose I delete my VM but I keep its network interface card. I can create a new VM from restored VHDs using ARM templates but how can I assign an existing NIC to my new VM?

Also, I have added this VM to my domain controller. If I recreate the VM, do I need to add the new VM to the domain controller or will it work normally?


回答1:


Now I want to attach yesterday's restored backup to my existing VM. is it possible?

Yes, we can attach this restore disk to your existing VM, then we can find the disk in your existing VM.

I delete VM but I keep network interface card for the VM, now I can create VM from restored VHD's using ARM templates but how to assign exiting NIC in the new VM?

Yes, we can use PowerShell to create a VM with existing NIC and VHD, here is an example:

$rgname = "jason-newgroup" 
$loc = "japaneast" 
$vmsize = "Standard_DS1_v2" 
$vmname = "jason-newtest2" 
$vm = New-AzureRmVMConfig -VMName $vmname -VMSize $vmsize 
$nic = Get-AzureRmNetworkInterface -Name "NICname" -ResourceGroupName $rgname 
$nicId = $nic.Id 
$vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nicId 
$osDiskName = "jason-newtest" 
$osDiskVhdUri = "https://jasonnewgroupdisks912.blob.core.windows.net/vhds/jason-newtest201681285042.vhd" 
$vm = Set-AzureRmVMOSDisk -VM $vm -VhdUri $osDiskVhdUri -name $osDiskName -CreateOption attach -Windows 
New-AzureRmVM -ResourceGroupName $rgname -Location $loc -VM $vm 

if I recreate the VM do I need to add new VM to domain controller or will it work normally?

Yes, the new create VM (restore) will add to the domain controller, we don't need to add the VM to domain controller again.



来源:https://stackoverflow.com/questions/43329137/attaching-restored-os-disk-to-existing-vm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!