Repository navigation
Description
Summary
barman's Azure snapshot backup resolves the mounted volume for a data disk solely through the /dev/disk/azure/scsi1/lun{N} symlink. That symlink is created by the Azure Linux agent only for SCSI controllers and points only at the raw disk device. As a result the backup fails in two common configurations:
- Partitioned data disks (SCSI):
lun{N}points at the raw disk (e.g./dev/sda), but the filesystem is mounted from a partition (/dev/sda1).findmnton the raw disk returns nothing. - NVMe-only VMs (v6 / Ebsv5 / other NVMe-enabled SKUs): the
/dev/disk/azure/scsi1/hierarchy is not created at all for NVMe-attached data disks, so the symlink does not exist.
Both surface as the same error:
SnapshotBackupException: Could not find volume with lun N at any mount point
Affected entry points
The snapshot code lives in barman/cloud_providers/azure_blob_storage.py and is shared by both:
barman-cloud-backup --cloud-provider azure-blob-storage --snapshot-instance ...(barman-cli-cloud)barman backupwithbackup_method = snapshotagainst Azure (barman server)
Root cause
AzureCloudVolumeMetadata.resolve_mounted_volume (master and release/3.19.0, unchanged):
lun_symlink = "/dev/disk/azure/scsi1/lun{}".format(self._lun)
mount_point, mount_options = cmd.findmnt(lun_symlink)
...
if mount_point is None:
raise SnapshotBackupException(
"Could not find volume with lun %s at any mount point" % self._lun)findmnt matches only when the supplied device is itself the mount source. A raw disk whose filesystem lives on a partition is not matched, and a non-existent symlink yields no result. There is no fallback to partition symlinks, NVMe paths, or block-device enumeration.
Two distinct problems
1. SCSI, partitioned data disk
/dev/disk/azure/scsi1/lun{N}β raw disk, e.g./dev/sda- filesystem mounted from
/dev/sda1 findmnt /dev/disk/azure/scsi1/lun{N}β empty β exception
The Azure Linux agent already creates partition symlinks for exactly this case β /dev/disk/azure/scsi1/lun{N}-part1 (documented in azure-vm-utils). barman never looks at them.
2. NVMe-only VM
/dev/disk/azure/scsi1/lunNis SCSI-specific and is not created on NVMe-only VMs.- The official NVMe equivalent is
/dev/disk/azure/data/by-lun/<lun>, provided by theazure-vm-utilspackage / udev rules. - barman has no awareness of this path, so resolution fails before a mount point is ever checked.
Comparison with the AWS provider
The AWS provider already handles NVMe. AwsCloudVolumeMetadata.resolve_mounted_volume (barman/cloud_providers/aws_s3.py) enumerates /sys/block and matches Nitro/NVMe devices by EBS volume ID read from /sys/block/{dev}/device/serial. The Azure provider has no equivalent.
So NVMe support is a gap specific to the Azure provider, not a barman-wide limitation. Partition handling, by contrast, is missing in both providers (each resolves only raw block devices, never partitions).
Suggested fix
Resolve the volume through additional, officially-supported paths instead of the single raw symlink:
- Keep
/dev/disk/azure/scsi1/lun{N}(raw SCSI disk β current behaviour). - Fall back to
/dev/disk/azure/scsi1/lun{N}-part*for partitioned SCSI disks (official WALinuxAgent symlinks). - Fall back to
/dev/disk/azure/data/by-lun/{N}and its partitions for NVMe data disks (official azure-vm-utils symlinks β note this requires theazure-vm-utilspackage, present in recent marketplace images but not all). - As a robust final fallback, resolve the symlink with
realpathand uselsblkto find the mount point of the disk or any of its partitions. This works for SCSI and NVMe alike with no extra package dependency.
References:
- azure-vm-utils β disk identification: https://github.com/Azure/azure-vm-utils/blob/main/doc/disk-identification.md
- Introduction to azure-vm-utils: https://learn.microsoft.com/en-us/azure/virtual-machines/linux/azure-virtual-machine-utilities
- SCSI to NVMe for Linux VMs: https://learn.microsoft.com/en-us/azure/virtual-machines/nvme-linux
Workaround (current 3.19.0, no code change)
- SCSI partitioned disk: format and mount the data disk as a whole-disk device (no partition table) so the
lun{N}symlink is itself the mount source. This is one of the two officially documented disk setups, so it is a supported configuration β but it must be decided at provisioning time (converting an already-partitioned disk is destructive). - NVMe-only VM: no supported workaround β the
scsi1/lunNpath does not exist. Using a SCSI-based VM SKU is the only way to keep snapshot backups working without a code change.
Environment
- barman / barman-cli-cloud: 3.19.0 (and current
master) - Confirmed against the
release/3.19.0source βresolve_mounted_volumeis identical onmaster.
cc @didorgas @martinmarques
Activity