question

ESKENSReitse-5651 avatar image
0 Votes"
ESKENSReitse-5651 asked ·

Creating a custom image skips the extra attached disk

I've created a VM in a DevTest lab. This VM has it's main OS disk and a second data disk attached.

When i'm creating a custom image, all is well. But when i create a new VM based on the custom image, the extra attached disk isn't created for the new VM's. In our case the new VM's are less usefull because the extra disk is needed.

How can we create a custom image that in some way contains the extra attached disk?

azure-devtestlabs
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

kobulloc-MSFT avatar image
0 Votes"
kobulloc-MSFT answered ·

How are you creating your custom images? If you create a custom image from a VM, the custom image will include the OS disk and all the data disks attached to the virtual machine.


https://docs.microsoft.com/en-us/azure/lab-services/devtest-lab-create-custom-image-from-vm-using-portal

Step 7
"On the Custom image pane, enter a name and description for your custom image. This information is displayed in the list of bases when you create a VM. The custom image will include the OS disk and all the data disks attached to the virtual machine."

Additionally, you can add a data disk to a virtual machine:

https://azure.microsoft.com/en-us/updates/azure-devtest-labs-attach-additional-data-disk-to-your-lab-vm/

https://docs.microsoft.com/en-us/rest/api/dtl/virtualmachines/adddatadisk


· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ESKENSReitse-5651 avatar image
0 Votes"
ESKENSReitse-5651 answered ·

Hi @kobulloc-MSFT thanks for reaching out.

As that is the only way to create a custom image, that is the procedure we follow.

Tested today if it makes a difference to make the image whilst the VM is running or not.

No difference at all. In both cases no data disk (and therefore a VM that's unusable).

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ESKENSReitse-5651 avatar image
0 Votes"
ESKENSReitse-5651 answered ·

Addition. I've created a custom image with the option "I have run sysprep on the virtual machine." set to On.
This results in the following message: The custom image will include the OS disk and all the data disks attached to the virtual machine.

Thing is, as far as i know, i haven't run anything resembling sysprep on the machine. In the end, when i deploy a new vm based on this ci, i get the following error:

OS Provisioning for VM 'reitseeskens002' did not finish in the allotted time. However, the VM guest agent was detected running. This suggests the guest OS has not been properly prepared to be used as a VM image (with CreateOption=FromImage). To resolve this issue, either use the VHD as is with CreateOption=Attach or prepare it properly for use as an image:

So i'm still left with a useless VM i think or at least one that's not trusted at first sight.

· Share
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.