UN-generalize a VM
Seems like the process of generalizing a VM is irreversible. Shouldn't there be a way to undo it?
sysprep is irreversible by design:
If you intend to transfer a Windows image to a different computer, you must run sysprep /generalize, even if the computer has the same hardware configuration. The sysprep /generalize command removes unique information from your Windows installation, which enables you to reuse that image on different computers.
In Azure, this is accomplished by not only sealing your image, but also telling the platform that a generalized image is being captured.
The problem is that I have generalized a VM on Azure to create an image from it, and then I cannot start again the original machine.
Again, this is by design. If you're going to go back and make changes to the original source, you'll need to copy it off/snapshot it/etc. prior to sealing it with sysprep.
Actually if the VM is not hosted on Azure, after using sysprer you can start it and use it again. The problem lies on Azure, where it does not let you to start it from its stopped (deallocated) state.
You can start it again as well. You just have to start by spinning up a new VM based on your generalized image.
I know that I can make copies. What I am suggesting here is to make it possible to start / wake up the original VM from its stopped state. This action seems to be irreversible and I believe there should be a way to Redeploy (command -Redeploy does not work at this case).
Set-AzureRmVm -ResourceGroupName YourResourceGroup -Name YourWindowsVM -Generalized
following the process from here
@olgamatoula When you run sysprep on the VM, it resets the VM back to original state and probably also removes the files needed for provisioning the VM successfully on Azure which is why it doesn't boot back up. I wasn't aware that you can boot the VM back up. Do you have a link to documentation that says it should start back up?
You cannot boot the VM back up, you can delete it and create another one using its resources (disk, nic, etc) via powershell like ciphertxt said. Something like:
$rgName = "yourresourcegroup" $location = "yourzone" $vmName = "youazurevmname" $computerName = "youroldhostname" $vnetName = "yourazurevirtualnetwork" $nicname = "youoldnicname" $storageAcc = "yourstorageaccount" $osDiskName = "yournewdiskname" # need to be different than the old one I think $osDiskUri = "yourolddiskurl"
$vnet = Get-AzureRmVirtualNetwork -Name NewTech -ResourceGroupName NewTech $nic = Get-AzureRmNetworkInterface -Name $nicname -ResourceGroupName $rgName $cred = Get-Credential $storageAcc = Get-AzureRmStorageAccount -ResourceGroupName $rgName -AccountName $storageAcc $vm = New-AzureRmVMConfig -VMName $vmName -VMSize "yourdesiredvmsize" $vm = Add-AzureRmVMNetworkInterface -VM $vm -Id $nic.Id $osDiskUri = '{0}vhds/{1}{2}.vhd' -f $storageAcc.PrimaryEndpoints.Blob.ToString(), $computerName.ToLower(), $osDiskName $vm = Set-AzureRmVMOSDisk -VM $vm -Name $osDiskName -VhdUri $osDiskUri -CreateOption Attach -Windows New-AzureRmVM -ResourceGroupName $rgName -Location $location -VM $vm
Closing as this not possible due to the way sysprep works.
Atleast pop a Warning message letting the user know marking a VM Generalized is irreversible.
@gbehera-rvbd That will not help as you are already past the point of no return when you sysprepped the VM from within the guest. The only way forward is to capture the image and use it to create a new VM.
Hello everyone,
Im having some problem abount create VM from captured image
I can't create VM more than 1 on same captured image
It always alert: "error: Long running operation failed with error: 'Blob https://ubuntuimgdisks276.blob.core.windows.net/vmcontainerc92766df-a015-4e8b-8bb1-1f421bb5ddfb/osDisk.c92766df-a015-4e8b-8bb1-1f421bb5ddfb.vhd already exists. Please provide a different blob URI as target for disk 'cli3962696bd6c25ee8-os-1479111654718'.'."
How can i resolve this issue?
I take a lot of days but no finding anyway, Im newbie Azure
Please help Thanks so much
An,
@nda888 Seems like the error is pretty clear. Try using a different blob name
'Blob https://ubuntuimgdisks276.blob.core.windows.net/vmcontainerc92766df-a015-4e8b-8bb1-1f421bb5ddfb/osDisk.c92766df-a015-4e8b-8bb1-1f421bb5ddfb.vhd already exists
Thanks for your reply
But how can i create another blob name?
I don't know too much abount Azure
May you help?
@nda888 How are you trying to create the other VM?
I followed this guide to create VM from captured image https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-capture-image/
This is really crazy.
If the process of generalizing a vm is irreversible, then why isn't there any note on the tutorial that you have in the official docs https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-capture-image. I had to come into this issue to find out that it's irreversible.
The user following these tutorials might not be aware of each and every terminologies you've used.
Plus even when one tries to know what the generalize and deallocate commands actually do reading the docs, all they have in the docs is the information about how to use this command in the CLI i.e just the syntax. But not exactly what this really means, let alone the fact that it's irreversible.
And even if I do a google search the only results I could find was about the same tutorial I've followed, but not any docs that actually explains me what these things are https://www.google.com.np/search?espv=2&q=azure+docs+vm+generalize&oq=azure+docs+vm+generalize&gs_l=serp.3...40835.41418.0.41935.5.5.0.0.0.0.168.323.0j2.2.0....0...1.1.64.serp..3.0.0.fW8LVO3AA9c.
This is really a pain in ass. All I wanted to do was create a new VM from the existing VM that I created recently but there aren't enough tutorials or docs to explain or help me understand how things are done.
From my personal experience these things were really easy to do in AWS. It could be easily done even using AWS console GUI. And even for beginners things are well explained in the docs and tutorial, which I find really lacking in azure community.
Well, "generalize" is not an Azure-specific term, Microsoft always referred to Sysprep as the method to "generalize" a VM. The term itself is a bit of self-explanatory - you're making something that used to be specific into something general, generic.
Recreating the VM using the option -CreateOption Attach on the OS disk should fix this if you didn't run sysprep on the OS.
If you want to create a VM based on an existing one you just have to get its ARM template and use different parameters (admin, password, vm name, etc). That's one of the reasons to use ARM templates, you can deploy similar stuff in minutes over and over again.
Hope that helps.
it's not crazy, it's a big f*** up.
Same problem here, generalized a VM and unknowingly lost stuff stored on it in my /home/ folder. No warning telling me this was explicitly displayed on the Azure documentation : https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image