Debian 12 LVM on Azure User Guide
Overview
This guide covers the deployment and configuration of Debian 12 with an LVM root layout on Microsoft Azure using cloudimg's pre configured virtual machine image from the Azure Marketplace.
Debian 12, codenamed bookworm, is the current oldstable release of Debian, one of the oldest and most widely deployed Linux distributions, valued for slow, predictable change: the kernel, toolchain and library surface stay fixed for the life of the release. What makes this image different from the standard Debian 12 image is the disk layout: the root filesystem lives on an LVM logical volume (debian-vg/root, the same naming the Debian installer's own guided LVM option produces) on top of a physical volume partition, instead of on a fixed raw partition. That means you can grow the root filesystem online — on the running system, with no reboot and no unmount — and reshape storage later with standard LVM tooling.
What's included:
- Debian 12 (bookworm) with root on LVM: GPT disk with an EFI system partition, a 2 GiB
/bootpartition, and an LVM physical volume carrying volume groupdebian-vgwith logical volumerootas/(ext4) - The full LVM and grow toolchain:
lvm2,growpart,pvresize,lvextend,resize2fs— everything needed to grow or reshape storage, nothing removed from the standard package set - Every available security update applied at build time
unattended-upgradesarmed and verified against the Debian security suite, so the machine keeps applying security updates on its own- Azure Linux Agent (walinuxagent) and cloud-init for Azure integration
- chrony for NTP time synchronisation
- AppArmor in enforcing mode (the Debian default since Debian 10)
- LLMNR disabled, so the system resolver listens on loopback only
- Gen2 Hyper V virtual machine support
- 24/7 cloudimg support
Platform: Microsoft Azure (Gen2 Hyper V, x64)
Default user: azureuser
Security posture
This image ships with no known credential. There is no default password and no baked in SSH key:
- The root account password is locked, so no one can log in as root with a password.
PasswordAuthenticationis disabled in the SSH daemon, so every login is by key.PermitRootLoginis set toprohibit-password, so root cannot be reached with a password even if one were later set.- The only key that works is the public key you supply when you create the virtual machine. Azure injects it into
azureuserat first boot, so no two machines you launch ever share a secret. - The machine identity and the SSH host keys are regenerated uniquely on every instance, so no two machines share a host key either.
- AppArmor is enabled and enforcing, the Debian default.
- LLMNR (a legacy link local name resolution protocol with a well known spoofing attack class, and no use on an Azure virtual network) is disabled, so the only service reachable from off the machine is SSH.
Prerequisites
Before deploying this image, ensure you have:
- An active Microsoft Azure subscription
- Access to the Azure Portal or Azure CLI
- An SSH key pair for Linux VM access
- Familiarity with Azure VM management
Recommended VM Size: Standard_B2s (2 vCPU, 4 GB RAM) or larger.
Disk size: the image ships as a 30 GiB OS disk with the root volume taking all of its LVM space. If you want a larger root, set a bigger OS disk size at create time (for example 64 GiB) and then grow the root volume online as shown in Step 7 — that is exactly what this image is for.
Step 1: Deploy the Virtual Machine
Option A: Azure Portal
- Navigate to the Azure Marketplace and search for "Debian 12 LVM cloudimg"
- Select the image and click Create
- Configure the basics:
- Subscription: Select your Azure subscription
- Resource Group: Create new or select existing
- Virtual Machine Name: Enter a name for your VM
- Region: Select your preferred Azure region
- Size:
Standard_B2srecommended - Under Administrator Account, select SSH public key and enter your key
- Under Inbound Port Rules, allow SSH (port 22)
- On the Disks tab, set the OS disk size you want (larger than 30 GiB if you plan to grow the root)
- Click Review + Create, then Create
Option B: Azure CLI
az vm create \
--resource-group myResourceGroup \
--name my-debian-12-lvm-vm \
--image cloudimg:debian-12-lvm:debian12lvm:latest \
--size Standard_B2s \
--os-disk-size-gb 64 \
--admin-username azureuser \
--generate-ssh-keys \
--public-ip-sku Standard
--os-disk-size-gb 64 deploys the 30 GiB image onto a 64 GiB disk. The extra space is claimed in Step 7 with three LVM commands, online. The image ships no password and no authorized key of its own: the only credential that will ever work is the SSH public key you supply here.
Step 2: Connect via SSH
Run these on your own workstation, not on the VM. Find the public IP, then connect:
az vm show --resource-group myResourceGroup --name my-debian-12-lvm-vm --show-details --query publicIps -o tsv
ssh azureuser@<vm-ip>
There is no password to enter. If SSH asks you for one, the key you supplied at create time is not the key your client is offering.
Step 3: Confirm the release and the LVM layout
Check that the machine is the Debian 12 release you expect:
grep -E '^(NAME|VERSION|ID|VERSION_ID|PRETTY_NAME)=' /etc/os-release
cat /etc/debian_version
uname -srm
dpkg --print-architecture
Expected output:
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
ID=debian
12.15
Linux 6.1.0-53-cloud-amd64 x86_64
amd64

Then confirm the defining property of this image — the root filesystem on an LVM logical volume:
findmnt -no SOURCE,FSTYPE /
sudo pvs
sudo vgs
sudo lvs
Expected output on a fresh VM deployed with the default 30 GiB disk:
/dev/mapper/debian--vg-root ext4
PV VG Fmt Attr PSize PFree
/dev/sda3 debian-vg lvm2 a-- <27.50g 0
VG #PV #LV #SN Attr VSize VFree
debian-vg 1 1 0 wz--n- <27.50g 0
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root debian-vg -wi-ao---- <27.50g

/ on /dev/mapper/debian--vg-root is what the standard image cannot give you: a root volume you can extend online and a volume group you can reshape. The disk itself is GPT with a 512 MiB EFI system partition, a 2 GiB /boot partition (kept as a plain partition so the bootloader never depends on LVM activation), and the rest as the LVM physical volume. VFree 0 is deliberate: the image ships with the root volume taking every extent, and growth comes from enlarging the disk, not from space held back.
Step 4: Check the patch level
The image is fully updated at build time. Confirm that no upgrades are pending and that the update path is intact:
apt-get -s -o APT::Get::Always-Include-Phased-Updates=true dist-upgrade | grep -c '^Inst ' | sed 's/^/pending upgrades: /'
apt-mark showhold
dpkg -l | awk '/linux-image-[0-9]/{print $2, $3}'
Expected output shows pending upgrades: 0, no held packages, and exactly one installed Debian cloud kernel:
pending upgrades: 0
linux-image-6.1.0-53-cloud-amd64 6.1.187-1
Exactly one kernel package ships on purpose: a superseded kernel left installed would keep matching its own security advisories even though it never boots. This image also arms unattended-upgrades against the Debian security suite, so security updates are downloaded and applied on a timer without any action from you. You can still run updates on your own schedule:
sudo apt-get update && sudo apt-get -y dist-upgrade
Reboot if a new kernel was installed:
sudo systemctl reboot
Step 5: Verify the security posture
Confirm AppArmor is enforcing, root is locked, and SSH is key only:
sudo aa-status --enabled && echo "apparmor: enabled"
sudo passwd -S root
sudo sshd -T | grep -E '^(permitrootlogin|passwordauthentication|pubkeyauthentication) '
Expected output:
apparmor: enabled
root L 2009-12-22 -1 -1 -1 -1
permitrootlogin without-password
pubkeyauthentication yes
passwordauthentication no

without-password is how OpenSSH reports the prohibit-password setting. Both names mean the same thing: root may not authenticate with a password. The L from passwd -S means the root account is locked.
Step 6: Verify Azure integration and unattended updates
Confirm the Azure Linux Agent, cloud-init and time synchronisation are healthy, that unattended security updates are armed, and check your resources:
systemctl is-active walinuxagent 2>/dev/null || systemctl is-active waagent
cloud-init --version
systemctl is-enabled apt-daily-upgrade.timer
apt-config dump | grep -E 'APT::Periodic::(Update-Package-Lists|Unattended-Upgrade) '
systemctl is-active chrony
df -h /
Expected output:
active
/usr/bin/cloud-init 22.4.2
enabled
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Unattended-Upgrade "1";
active
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/debian--vg-root 27G 704M 25G 3% /
The Azure Linux Agent is what lets Azure provision your SSH key, run extensions and report VM health, so it should always be active. apt-daily-upgrade.timer being enabled, together with Unattended-Upgrade "1" in the apt periodic config, is what keeps the machine applying security updates on its own after launch.
Step 7: Grow the root filesystem online
This is the reason to choose the LVM image. If you deployed with an OS disk larger than 30 GiB (as in the Step 1 CLI example), the extra space is sitting unclaimed beyond the LVM partition, and you claim it on the running system — no reboot, no unmount, no downtime.
One thing to know first, measured on this exact image: cloud-init does not claim the space for you. Its growpart module skips LVM roots by design — /var/log/cloud-init.log records '/' SKIPPED: Resizing mapped device (/dev/mapper/debian--vg-root) skipped as it is not encrypted. — so on first boot the partition, the physical volume and the root volume stay at their shipped 27.5 GiB. That is standard behaviour for an LVM root, and it leaves you in control of when and how the space is used. The chain below claims all of it into /; run it as is, or stop after pvresize if you would rather keep the space free in the volume group for other volumes.
DISK="$(readlink -f /dev/disk/azure/root)"
sudo growpart "${DISK}" 3
sudo pvresize "${DISK}3"
sudo lvextend -l +100%FREE /dev/debian-vg/root
sudo resize2fs /dev/debian-vg/root
df -h /
FREE=$(sudo vgs --noheadings -o vg_free_count debian-vg | tr -dc '0-9')
PVB=$(sudo pvs --noheadings --units b --nosuffix -o pv_size "${DISK}3" | tr -dc '0-9')
PARTB=$(( $(cat /sys/class/block/$(basename "${DISK}")3/size) * 512 ))
if [ "${FREE:-1}" -ne 0 ]; then echo "FAIL: ${FREE} free extents remain in VG debian-vg"; exit 1; fi
if [ "$(( PARTB - PVB ))" -gt 8388608 ]; then echo "FAIL: pvresize did not take - partition ${PARTB}B vs physical volume ${PVB}B"; exit 1; fi
echo "root volume fully extended: 0 free extents in VG debian-vg, and the physical volume fills the partition"
Expected output on a 64 GiB disk, exactly as produced by this image:
CHANGED: partition=3 start=5244928 old: size=57667584 end=62912511 new: size=128972767 end=134217694
Physical volume "/dev/sdb3" changed
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
Size of logical volume debian-vg/root changed from <27.50 GiB (7039 extents) to <61.50 GiB (15743 extents).
Logical volume debian-vg/root successfully resized.
resize2fs 1.47.0 (5-Feb-2023)
Filesystem at /dev/debian-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 4, new_desc_blocks = 8
The filesystem on /dev/debian-vg/root is now 16120832 (4k) blocks long.
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/debian--vg-root 61G 700M 57G 2% /
root volume fully extended: 0 free extents in VG debian-vg, and the physical volume fills the partition

resize2fs says on-line resizing required and does it against the mounted root — the whole chain runs on the live system. The device shown by readlink may differ between boots (/dev/sda on one boot, /dev/sdb on another); the /dev/disk/azure/root link always points at the OS disk, which is why the chain uses it. The two checks at the end are worth keeping in your own automation: vg_free_count at 0 proves lvextend claimed everything, and the physical volume filling the partition (to within LVM's small metadata gap) proves pvresize actually took — each catches a failure the other cannot see. On this image, growpart also runs an LVM pvresize of its own after growing the partition, so the explicit pvresize in the chain is an idempotent re-assertion — keep it, because it also covers partitions grown by other tools.
If the disk was already fully claimed, growpart reports NOCHANGE and exits non zero, lvextend reports the size already matches, and the final checks still pass — the chain is safe to re-run.
Growing an existing VM later: enlarge the OS disk first (deallocate the VM, az disk update --resource-group <rg> --name <os-disk-name> --size-gb <new-size>, start the VM — or use the portal's Disks blade), then run the same chain. The LVM layout also lets you go further than root growth: attach a data disk and add it to the volume group with sudo pvcreate on the new disk's partition and sudo vgextend debian-vg, then carve dedicated volumes for data or logs with sudo lvcreate — all without touching the root filesystem.
Step 8: Networking and the firewall
The Azure Network Security Group is the control plane for inbound and outbound traffic, and it is the first and usually the only place you need to open a port. The image advertises a single inbound port, SSH on 22, and that is also the only service listening off the machine:
sudo ss -tlnp
On a fresh machine the listeners are sshd on port 22 (IPv4 and IPv6) and systemd-resolved on the loopback only addresses 127.0.0.53:53 and 127.0.0.54:53. LLMNR is disabled on this image, so the resolver does not open the off box port 5355 that a stock Debian 12 would; only port 22 is reachable from outside, governed by your NSG.
Debian ships no host firewall active by default, so your NSG rules take effect exactly as written with no second layer to keep in sync. If your policy requires a host firewall as well, Debian's own firewall framework is nftables (already installed), or you can install ufw for a simpler frontend. Add the SSH rule first, before enabling, so you do not lock yourself out:
sudo apt-get install -y ufw
sudo ufw allow OpenSSH
sudo ufw enable
Once a host firewall is running, a port must be open in both the Azure NSG and the host firewall before traffic reaches your service.
Step 9: Install software
The Debian archive carries the application packages. Search it, then install what you need:
apt-cache search nginx 2>/dev/null | sed -n '1,5p'
Install a package and enable it in the usual way, for example sudo apt-get install -y nginx followed by sudo systemctl enable --now nginx.
To add another administrator, create the account with sudo adduser <name>, add it to the sudo group with sudo usermod -aG sudo <name>, then copy your public key into /home/<name>/.ssh/authorized_keys with mode 600 and the .ssh directory mode 700, owned by that user. The image ships with no human accounts at all, so azureuser is the only login until you add one:
getent group sudo
Expected output:
sudo:x:27:azureuser
Common Use Cases
- Workloads whose storage needs will grow — extend the root online instead of rebuilding the VM
- Servers that will gain dedicated volumes later, for data, logs or applications
- Teams whose build standard requires LVM managed disks on every server
- A stable, fully supported Debian base for any workload
Troubleshooting
Cannot connect via SSH
- Verify the VM is in Running state in the Azure Portal
- Check that port 22 is allowed in the Network Security Group
- Ensure you are using the correct username:
azureuser - Verify your SSH key matches the one you supplied at create time. Password login is disabled by design, so a wrong key cannot fall back to a password prompt.
To see which key your client is actually offering, run ssh -v azureuser@<vm-ip> from your workstation and look for the Offering public key lines.
df shows 27G on a bigger disk
That is the expected state before Step 7 has been run: cloud-init deliberately does not grow an LVM root, so a VM deployed on a 64 GiB disk boots with the shipped 27.5 GiB root volume until you claim the space. Run the Step 7 chain — it is online and takes seconds.
growpart says NOCHANGE
The partition already fills the disk. growpart exits non zero on NOCHANGE, which is informational, not an error — if you expected new space, confirm the OS disk resize actually happened (az disk show --query diskSizeGb) and that the VM was restarted after an offline disk resize.
Azure agent not running
sudo systemctl status walinuxagent
sudo systemctl enable --now walinuxagent
Package manager issues
Refresh the metadata cache first:
sudo apt-get update
If repositories are unreachable, check DNS resolution. getent is always present and resolves through the same system resolver:
getent hosts deb.debian.org
Error priority journal lines at boot
A few error priority journal lines appear on every boot of a Debian 12 image on Azure and are expected and harmless: the kernel's RETBleed: WARNING: Spectre v2 mitigation leaves CPU vulnerable to RETBleed attacks notice (a CPU mitigation report, not a fault in the machine), /dev/sr0: Can't open blockdev (the emulated CD-ROM drive), and a pair of dhclient ... execve (/bin/true, ...): Permission denied lines with a Timeout too large reducing to: 2147483646 companion — cloud-init's short lived first boot DHCP probe running dhclient with a no-op script that the stock AppArmor dhclient profile denies; the real network configuration is applied by systemd-networkd and is unaffected. None of these prevents boot, SSH or networking. Beyond that, a healthy machine has no AppArmor denials in the kernel log at all:
sudo journalctl -k --no-pager | awk '/apparmor/ && /DENIED/{n++} END{print "apparmor denials: " n+0}'
Expected output:
apparmor denials: 0
Important Notes
Debian is free and open source. It is not covered by a single licence: it is a distribution assembled from thousands of independently packaged components, each carrying its own terms, including the GPL, LGPL, MIT, BSD and Apache 2.0. Every package's terms are readable under /usr/share/doc/<package>/copyright. This image enables only Debian's DFSG-free main component. No subscription or licence key is required to run this image.
Debian 12 is the current oldstable release. It continues to receive security updates through the Debian LTS project, published to the standard mirrors free of charge, until 30 June 2028 — the image updates itself from the same bookworm-security suite throughout. Plan a move to a newer stable release for workloads that need to outlive that window.
Debian is a trademark of Software in the Public Interest, Inc. The name is used here nominatively, only to identify the distribution this image contains. cloudimg is not affiliated with, endorsed by or sponsored by the Debian Project or Software in the Public Interest, Inc.
Support
For assistance with this image, contact cloudimg support:
- Website: www.cloudimg.co.uk
- Product Catalogue: www.cloudimg.co.uk/products
- User Guides: www.cloudimg.co.uk/guides
- SLA: 24 hour response guaranteed