问题:
如何在不重新创建整个系统设置的情况下对现有的AMI使用新的AWS EC2类(r3、i2)?
新的EC2类只支持基于HVM的虚拟化,但我只有PVM映像。
发布于 2014-10-09 11:02:38
答案:
apt-get install grub-pc grub-pc-bin grub-legacy-ec2 grub-gfxpayload-lists
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
发布于 2019-07-01 20:14:25
@divyenduz的答案是可行的,但对于现代(大约2019年)的AWS EC2,需要进行一些清理和澄清。重要的是,现代实例类以不同的方式转换设备名称。
这是我修改过的步骤。
为了清晰起见,节点是:
继续之前的:备份原始节点PVM01
- install grub packages on PVM01
apt-获取安装grub-pc grub-pc-bin grub-旧式-EC2 grub-gfx负载-列表
- Create snapshot of /dev/sda1
- OR create AMI of entire node
- **NOTE**: Older instance classes such as C3 will translate the volume name to /dev/xvdf
- **NOTE**: Newer instance classes such as C5 will translate the volume name to /dev/nvme1
- On newer instance classes, the **root vol** will be /dev/nvme0 -- ZERO
- On newer instance classes, the **attached, secondary vol** will be /dev/nvme1 -- ONE
- Make a note of the attached volume device name
ssh PVM01 sudo fdisk -l
- detach /dev/${DEVNAME} (DEVNAME from above script)
https://stackoverflow.com/questions/24330721
复制相似问题