# Syntax of "device\_name" for ec2 module

**URL:** <https://forum.ansible.com/t/syntax-of-device-name-for-ec2-module/17404>\
**Category:** Ansible Developer\
**Tags:** ubuntu\
**Created:** [January 30, 2015, 4:17pm UTC](https://forum.ansible.com/t/syntax-of-device-name-for-ec2-module/17404 "2015-01-30T16:17:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jody\_McIntyre](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Jody\_McIntyre](https://forum.ansible.com/u/Jody_McIntyre)\
**Post date:** [January 30, 2015, 4:17pm UTC](https://forum.ansible.com/t/syntax-of-device-name-for-ec2-module/17404/1 "2015-01-30T16:17:14Z")

</div>

Hi,

I’ve been trying to change the size of my root partition when provisioning with the ec2 module. The documentation isn’t clear on what to do here, and I’m seeing some very strange results. I tried a bunch of possible device names to see what happened. Here’s the playbook:

- name: temp  
hosts: localhost  
connection: local  
gather\_facts: False  
tasks:
- name: Launch/check temp  
local\_action:  
module: ec2  
id: “prod-temp-{{ item.n }}”  
key\_name: prod-2015  
image: ami-9eaa1cf6 # ubuntu 14.04 64bits  
instance\_type: t2.small  
group\_id: sg-cd72a9a9  
instance\_tags: {“Name”: “prod-temp-{{ item.n }}”}  
assign\_public\_ip: yes  
vpc\_subnet\_id: subnet-1f76e168  
volumes:
- device\_name: “{{ item.dev }}”  
volume\_size: 123  
region: us-east-1  
zone: us-east-1c  
with\_items:
- { n: “001”, dev: “/dev/sdb” }
- { n: “002”, dev: “/dev/sdb1” }
- { n: “003”, dev: “sdb” }
- { n: “004”, dev: “/dev/sda” }
- { n: “005”, dev: “/dev/sda1” }
- { n: “006”, dev: “sda” }
- { n: “007”, dev: “/dev/xvda” }
- { n: “008”, dev: “/dev/xvda1” }
- { n: “009”, dev: “xvda” }

The results from running this:

/dev/sdb: The root filesystem ends up being 8 GB on xvda1. xvdb exists with size 128 GB.  
/dev/sda1: The root filesystem ends up being 123 GB on xvda1 (which is what I wanted, but strange that “sda1” turns into “xvda1”).  
/dev/xvda: The root filesystem ends up being 8 GB on xvda1. No other block devices exist (other than xvda of course, at 8 GB).  
xvda: The root filesystem ends up being 8 GB on xvda1. No other block devices exist (other than xvda of course, at 8 GB).

All others give an error of the form:  
msg: Instance creation failed =\> InvalidBlockDeviceMapping: Invalid device name /dev/xvda1

Can anyone explain what’s going on here?

Thanks,  
Jody

---

<div class="post-metadata">

**Author:** ![Giovanni\_Tirloni](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Giovanni\_Tirloni](https://forum.ansible.com/u/Giovanni_Tirloni)\
**Post date:** [February 2, 2015, 11:38am UTC](https://forum.ansible.com/t/syntax-of-device-name-for-ec2-module/17404/2 "2015-02-02T11:38:47Z")

</div>

I haven't had the need but it looks like you need to specify "/dev/xvda"  
to change the root volume.

See if this answer helps: [http://bit.ly/1zunCOK](http://bit.ly/1zunCOK)

Giovanni

---

<div class="post-metadata">

**Author:** ![Jody\_McIntyre](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@Jody\_McIntyre](https://forum.ansible.com/u/Jody_McIntyre)\
**Post date:** [February 2, 2015, 4:58pm UTC](https://forum.ansible.com/t/syntax-of-device-name-for-ec2-module/17404/3 "2015-02-02T16:58:14Z")

</div>

I found that answer while troubleshooting my problem but it didn’t really help - I’m confused by what’s going on in the accepted answer but I’m not using variables to set the volumes information, rather the volume information is part of the task that createes the machine.

It looks like it worked for the SO poster with “/dev/xvda”, but in my case that gave a root filesystem of 8 GB not 123 GB as requested, with no additional block devices. In my case “/dev/sda1” was the only thing that allowed be to change the size of the root filesystem, which I don’t understand at all (and there’s almost no documentation on “volumes” at [http://docs.ansible.com/ec2\_module.html](http://docs.ansible.com/ec2_module.html) .

Cheers,  
Jody
