Skip to content

Commit 0a7d4ea

Browse files
committed
Merge branch 'patch-5' of https://github.com/srijang/azure-docs-pr into 219358
2 parents a16624c + fc19c43 commit 0a7d4ea

File tree

1 file changed

+75
-10
lines changed

1 file changed

+75
-10
lines changed

articles/virtual-machines/linux/create-upload-generic.md

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: srijang
55
ms.service: virtual-machines
66
ms.collection: linux
77
ms.topic: how-to
8-
ms.date: 05/13/2022
8+
ms.date: 11/22/2022
99
ms.author: srijangupta
1010
ms.reviewer: mattmcinnes
1111
---
@@ -27,18 +27,27 @@ This article focuses on general guidance for running your Linux distribution on
2727

2828
2. Azure supports Gen1 (BIOS boot) & Gen2 (UEFI boot) Virtual machines.
2929

30-
3. The maximum size allowed for the VHD is 1,023 GB.
30+
3. The vfat kernel module must be enabled in the kernel
3131

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.
3333

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.
3535

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.
3837

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
4251
4352

4453

@@ -191,6 +200,10 @@ The [Azure Linux Agent](../extensions/agent-linux.md) `waagent` provisions a Lin
191200
1. Install the Azure Linux Agent.
192201
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).
193202

203+
> [!NOTE]
204+
> Make sure **'udf'** and **'vfat'** modules are enable. Blacklisting or removing the udf module will cause a provisioning failure. Blacklisting 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)**
205+
206+
194207
Install the Azure Linux Agent, cloud-init and other necessary utilities by running the following command:
195208

196209
**Redhat/Centos**
@@ -212,7 +225,59 @@ The [Azure Linux Agent](../extensions/agent-linux.md) `waagent` provisions a Lin
212225
```
213226

214227

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.
228+
1. 7. Swap: Do not create swap space on the OS disk.
229+
230+
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.
231+
232+
Azure Linux Agent
233+
Modify the following parameters in /etc/waagent.conf
234+
```
235+
ResourceDisk.Format=y
236+
ResourceDisk.Filesystem=ext4
237+
ResourceDisk.MountPoint=/mnt/resource
238+
ResourceDisk.EnableSwap=y
239+
ResourceDisk.SwapSizeMB=2048 ## NOTE: Set this to your desired size.
240+
```
241+
242+
Cloud-init
243+
Configure cloud-init to handle the provisioning:
244+
245+
```bash
246+
sed -i 's/Provisioning.Agent=auto/Provisioning.Agent=cloud-auto/g' /etc/waagent.conf
247+
sed -i 's/ResourceDisk.Format=y/ResourceDisk.Format=n/g' /etc/waagent.conf
248+
sed -i 's/ResourceDisk.EnableSwap=y/ResourceDisk.EnableSwap=n/g' /etc/waagent.conf
249+
```
250+
Configure Cloud-init to create swap
251+
To format and create swap you have 2 options either:
252+
253+
1. Pass this in as a cloud-init config every time you create a VM through `customdata`. This is the recommended method.
254+
255+
2. Use a cloud-init directive baked into the image that will do this every time the VM is created.
256+
257+
Create cfg file to configure swap using Cloud-init:
258+
```
259+
echo 'DefaultEnvironment="CLOUD_CFG=/etc/cloud/cloud.cfg.d/00-azure-swap.cfg"' >> /etc/systemd/system.conf
260+
cat > /etc/cloud/cloud.cfg.d/00-azure-swap.cfg << EOF
261+
#cloud-config
262+
# Generated by Azure cloud image build
263+
disk_setup:
264+
ephemeral0:
265+
table_type: mbr
266+
layout: [66, [33, 82]]
267+
overwrite: True
268+
fs_setup:
269+
- device: ephemeral0.1
270+
filesystem: ext4
271+
- device: ephemeral0.2
272+
filesystem: swap
273+
mounts:
274+
- ["ephemeral0.1", "/mnt"]
275+
- ["ephemeral0.2", "none", "swap", "sw,nofail,x-systemd.requires=cloud-init.service,x-systemd.device-timeout=2", "0", "0"]
276+
EOF
277+
```
278+
```
279+
280+
2. 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.
216281
```
217282
ResourceDisk.Format=y
218283
ResourceDisk.Filesystem=ext4

0 commit comments

Comments
 (0)