AWSProvider.create_server() hardcodes /dev/sda1 in BlockDeviceMappings:
"BlockDeviceMappings": [
{
"DeviceName": "/dev/sda1",
"Ebs": ebs,
},
],
On EC2, the root volume DeviceName is AMI-specific. AWS documents that for HVM instances it is often /dev/sda1 or /dev/xvda (Device names for volumes on Amazon EC2 instances).
When overriding root volume properties at launch (VolumeSize, DeleteOnTermination), DeviceName must match the AMI’s root device mapping. A mismatch can:
Apply VolumeSize to the wrong volume (root disk not resized)
Attach an extra EBS volume instead of overriding the root mapping
This is especially important now that mrack supports configurable root volume size via disksize (see PR #331).
Proposed solution
In create_server(), after get_image(specs):
Read ami.root_device_name when available
Otherwise use the first EBS entry from ami.block_device_mappings
Fall back to /dev/sda1 only if neither is present (backward compatibility)
Example helper:
@staticmethod
def _get_root_device_name(ami):
root_name = getattr(ami, "root_device_name", None)
if root_name:
return root_name
for mapping in getattr(ami, "block_device_mappings", None) or []:
device = mapping.get("DeviceName")
if device and mapping.get("Ebs"):
return device
return "/dev/sda1"
Use the resolved name in BlockDeviceMappings[].DeviceName.
AWSProvider.create_server()hardcodes /dev/sda1 inBlockDeviceMappings:On EC2, the root volume DeviceName is AMI-specific. AWS documents that for HVM instances it is often /dev/sda1 or /dev/xvda (Device names for volumes on Amazon EC2 instances).
When overriding root volume properties at launch (VolumeSize, DeleteOnTermination), DeviceName must match the AMI’s root device mapping. A mismatch can:
Apply VolumeSize to the wrong volume (root disk not resized)
Attach an extra EBS volume instead of overriding the root mapping
This is especially important now that mrack supports configurable root volume size via disksize (see PR #331).
Proposed solution
In create_server(), after get_image(specs):
Read ami.root_device_name when available
Otherwise use the first EBS entry from ami.block_device_mappings
Fall back to /dev/sda1 only if neither is present (backward compatibility)
Example helper:
Use the resolved name in BlockDeviceMappings[].DeviceName.