cloud-init 无法将 ephemeral0 转换为设备。

0

【以下的问题经过翻译处理】 期望的结果:我希望临时驱动器在启动时挂载。最好在用户数据执行开始之前。 实例类型:g4dn.xlarge AMI:使用ImageBuilder创建的自定义AMI,基于ami-09f85944838b438c5,该AMI基于Amazon Linux 2。

EC2文档表示:“实例类型支持的所有NVMe实例存储卷都会在实例启动时自动枚举并分配设备名称;将它们包含在AMI或实例的块设备映射中对它们没有影响。"

cloud-init.log日志显示如下

Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: mounts configuration is [['ephemeral0', '/media/ephemeral0'], ['swap', 'none', 'swap', 'sw', '0', '0']]
Dec 17 15:35:02 cloud-init[4081]: util.py[DEBUG]: Reading from /etc/fstab (quiet=False)
Dec 17 15:35:02 cloud-init[4081]: util.py[DEBUG]: Read 91 bytes from /etc/fstab
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Attempting to determine the real name of ephemeral0
Dec 17 15:35:02 cloud-init[4081]: DataSourceEc2.py[DEBUG]: Unable to convert ephemeral0 to a device
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: changed ephemeral0 => None
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Ignoring nonexistent named mount ephemeral0
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Attempting to determine the real name of swap
Dec 17 15:35:02 cloud-init[4081]: DataSourceEc2.py[DEBUG]: Unable to convert swap to a device
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: changed swap => None
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Ignoring nonexistent named mount swap
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Attempting to determine the real name of ephemeral0
Dec 17 15:35:02 cloud-init[4081]: DataSourceEc2.py[DEBUG]: Unable to convert ephemeral0 to a device
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: changed default device ephemeral0 => None
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Ignoring nonexistent default named mount ephemeral0
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Attempting to determine the real name of swap
Dec 17 15:35:02 cloud-init[4081]: DataSourceEc2.py[DEBUG]: Unable to convert swap to a device
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: changed default device swap => None
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Ignoring nonexistent default named mount swap
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Skipping nonexistent device named None
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: Skipping nonexistent device named None
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: no need to setup swap
Dec 17 15:35:02 cloud-init[4081]: cc_mounts.py[DEBUG]: No modifications to fstab needed
Dec 17 15:35:02 cloud-init[4081]: handlers.py[DEBUG]: finish: modules-config/config-mounts: SUCCESS: config-mounts ran successfully
profile picture
EXPERTE
gefragt vor 5 Monaten18 Aufrufe
1 Antwort
0

【以下的回答经过翻译处理】 “枚举”并不意味着“挂载”。在您链接的文档页面中,它讲解了如何准备实例存储卷以供使用。您可能需要创建分区并在其上创建文件系统。

要查找设备名称,您可以运行lsblk -f命令。有关更详细的信息,请参阅文档

若要在启动时挂载卷,您需要将设备信息添加到/etc/fstab中。在第一次启动时(在userdata中),您应该准备卷(上述文档中有说明),然后进行挂载,并修改fstab以便以后重新启动。

请注意,实例存储卷是临时存储。在重新启动期间,我们可能会将实例移动到新的物理主机上。如果实例关闭然后重新启动,那么它很可能会在新的主机上运行:在这种情况下,您应该编写一个启动时运行的脚本来检查文件系统的健康情况。如果无法正确准备,请运行mkfs命令。换句话说,您不应该假设保存在实例存储上的数据能够在重新启动后仍保持完整性。

profile picture
EXPERTE
beantwortet vor 5 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen