Skip to content
Advertisement

Can’t create image of linux vm in azure – generalizing erases my work

I’m obviously missing something VERY basic in my logic. Can someone help. My problem:

  1. I create a Linux VM in Azure through the Azure CLI.
  2. I ssh in, and provision my VM with the packages/programs I want (i.e. downloading Anaconda, Keras, etc.)
  3. PROBLEM – When I follow steps to capture an image (AZ_cli_makeImage_link), ALL my work is erased when I “generalize” the VM because the home directory is erased. This happens even when I mkdir a separate directory and install there.

How do I provision my Linux VM in a way that will be capture the changes I’ve made when the VM is “generalized”. Thank you!

Advertisement

Answer

The problem as you said that the deprovision will erase the user home directory to generalize the image for everyone, without user information except the root. So all the things you stored in the user home directory will disappear if you generalize the image.

enter image description here

The generalization means no user information and you can not change the steps in Azure that generalization would do as I know.

But you can create a specialized image and it will not delete the user information. So you can store your files or install packages in the user home directory and won’t disappear. Or just execute the command waagent -deprovision to generalize the image.

The steps that you can just deallocate the VM and copy OS disk from the VM. Then create a new VM and attach the disk. But there is a problem, the image has the user information left. So you should pay attention to this point when you create the new VM. See another problem How to capture a special image from the VM.

But I suggest you’d better create a generalized image without installing the packages in the user home directory. It’s more security and will not problems generally.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement