You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
3. The maximum size allowed for the VHD is 1,023 GB.
30
+
3. The vfat kernel module must be enabled in the kernel
31
31
32
-
4.When installing the Linux system we recommend that you use standard partitions, rather than Logical Volume Manager (LVM) which is the default for many installations. Using standard partitions will avoid LVM name conflicts with cloned VMs, particularly if an OS disk is ever attached to another identical VM for troubleshooting. [LVM](/previous-versions/azure/virtual-machines/linux/configure-lvm) or [RAID](/previous-versions/azure/virtual-machines/linux/configure-raid) may be used on data disks.
32
+
4.The maximum size allowed for the VHD is 1,023 GB.
33
33
34
-
5.Kernel support for mounting UDF file systems is necessary. At first boot on Azure the provisioning configuration is passed to the Linux VM by using UDF-formatted media that is attached to the guest. The Azure Linux agent must mount the UDF file system to read its configuration and provision the VM.
34
+
5.When installing the Linux system we recommend that you use standard partitions, rather than Logical Volume Manager (LVM) which is the default for many installations. Using standard partitions will avoid LVM name conflicts with cloned VMs, particularly if an OS disk is ever attached to another identical VM for troubleshooting. [LVM](/previous-versions/azure/virtual-machines/linux/configure-lvm) or [RAID](/previous-versions/azure/virtual-machines/linux/configure-raid) may be used on data disks.
35
35
36
-
6. Linux kernel versions earlier than 2.6.37 don't support NUMA on Hyper-V with larger VM sizes. This issue primarily impacts older distributions using the upstream Red Hat 2.6.32 kernel, and was fixed in Red Hat Enterprise Linux (RHEL) 6.6 (kernel-2.6.32-504). Systems running custom kernels older than 2.6.37, or RHEL-based kernels older than 2.6.32-504 must set the boot parameter `numa=off` on the kernel command line in grub.conf. For more information, see [Red Hat KB 436883](https://access.redhat.com/solutions/436883).
37
-
7. Don't configure a swap partition on the OS disk. The Linux agent can be configured to create a swap file on the temporary resource disk, as described in the following steps.
36
+
6. Kernel support for mounting UDF file systems is necessary. At first boot on Azure the provisioning configuration is passed to the Linux VM by using UDF-formatted media that is attached to the guest. The Azure Linux agent must mount the UDF file system to read its configuration and provision the VM.
38
37
39
-
8. All VHDs on Azure must have a virtual size aligned to 1 MB (1024 × 1024 bytes). When converting from a raw disk to VHD you must ensure that the raw disk size is a multiple of 1 MB before conversion, as described in the following steps.
40
-
9. Use the most up-to-date distribution version, packages, and software.
41
-
8. Remove users and system accounts, public keys, sensitive data, unnecessary software and application.
38
+
7. Linux kernel versions earlier than 2.6.37 don't support NUMA on Hyper-V with larger VM sizes. This issue primarily impacts older distributions using the upstream Red Hat 2.6.32 kernel, and was fixed in Red Hat Enterprise Linux (RHEL) 6.6 (kernel-2.6.32-504). Systems running custom kernels older than 2.6.37, or RHEL-based kernels older than 2.6.32-504 must set the boot parameter `numa=off` on the kernel command line in grub.conf. For more information, see [Red Hat KB 436883](https://access.redhat.com/solutions/436883).
39
+
40
+
8. Don't configure a swap partition on the OS disk. The Linux agent can be configured to create a swap file on the temporary resource disk, as described in the following steps.
41
+
42
+
10. All VHDs on Azure must have a virtual size aligned to 1 MB (1024 × 1024 bytes). When converting from a raw disk to VHD you must ensure that the raw disk size is a multiple of 1 MB before conversion, as described in the following steps.
43
+
44
+
11. Use the most up-to-date distribution version, packages, and software.
45
+
46
+
12. Remove users and system accounts, public keys, sensitive data, unnecessary software and application.
47
+
48
+
49
+
> [!NOTE]
50
+
> **(_Cloud-init >= 21.2 removes the udf requirement._)** however without the udf module enabled the cdrom will not mount during provisioning preventing custom data from being applied. A workaround for this would be to apply custom data using user data however, unlike custom data user data is not encrypted. https://cloudinit.readthedocs.io/en/latest/topics/format.html
42
51
43
52
44
53
@@ -62,7 +71,7 @@ The mechanism for rebuilding the initrd or initramfs image may vary depending on
62
71
63
72
### Resizing VHDs
64
73
VHD images on Azure must have a virtual size aligned to 1 MB. Typically, VHDs created using Hyper-V are aligned correctly. If the VHD isn't aligned correctly, you may receive an error message similar to the following when you try to create an image from your VHD.
65
-
```outout
74
+
```output
66
75
The VHD http:\//\<mystorageaccount>.blob.core.windows.net/vhds/MyLinuxVM.vhd has an unsupported virtual size of 21475270656 bytes. The size must be a whole number (in MBs).
67
76
```
68
77
In this case, resize the VM using either the Hyper-V Manager console or the [Resize-VHD](/powershell/module/hyper-v/resize-vhd) PowerShell cmdlet. If you aren't running in a Windows environment, we recommend using `qemu-img` to convert (if needed) and resize the VHD.
@@ -171,8 +180,10 @@ The [Azure Linux Agent](../extensions/agent-linux.md) `waagent` provisions a Lin
171
180
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
172
181
```
173
182
1. Add Hyper-V modules both initrd and initramfs instructions (Dracut).
174
-
1. Rebuild initrd or initramfs
183
+
1. Rebuild `initrd` or `initramfs`.
184
+
175
185
**Initramfs**
186
+
176
187
```bash
177
188
cp /boot/initramfs-$(uname -r).img /boot/initramfs-[latest kernel version ].img.bak
178
189
dracut -f -v /boot/initramfs-[latest kernel version ].img [depending on the version of grub]
@@ -181,16 +192,22 @@ The [Azure Linux Agent](../extensions/agent-linux.md) `waagent` provisions a Lin
1. Ensure that the SSH server is installed, and configured to start at boot time. This configuration is usually the default.
203
+
191
204
1. Install the Azure Linux Agent.
192
205
The Azure Linux Agent is required for provisioning a Linux image on Azure. Many distributions provide the agent as an RPM or .deb package (the package is typically called WALinuxAgent or walinuxagent). The agent can also be installed manually by following the steps in the [Linux Agent Guide](../extensions/agent-linux.md).
193
206
207
+
> [!NOTE]
208
+
> Make sure 'udf' and 'vfat' modules are enable. Blocklisting or removing the udf module will cause a provisioning failure. Blocklisting or removing vfat module will cause both provisioning and boot failures. **(_Cloud-init >= 21.2 removes the udf requirement. Please read top of document for more detail)**
209
+
210
+
194
211
Install the Azure Linux Agent, cloud-init and other necessary utilities by running the following command:
195
212
196
213
**Redhat/Centos**
@@ -211,15 +228,61 @@ The [Azure Linux Agent](../extensions/agent-linux.md) `waagent` provisions a Lin
211
228
sudo systemctl enable cloud-init.service
212
229
```
213
230
231
+
1. Swap: Do not create swap space on the OS disk.
232
+
233
+
The Azure Linux Agent or Cloud-init can be used to configure swap space using the local resource disk. This resource disk is attached to the VM after provisioning on Azure. The local resource disk is a temporary disk, and might be emptied when the VM is deprovisioned. The following blocks show how to configure this swap.
234
+
235
+
Azure Linux Agent
236
+
Modify the following parameters in /etc/waagent.conf
237
+
238
+
```
239
+
ResourceDisk.Format=y
240
+
ResourceDisk.Filesystem=ext4
241
+
ResourceDisk.MountPoint=/mnt/resource
242
+
ResourceDisk.EnableSwap=y
243
+
ResourceDisk.SwapSizeMB=2048 ## NOTE: Set this to your desired size.
244
+
```
245
+
246
+
Cloud-init
247
+
Configure cloud-init to handle the provisioning:
248
+
249
+
```bash
250
+
sed -i 's/Provisioning.Agent=auto/Provisioning.Agent=cloud-auto/g' /etc/waagent.conf
251
+
sed -i 's/ResourceDisk.Format=y/ResourceDisk.Format=n/g' /etc/waagent.conf
252
+
sed -i 's/ResourceDisk.EnableSwap=y/ResourceDisk.EnableSwap=n/g' /etc/waagent.conf
253
+
```
254
+
255
+
Configure Cloud-init to create swap.
256
+
257
+
To format and create swap you have 2 options either:
258
+
259
+
1. Pass this in as a cloud-init config every time you create a VM through `customdata`. This is the recommended method.
260
+
261
+
2. Use a cloud-init directive baked into the image that will do this every time the VM is created.
262
+
263
+
Create cfg file to configure swap using Cloud-init:
214
264
215
-
1. Don't create swap space on the OS disk. The Azure Linux Agent can automatically configure swap space using the local resource disk that is attached to the VM after provisioning on Azure. The local resource disk is a temporary disk, and might be emptied when the VM is deprovisioned. After installing the Azure Linux Agent, modify the following parameters in /etc/waagent.conf as needed.
216
265
```
217
-
ResourceDisk.Format=y
218
-
ResourceDisk.Filesystem=ext4
219
-
ResourceDisk.MountPoint=/mnt/resource
220
-
ResourceDisk.EnableSwap=y
221
-
ResourceDisk.SwapSizeMB=2048 ## NOTE: Set this to your desired size.
9. Configure cloud-init to handle the provisioning:
225
288
1. Configure waagent for cloud-init:
@@ -266,37 +329,6 @@ The [Azure Linux Agent](../extensions/agent-linux.md) `waagent` provisions a Lin
266
329
EOF
267
330
```
268
331
269
-
10. Swap configuration. Do not create swap space on the operating system disk.
270
-
Previously, the Azure Linux Agent automatically configured swap space by using the local resource disk that is attached to the virtual machine after the virtual machine is provisioned on Azure. However, this is now handled by cloud-init, you must not use the Linux Agent to format the resource disk create the swap file, modify the following parameters in /etc/waagent.conf appropriately:
271
-
```
272
-
ResourceDisk.Format=n
273
-
ResourceDisk.EnableSwap=n
274
-
```
275
-
If you want to mount, format and create swap you can either:
276
-
1. Pass this in as a cloud-init config every time you create a VM through `customdata`. This is the recommended method.
277
-
2. Use a cloud-init directive baked into the image that will do this every time the VM is created.
0 commit comments