gpt4 book ai didi

amazon-web-services - 亚马逊 EC2 : how to convert an existing PV AMI to HVM

转载 作者:行者123 更新时间:2023-12-03 05:12:38 29 4
gpt4 key购买 nike

问题:

我应该如何将新的 AWS EC2 类(r3、i2)与我现有的 AMI 结合使用,而无需重新创建整个系统设置?

新的 EC2 类仅支持基于 HVM 的虚拟化,但我只有 PVM AMI 镜像。

最佳答案

答案:

  1. 启动 Ubuntu HVM linux,任何版本,新

  2. 使用我现有的 AMI/PVM linux 启动 Ubuntu/,并在其上安装 grub 软件包:apt-get install grub-pc grub-pc-bin grub-legacy-ec2 grub-gfxpayload-lists

  3. 停止 PVM linux

  4. 在 PVM linux 上分离根 (/dev/sda1) 分区

  5. 将 PVM linux 根分区附加到某处运行 HVM linux,例如:/dev/sdf

  6. 在 HVM Linux 上:mkdir -p/mnt/xvdf && mount/dev/xvdf/mnt/xvdf

  7. rsync -avzXA/boot//mnt/xvdf/boot/

  8. 挂载 -o 绑定(bind)/dev/mnt/xvdf/dev && 挂载 -o 绑定(bind)/dev/pts/mnt/xvdf/dev/pts && 挂载 -o 绑定(bind)/proc/mnt/xvdf/proc && mount -o 绑定(bind)/sys/mnt/xvdf/sys

  9. chroot/mnt/xvdf

  10. grub-install --no-floppy --recheck --force/dev/xvdf

  11. 更新 grub2

  12. 退出 chroot:CTRL+D

  13. 停止 HVM Linux

  14. 分离/dev/sda1 原始根目录并分离/dev/sdf PVM 根目录

  15. 将 PVM 根目录附加到 HVM linux 作为/dev/sda1

  16. 启动 HVM linux,瞧!

  17. 从正在运行的 HVM Linux 创建一个新的 AMI 镜像,它将被 HVM 虚拟化。

关于amazon-web-services - 亚马逊 EC2 : how to convert an existing PV AMI to HVM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24330721/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com