1

I am trying to duplicate a Linux virtual machine I have in Azure (Not Classic VM).

I went through the following documentation: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/capture-image

However, I am still not sure about the Deprovision part. I know I will not be able to access to the old VM while deploying the new image of the current VM. The question is, will I be able to access to the old VM after the deployment and will the files and data will be deleted on the old VM? if so how can I create a new image without deleting the files and data on old VM?

1
  • By default, after we capture this VM, this process deletes the original virtual machine after it's captured. we can't access to the old VM, prepare will not delete files and data from the image.
    – Jason Ye
    Aug 11, 2017 at 1:01

2 Answers 2

0

will I be able to access to the old VM after the deployment and will the files and data will be deleted on the old VM?

After the deployment completed, we can't login to this VM. we can use this image to create new VMs. The files and data will not be delete. After we create new VM, we can find files and data in it.

if so how can I create a new image without deleting the files and data on old VM?

If you want to create a new image and want to keep this VM, we should backup this VM's VHD (copy and save this VHD with a different name). After we create the new image, we use the copy VHD to create a VM, in this way, we can login the original VM.

About create Azure VM with existing VHD and existing Vnet, we can use this template to create it.

3
  • Can I create the new Azure VM with existing VHD directly through Azure GUI? or only I need to use the mentioned template for this? Aug 11, 2017 at 21:08
  • for now,we can not use azure portal to create vm by vhd,we should use powershell or template do it.
    – Jason Ye
    Aug 11, 2017 at 21:17
  • Please feel free to let me know if you need further assistance, also if it helpful, please don't forget to accept it as an answer, thanks:)
    – Jason Ye
    Aug 15, 2017 at 1:22
0

You can do following:

Copy a disk Create a snapshot and then create a disk from the snapshot. This strategy allows you to keep the original VHD as a fallback:

From the Azure portal, on the left menu, select All services. In the All services search box, enter disks and then select Disks to display the list of available disks. Select the disk that you would like to use. The Disk page for that disk appears. From the menu at the top, select Create snapshot. Enter a Name for the snapshot. Choose a Resource group for the snapshot. You can use either an existing resource group or create a new one. For Account type, choose either Standard (HDD) or Premium (SSD) storage. When you're done, select Create to create the snapshot. After the snapshot has been created, select Create a resource in the left menu. In the search box, enter managed disk and then select Managed Disks from the list. On the Managed Disks page, select Create. Enter a Name for the disk. Choose a Resource group for the disk. You can use either an existing resource group or create a new one. This selection will also be used as the resource group where you create the VM from the disk. For Account type, choose either Standard (HDD) or Premium (SSD) storage. In Source type, ensure Snapshot is selected. In the Source snapshot drop-down, select the snapshot you want to use. Make any other adjustments as needed and then select Create to create the disk. Create a VM from a disk After you have the managed disk VHD that you want to use, you can create the VM in the portal:

From the Azure portal, on the left menu, select All services. In the All services search box, enter disks and then select Disks to display the list of available disks. Select the disk that you would like to use. The Disk page for that disk opens. In the Overview page, ensure that DISK STATE is listed as Unattached. If it isn't, you might need to either detach the disk from the VM or delete the VM to free up the disk. In the menu at the top of the page, select Create VM. On the Basics page for the new VM, enter a Virtual machine name and either select an existing Resource group or create a new one. For Size, select Change size to access the Size page. Select a VM size row and then choose Select. On the Networking page, you can either let the portal create all new resources or you can select an existing Virtual network and Network security group. The portal always creates a new network interface and public IP address for the new VM. On the Management page, make any changes to the monitoring options. On the Guest config page, add any extensions as needed. When you're done, select Review + create. If the VM configuration passes validation, select Create to start the deployment.

Reference:- https://docs.microsoft.com/en-us/azure/virtual-machines/windows/create-vm-specialized-portal#copy-a-disk

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .