300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > 双系统如何在Centos7中添加GRUB2启动项

双系统如何在Centos7中添加GRUB2启动项

时间:2023-08-27 08:09:35

相关推荐

双系统如何在Centos7中添加GRUB2启动项

GRUB2是Centos7的默认引导加载程序。它可以轻松地加载所有的Linux发行版和其他操作系统。它提供一个菜单显示所有的操作系统。GRUB2具有高级特性以及一些基本特性,使其在所有Linux上都有效。文内含长段代码可复制可往左滑,希望对大家有帮助!

如何添加Windows 10启动项到GRUB2

装的双系统,第一个系统装的是Windows 10,然后再安装Centos7。装完Centos7发现没有Windows 10的启动项,这时候需要手动添加windows 10的启动项。

# 打开40_custom文件,添加如下内容[root@localhost ~]# vim /etc/grub.d/40_custommenuentry 'Windows 10' {insmod ntfsset root='hd0,1'chainloader +1}# 修改完成之后,需要导出生成配置文件,这样才能生效。[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg

重启电脑,检查一下是否有Windows 10启动项

如何更改默认启动项

列出所有启动项

[root@localhost ~]# grep '^menuentry' /boot/grub2/grub.cfg |cut -d "'" -f 2CentOS Linux (3.10.0-1062.el7.x86_64) 7 (Core)CentOS Linux (0-rescue-2fbe0839e3b3416b960e84dab68c8bb3) 7 (Core)Windows 10

修改Windows10作为默认启动项

[root@localhost ~]# grub2-set-default "Windows 10"

检查是否设置成功

[root@localhost ~]# grub2-editenv listsaved_entry=Windows 10

保存更改

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfg Generating grub configuration file ...Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.imgFound linux image: /boot/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3Found initrd image: /boot/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.imgdone

如何更改grub2菜单的超时时间

打开/etc/default/grub文件,修改GRUB_TIMEOUT变量值,变量的值是

[root@localhost ~]# vim /etc/default/grubGRUB_TIMEOUT=5GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"GRUB_DEFAULT=savedGRUB_DISABLE_SUBMENU=trueGRUB_TERMINAL_OUTPUT="gfxterm"GRUB_BACKGROUND=/boot/grub2/background.jpgGRUB_GFXMODE=1440x900,1024x768,640x480GRUB_CMDLINE_LINUX="crashkernel=auto spectre_v2=retpoline rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet"GRUB_DISABLE_RECOVERY="true"

保存生成配置文件

[root@localhost ~]# grub2-mkconfig -o /boot/grub2/grub.cfgGenerating grub configuration file ...Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.imgFound linux image: /boot/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3Found initrd image: /boot/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.imgdone

总 结

在这篇文章中,讲述了如何添加grub引导记录、修改超时时间、修改默认启动项。如果喜欢这篇文章,可以点个赞。

参考链接:

教你如何在Centos7中添加GRUB2启动项 :https://mp./s/ihPW1ZkWAV3n6P6GNGLQMg

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。