大网数据广告活动
服务器运维问答

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

· 52CE 我爱测

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/UserGu…

问题原文

原帖链接 · dreamer · CC BY-SA 3.0

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.

社区高分解答

原帖链接 · Dale C. Anderson · CC BY-SA 4.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-09-09)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。