user5832678
user5832678

Reputation:

Name of device for additional volumes in EC2 are always xvdX?

today I start to play around with ansible, amazon-ec2 and ebs. After the automation for the provisioning of a new ec2-instance with ubuntu works I try attach an additional volume to an instance by extend my command as follow:

- name: Launch the new EC2 Instance
  ec2:
    aws_access_key: "AAAAAAAAAAAAAAAABBBBBBBBBBBBBBBCCCCCCCCCCCCCC"
    aws_secret_key: "DDDDDDDDDDDDDDDDEEEEEEEEEEEEEEFFFFFFFFFFFFFF"
    group: "webserver"
    instance_type: "t2.micro"
    image: "ami: ami-0767046d1677be5a0"
    wait: true 
    region: "eu-central-1"
    keypair: "my_keypair"
    volumes:
      - delete_on_termination: yes
        device_name: "/dev/sdd"
        volume_size: 10
        volume_type: "gp2"
    count: "1"

and expect an new volume with the device /dev/sdd but I get in the instance the device /dev/xvdd I can live with that but I would like to understand why? Because every documentation I see so far is that there should be a link from xvdd sdd but this link don't exists. Maybe someone here can me explain why ansible (or aws?) ignored the device name is this depending on the kind of storage (or ami?) best regards Dan

Upvotes: 1

Views: 285

Answers (1)

mdaniel
mdaniel

Reputation: 33203

It depends on the underlying virtualization, and almost all the modern ones use HVM; on those virtual machines, the devices are renamed by the kernel as described in the fine manual

One will want to similarly exercise caution about using NVMe devices, as they also get their own device nomenclature.

Thankfully, the ansible setup: module (or gather_facts: yes) will enumerate all available disks on the machine and make them available along with helpful metadata in the ansible_devices facts dict, which usually includes the AWS EBS volume-id in the symlinks

Upvotes: 1

Related Questions