Skip to content

Commit 8658fab

Browse files
authored
Merge pull request #122120 from mries/patch-12
Update debian-create-upload-vhd.md
2 parents 07f0bc5 + 102b610 commit 8658fab

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

articles/virtual-machines/linux/debian-create-upload-vhd.md

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ ms.service: virtual-machines
66
ms.custom: linux-related-content
77
ms.collection: linux
88
ms.topic: how-to
9-
ms.date: 11/10/2021
10-
ms.author: srijangupta
9+
ms.date: 05/01/2024
10+
ms.author: maries
1111
ms.reviewer: mattmcinnes
1212
---
1313
# Prepare a Debian VHD for Azure
@@ -24,23 +24,6 @@ This section assumes that you have already installed a Debian Linux operating sy
2424
* Do not configure a swap partition on the OS disk. The Azure Linux agent can be configured to create a swap file on the temporary resource disk. More information can be found in the steps below.
2525
* All VHDs on Azure must have a virtual size aligned to 1MB. When converting from a raw disk to VHD, you must ensure that the raw disk size is a multiple of 1MB before conversion. For more information, see [Linux Installation Notes](create-upload-generic.md#general-linux-installation-notes).
2626

27-
## Use Azure-Manage to create Debian VHDs
28-
There are tools available for generating Debian VHDs for Azure, such as the [azure-manage](https://github.com/credativ/azure-manage) scripts from [Instaclustr](https://www.instaclustr.com/). This is the recommended approach versus creating an image from scratch. For example, to create a Debian 8 VHD run the following commands to download the `azure-manage` utility (and dependencies) and run the `azure_build_image` script:
29-
30-
```console
31-
# sudo apt-get update
32-
# sudo apt-get install git qemu-utils mbr kpartx debootstrap
33-
34-
# sudo apt-get install python3-pip python3-dateutil python3-cryptography
35-
# sudo pip3 install azure-storage azure-servicemanagement-legacy azure-common pytest pyyaml
36-
# git clone https://github.com/credativ/azure-manage.git
37-
# cd azure-manage
38-
# sudo pip3 install .
39-
40-
# sudo azure_build_image --option release=jessie --option image_size_gb=30 --option image_prefix=debian-jessie-azure section
41-
```
42-
43-
4427
## Prepare a Debian image for Azure
4528

4629
You can create the base Azure Debian Cloud image with the [FAI cloud image builder](https://salsa.debian.org/cloud-team/debian-cloud-images).
@@ -74,20 +57,20 @@ $ sudo chmod 755 ./config_space/scripts/AZURE/10-custom
7457
Note that it is important to prefix any commands you want to have customizing the image with `$ROOTCMD` as this is aliased as `chroot $target`.
7558

7659

77-
## Build the Azure Debian 10 image:
60+
## Build the Azure Debian image:
7861

7962
```
80-
$ make image_buster_azure_amd64
63+
$ make image_[release]_azure_amd64
8164
```
8265

8366

84-
This will output a handful of files in the current directory, most notably the `image_buster_azure_amd64.raw` image file.
67+
This will output a handful of files in the current directory, most notably the `image_[release]_azure_amd64.raw` image file.
8568

8669
To convert the raw image to VHD for Azure, you can do the following:
8770

8871
```
89-
rawdisk="image_buster_azure_amd64.raw"
90-
vhddisk="image_buster_azure_amd64.vhd"
72+
rawdisk="image_[release]_azure_amd64.raw"
73+
vhddisk="image_[release]_azure_amd64.vhd"
9174
9275
MB=$((1024*1024))
9376
size=$(qemu-img info -f raw --output json "$rawdisk" | \
@@ -103,10 +86,20 @@ qemu-img convert -f raw -o subformat=fixed,force_size -O vpc "$rawdisk" "$vhddis
10386
```
10487

10588

106-
This creates a VHD `image_buster_azure_amd64.vhd` with a rounded size to be able to copy it successfully to an Azure Disk.
89+
This creates a VHD `image_[release]_azure_amd64.vhd` with a rounded size to be able to copy it successfully to an Azure Disk.
90+
91+
>[!Note]
92+
> Rather than cloning the salsa repository and building images locally, current stable images can be built and downloaded from [FAI](https://fai-project.org/FAIme/cloud/).
93+
94+
After creating a stable Debian vhd image, before uploading verify the following packages are installed:
95+
* apt-get install hyperv-daemons
96+
* apt-get install waagent # *optional but recommended for password resets and the use of extensions*
97+
* apt-get install cloud-init
10798

108-
Now we need to create the Azure resources for this image (this uses the `$rounded_size_adjusted` variable, so it should be from within the same shell process from above).
99+
Then perform a full upgrade:
100+
* apt-get full-upgrade
109101

102+
Now the Azure resources must be created for this image (this uses the `$rounded_size_adjusted` variable, so it should be from within the same shell process from above).
110103
```
111104
az group create -l $LOCATION -n $RG
112105
@@ -149,7 +142,7 @@ az vm create \
149142
>[!Note]
150143
> If the bandwidth from your local machine to the Azure Disk is causing a long time to process the upload with azcopy, you can use an Azure VM jumpbox to speed up the process. Here's how this can be done:
151144
>
152-
>1. Create a tarball of the VHD on your local machine: `tar -czvf ./image_buster_azure_amd64.vhd.tar.gz ./image_buster_azure_amd64.vhd`.
145+
>1. Create a tarball of the VHD on your local machine: `tar -czvf ./image_buster_azure_amd64.vhd.tar.gz ./image_[release]_azure_amd64.vhd`.
153146
>2. Create an Azure Linux VM (distro of your choice). Make sure that you create it with a large enough disk to hold the extracted VHD!
154147
>3. Download the azcopy utility to the Azure Linux VM. It can be retrieved from [here](../../storage/common/storage-use-azcopy-v10.md#download-azcopy).
155148
>4. Copy the tarball to the VM: `scp ./image_buster_azure_amd64.vhd.tar.gz <vm>:~`.

0 commit comments

Comments
 (0)