Invalid block device mapping: Invalid device name - Creating an AMI from an Instance Store-Backed

I'm trying to create an AMI from an instance store-back instance but I'm getting "Invalid device name" error at the time when I try to register the AMI.

I'm following this document:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-instance-store-ami.html#amazon_linux_instructions

This is my current instance state:

[root@ip-172-29-1-29 ~]# lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   500G  0 disk
└─xvda1 202:1    0   500G  0 part /
xvdb    202:16   0 745.2G  0 disk
└─xvdb1 202:17   0 745.2G  0 part /media/ephemeral0
xvdc    202:32   0 745.2G  0 disk
└─xvdc1 202:33   0 745.2G  0 part /media/ephemeral1

[root@ip-172-29-1-29 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      493G  4.9G  488G   1% /
devtmpfs         61G  108K   61G   1% /dev
tmpfs            61G     0   61G   0% /dev/shm
/dev/xvdb1      734G   69M  697G   1% /media/ephemeral0
/dev/xvdc1      734G   69M  697G   1% /media/ephemeral1

Here is my fstab:

[root@ip-172-29-1-29 ~]# cat /etc/fstab
#
LABEL=/     /           ext4    defaults,noatime  1   1
tmpfs       /dev/shm    tmpfs   defaults        0   0
devpts      /dev/pts    devpts  gid=5,mode=620  0   0
sysfs       /sys        sysfs   defaults        0   0
proc        /proc       proc    defaults        0   0
/dev/xvdb1   /media/ephemeral0       ext4    defaults,noatime,nodiratime,nofail 0   2
/dev/xvdc1   /media/ephemeral1       ext4    defaults,noatime,nodiratime,nofail 0   2

And here is the manifest file I'm getting:

<machine_configuration>
    <architecture>x86_64</architecture>
    <block_device_mapping>
      <mapping>
        <virtual>ami</virtual>
        <device>xvda</device>
      </mapping>
      <mapping>
        <virtual>ephemeral0</virtual>
        <device>xvdb</device>
      </mapping>
      <mapping>
        <virtual>ephemeral1</virtual>
        <device>xvdc</device>
      </mapping>
      <mapping>
        <virtual>root</virtual>
        <device>/dev/xvda1</device>
      </mapping>
    </block_device_mapping>
  </machine_configuration>

At the end when I try to register AMI, I get the following error:

An error occurred (InvalidManifest) when calling the RegisterImage operation: Invalid block device mapping: Invalid device name '/dev/xvda1'

I tried with "/dev/xvda" or "xvda" also, but not sure what's the expected device name I should be using for root.


Solution 1:

As suggested in comments to the OP's question, the root device is either /dev/sda1 or /dev/xvda, and AWS's device naming docs specify what names can be used for other devices.

The way I understand it, naming has more to do with how the hypervisor sees the device than it does with how the OS sees the device.