参考了博客:
centos 6在线重装:http://my.oschina.net/firxiao/blog/295553
centos 7在线重装:https://my.oschina.net/firxiao/blog/465691
先是操作远程服务器,想用用docker,服务器装的centos6对docker支持及其不好,而centos又不像ubuntu可以很容易的进行大版本升级,一怒重装centos 7。
结合上边两篇文章,实现了centos 6系统下重装centos 7,centos 6 使用grub,虽说是重装centos 7,但需要编辑/boot/grub/menu.lst。这里也有个坑,不能照着上述文章centos 6那样写menu.lst文件,因为下的kernel和initrd是centos7的,所以参数应该照着centos 7里边的参数写。
很顺利的实现了centos 6 重装centos7。
然后上瘾了,几台测试服务器想装装kolla玩,重装centos 7,留出ceph的分区...然后照着上述经验继续写,没反应....
额,这是efi+gpt的启动,启动配置文件在/boot/efi/EFI/centos/grub.cfg,于是改执行命令为
grub2-mkconfig --output=/boot/efi/EFI/centos/grub.cfg
重启不响应了....隔了两天去机房接显示器看,晕,无法启动。
额,参考/boot/efi/EFI/centos/grub.cfg上边两个系统自带的配置。linux应该写成linuxefi,initd应该写成initrdefi。
但是,还是无法启动,说setroot那里就是找不到。
不折腾,把/boot/efi/EFI/centos/grub.cfg上边两个系统自带的配置对应部分复制到我自己的配置里,搞定。贴下40_custom最终配置:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "remote reinstall" {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod xfs
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 183054ec-b2c9-42c7-9264-bb5502e27b0a
else
search --no-floppy --fs-uuid --set=root 183054ec-b2c9-42c7-9264-bb5502e27b0a
fi
linuxefi /vmlinuz.remote repo=http://mirrors.aliyun.com/centos/7/os/x86_64/ vnc vncpassword=password ksdevice=enp0s8 ip=192.168.3.203 netmask=255.255.255.0 gateway=192.168.3.254 nameserver=114.114.114.114 noselinux headless xfs panic=60
initrdefi /initrd.img.remote
}