How To Create A Disk Image

broken image


  1. How To Create A Disk Image
  2. How To Create A Disk Image In Linux
-->

A managed image resource can be created from a generalized virtual machine (VM) that is stored as either a managed disk or an unmanaged disk in a storage account. The image can then be used to create multiple VMs. For information on how managed images are billed, see Managed Disks pricing.

One managed image supports up to 20 simultaneous deployments. Attempting to create more than 20 VMs concurrently, from the same managed image, may result in provisioning timeouts due to the storage performance limitations of a single VHD. To create more than 20 VMs concurrently, use a Shared Image Galleries image configured with 1 replica for every 20 concurrent VM deployments.

Generalize the Windows VM using Sysprep

Ghost disk to image. It can help you create an image backup for your disk in only a few clicks with its disk backup feature. In addition, it not only supports ghosting a hard drive but also supports ghosting a particular partition like system drive or any other partition. In most cases the disk containing the partition mounted at / will be the source disk to image. We are going to use dd to create an image of /dev/vda. At this point, you should decide where you want to store the disk image. One option is to attach another block storage device, preferably as large as the disk you are going to image.

How

Sysprep removes all your personal account and security information, and then prepares the machine to be used as an image. For information about Sysprep, see Sysprep overview.

Make sure the server roles running on the machine are supported by Sysprep. For more information, see Sysprep support for server roles and Unsupported scenarios.

Important

After you have run Sysprep on a VM, that VM is considered generalized and cannot be restarted. The process of generalizing a VM is not reversible. If you need to keep the original VM functioning, you should create a copy of the VM and generalize its copy.

Sysprep requires the drives to be fully decrypted. If you have enabled encryption on your VM, disable encryption before you run Sysprep.

If you plan to run Sysprep before uploading your virtual hard disk (VHD) to Azure for the first time, make sure you have prepared your VM.

To generalize your Windows VM, follow these steps:

  1. Sign in to your Windows VM.

  2. Open a Command Prompt window as an administrator.

  3. Delete the panther directory (C:WindowsPanther). Then change the directory to %windir%system32sysprep, and then run sysprep.exe.

  4. In the System Preparation Tool dialog box, select Enter System Out-of-Box Experience (OOBE) and select the Generalize check box.

  5. For Shutdown Options, select Shutdown.

  6. Select OK.

  7. When Sysprep completes, it shuts down the VM. Do not restart the VM.

Tip

Optional Use DISM to optimize your image and reduce your VM's first boot time.

To optimize your image, mount your VHD by double-clicking on it in Windows explorer, and then run DISM with the /optimize-image parameter.

Where D: is the mounted VHD's path.

Running DISM /optimize-image should be the last modification you make to your VHD. If you make any changes to your VHD prior to deployment, you'll have to run DISM /optimize-image again.

Create a managed image in the portal

  1. Go to the Azure portal to manage the VM image. Search for and select Virtual machines.

  2. Select your VM from the list.

  3. In the Virtual machine page for the VM, on the upper menu, select Capture.

    The Create image page appears.

  4. For Name, either accept the pre-populated name or enter a name that you would like to use for the image.

  5. How to use snapchat on desktop. For Resource group, either select Create new and enter a name, or select a resource group to use from the drop-down list.

  6. If you want to delete the source VM after the image has been created, select Automatically delete this virtual machine after creating the image.

  7. If you want the ability to use the image in any availability zone, select On for Zone resiliency.

  8. Select Create to create the image.

How To Create A Disk Image

After the image is created, you can find it as an Image resource in the list of resources in the resource group.

Create an image of a VM using PowerShell

Creating an image directly from the VM ensures that the image includes all of the disks associated with the VM, including the OS disk and any data disks. This example shows how to create a managed image from a VM that uses managed disks.

Before you begin, make sure that you have the latest version of the Azure PowerShell module. To find the version, run Get-Module -ListAvailable Az in PowerShell. If you need to upgrade, see Install Azure PowerShell on Windows with PowerShellGet. If you are running PowerShell locally, run Connect-AzAccount to create a connection with Azure. How to use your android phone on pc.

Note

If you would like to store your image in zone-redundant storage, you need to create it in a region that supports availability zones and include the -ZoneResilient parameter in the image configuration (New-AzImageConfig command).

To create a VM image, follow these steps:

  1. Create some variables.

  2. Make sure the VM has been deallocated.

  3. Set the status of the virtual machine to Generalized.

  4. Get the virtual machine.

  5. Create the image configuration.

  6. Create the image.

Create an image from a managed disk using PowerShell

If you want to create an image of only the OS disk, specify the managed disk ID as the OS disk:

  1. Create some variables.

  2. Get the VM.

  3. Get the ID of the managed disk.

  4. Create the image configuration.

  5. Create the image.

Create an image from a snapshot using PowerShell

You can create a managed image from a snapshot of a generalized VM by following these steps:

  1. Create some variables.

  2. Get the snapshot.

  3. Create the image configuration.

  4. Create the image.

Create an image from a VM that uses a storage account

To create a managed image from a VM that doesn't use managed disks, you need the URI of the OS VHD in the storage account, in the following format: https://mystorageaccount.blob.core.windows.net/vhdcontainer/vhdfilename.vhd. In this example, the VHD is in mystorageaccount, in a container named vhdcontainer, and the VHD filename is vhdfilename.vhd.

  1. Create some variables.

  2. Stop/deallocate the VM.

  3. Mark the VM as generalized.

  4. Create the image by using your generalized OS VHD.

Next steps

How To Create A Disk Image In Linux

  • Create a VM from a managed image.




broken image