Azure Disk Encryption /boot partition too small

Bartosz Suchorowski 36 Reputation points
2022-01-14T09:50:15.787+00:00

Hi,

We have enabled ADE (both OS and data disks) on our Ubuntu 20.04 Virtual Machines. After a few months we noticed that our VMs started crashing due to lack of space on /boot partition. On standard VM /boot directory is under root filesystem (30GB) and problem does not occur. However, in this case a separate,small (256MB), uncencrypted filesystem of is created. All our VMs have Update Management enabled and it seems that after a few kernel releases 256MB is too less space to store them. Automremoval of kernels assumes that it should store up to 4 kernels but it does not take into consideration manually installed kernels (apt-mark showmanual shows that initial kernel is manually installed) so in real life it is up to 5 kernels.

165115-image.png
165132-image.png

In attached imaged: 3 kernels installed, 2 protected by autoremoval + 1 manually installed (initial) and 93% space taken

In general:
0-3 kernels - works fine
4 kernels - not sure, border case - almost out of space
5 kernels - out of space issues

1) How can we keep the number of kernels low? Does it normal situation when initial kernel is not autoremoved due to manual installation flag?
2) Is there a way to extend /boot partition to 512MB in ADE? dm_crypt allows having a bigger /boot partition but it is fully managed by Azure in this case.

Regards

Azure Disk Encryption
Azure Disk Encryption
An Azure service for virtual machines (VMs) that helps address organizational security and compliance requirements by encrypting the VM boot and data disks with keys and policies that are controlled in Azure Key Vault.
174 questions
0 comments No comments
{count} votes

Accepted answer
  1. deherman-MSFT 37,081 Reputation points Microsoft Employee
    2022-01-14T20:21:39.727+00:00

    @Bartosz Suchorowski
    Ubuntu does not make it easy to select the number of kernels to have installed. Here is a thread where users were able to remove the older kernels. This thread has users changing the number of kernels to keep automatically and is something you can try.

    Unfortunately resizing of an ADE OS/boot partition is not something that is currently supported. My suggestion would be to migrate to new disks with a larger partition or without this separate partition.

    Since you mention that the partition is not encrypted you can try these instructions. These instructions are given on a best effort basis, please take backups and do not complete this on production machines. If these instructions fail, I recommend migrating to new disks.

    Deallocate the VM -> Snapshot the OS disk -> Increase the size of the disk as desired -> Start the VM
    NOTE: This step is optional in case you need to expand the size of the OS disk size.
    2- Backup /boot (tar -cvzf /boot.tar.gz /boot/)
    3- Collect the disk names, UUIDs (only in case needed later), and partition information and save them to a text file.
    - lsblk
    - blkid
    - fdisk -l /dev/<DISK NAME>
    4- Recreate the boot partition:
    - gdisk /dev/<DISK NAME>
    - x -> e -> m
    - d (choose partition 2)
    - n (choose partition 2) -> start: should be the same of partition 2 per collected output (fdisk -l /dev/<DISK NAME>)
    -> end: should be the last sector of the disk
    -> GUID Partition ID: 8300
    -> w (to write changes) -> Y to confirm
    5- Verify the partition size with "gdisk -l /dev/<DISK NAME>"
    6- umount /boot/efi
    7- partprobe
    8- resize2fs /boot (If you see issues while executing this step, please skip to step to Step 10)
    9- mount /boot/efi
    10- Verify the contents of /boot, and verify the new size with "df -h" and "lsblk"

    NOTE: Only do the below if you have issues resizing in step 8.
    11- run "mount /boot" and "mount /boot/efi"
    12 - resize2fs /dev/<PARTITION NAME>
    13- If step 11 asks you to run "e2fsck -f /dev/<PARTITION NAME>", then please run it, then execute step 11 again.
    14- Verify the contents of /boot, and verify the new size with "df -h" and "lsblk"

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.