Skip to content

Launch hardcodes root device /dev/xvda → root-volume-size override silently lost on Ubuntu/Rocky (/dev/sda1) AMIs #284

Closed

Description

@scttfrdmn

Summary

Launch hardcodes the root block-device name to /dev/xvda (pkg/aws/client.go buildBlockDevices, ~:854) and never derives it from the AMI. For AMIs whose registered root device is /dev/sda1 — notably Ubuntu (Canonical) and Rocky Linux — the block-device mapping spawn builds does not match the AMI's actual root device, so the RootVolumeSizeGiB override (and any root EBS settings: encryption, DeleteOnTermination) land on a non-root device. EC2 then keeps the AMI's default-size root volume and, depending on the mapping, may attach an unintended extra volume.

Impact

Root-volume sizing silently no-ops on /dev/sda1 AMIs. A caller asking for a 200 GB root on Ubuntu gets the AMI's default (often 8–20 GB) root plus a stray /dev/xvda volume, with no error.

Repro

Launch any Ubuntu 24.04 / Rocky 9 AMI with LaunchConfig.RootVolumeSizeGiB set well above the AMI default; observe the root volume stays at the AMI default size.

Root cause

buildBlockDevices uses a constant /dev/xvda. AWS AMIs register their root device name in Image.RootDeviceName (via DescribeImages) — Amazon Linux uses /dev/xvda, but Ubuntu/Rocky/Debian and many marketplace AMIs use /dev/sda1. The block-device mapping's DeviceName must equal the AMI's RootDeviceName for the override to apply to the root volume.

Suggested fix

Derive the root device name from the AMI: DescribeImages on LaunchConfig.AMI, read Images[0].RootDeviceName, and use that as the DeviceName of the root block-device mapping (fall back to /dev/xvda only if the lookup fails/empty). Launch already calls DescribeImages for rootVolumeSizeFromAMI (root-snapshot min size), so RootDeviceName can come from the same call — no extra AWS round-trip.

Context

This blocks downstream adoption in Prism (github.com/scttfrdmn/prism), which is migrating its EC2 launch/lifecycle onto spawn. Prism has swapped instance lifecycle (stop/start/hibernate/terminate) onto spawn.Client, but keeps launch on its own EC2 path specifically because of this /dev/xvda hardcode (its default templates are Ubuntu/Rocky → /dev/sda1). Prism's own launcher branches on the AMI to pick /dev/sda1 vs /dev/xvda; matching that in spawn would let Prism route launch through spawn too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions