Amazon EC2:如何将现有 PV AMI 转换为 HVM [英] Amazon EC2: how to convert an existing PV AMI to HVM
问题描述
我应该如何在不重新创建整个系统设置的情况下将新的 AWS EC2 类(r3、i2)与我现有的 AMI 一起使用?
How should I use the new AWS EC2 classes (r3, i2) with my existing AMI without recreating the whole system setup?
新的 EC2 类仅支持基于 HVM 的虚拟化,但我只有 PVM AMI 映像.
The new EC2 classes support only HVM based virtualization but I have only PVM AMI images.
推荐答案
答案:
启动一个 Ubuntu HVM linux,任何版本,新的
Start an Ubuntu HVM linux, any version, new
使用我现有的 AMI/PVM linux 启动 Ubuntu/,并在其上安装 grub 软件包:apt-get install grub-pc grub-pc-bin grub-legacy-ec2 grub-gfxpayload-lists
Start an Ubuntu / with my existing AMI / PVM linux, and install grub packages on them: apt-get install grub-pc grub-pc-bin grub-legacy-ec2 grub-gfxpayload-lists
停止 PVM linux
Stop PVM linux
在 PVM linux 上分离根 (/dev/sda1) 分区
Detach root (/dev/sda1) partition at PVM linux
将 PVM linux 根分区附加到运行 HVM linux 的某个地方,例如:/dev/sdf
Attach PVM linux root partition to running HVM linux somewhere, e.g.: /dev/sdf
在 HVM linux 上:mkdir -p/mnt/xvdf &&挂载/dev/xvdf/mnt/xvdf
On HVM linux: mkdir -p /mnt/xvdf && mount /dev/xvdf /mnt/xvdf
rsync -avzXA/boot//mnt/xvdf/boot/
mount -o bind/dev/mnt/xvdf/dev &&mount -o bind/dev/pts/mnt/xvdf/dev/pts &&mount -o bind/proc/mnt/xvdf/proc &&mount -o bind/sys/mnt/xvdf/sys
chroot/mnt/xvdf
grub-install --no-floppy --recheck --force/dev/xvdf
update-grub2
退出 chroot:CTRL+D
exit chroot: CTRL+D
停止 HVM Linux
stop HVM Linux
分离/dev/sda1 原始根目录并分离/dev/sdf PVM 根目录
detach /dev/sda1 original root AND detach /dev/sdf PVM root
将 PVM 根目录作为/dev/sda1 附加到 HVM linux
attach PVM root to HVM linux as /dev/sda1
启动 HVM linux,瞧!
Start HVM linux, voilà!
从正在运行的 HVM linux 创建一个新的 AMI 映像,它将被 HVM 虚拟化.
Create a new AMI image from the running HVM linux, it will be HVM virtualized.
这篇关于Amazon EC2:如何将现有 PV AMI 转换为 HVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!