GRUB 是一个多重启动管理器。GRUB 是 GRand Unified Bootloader 的缩写,它可以在多个操作系统共存时选择引导哪个系统。它可以引导几乎所有的 Unix,Linux,Windows 操作系统。它可以 载入操作系统的内核和初始化操作系统,或者把引导权交给操作系统来完成引导。
如何添加Windows 10启动项到GRUB2
装的双系统,第一个系统装的是Windows 10,然后再安装Centos7。装完Centos7发现没有Windows 10的启动项,这时候需要手动添加windows 10的启动项。
# 打开40_custom文件,添加如下内容
[root@localhost ~]# vim /etc/grub.d/40_custom
menuentry 'Windows 10' {
insmod ntfs
set 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 2
CentOS 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 list
saved_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_64
Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3
Found initrd image: /boot/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.img
done

如何更改grub2菜单的超时时间
打开/etc/default/grub文件,修改GRUB_TIMEOUT变量值,变量的值是秒数。
[root@localhost ~]# vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="gfxterm"
GRUB_BACKGROUND=/boot/grub2/background.jpg
GRUB_GFXMODE=1440x900,1024x768,640x480
GRUB_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.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-1062.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1062.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3
Found initrd image: /boot/initramfs-0-rescue-2fbe0839e3b3416b960e84dab68c8bb3.img
done

以上就是良许教程网为各位朋友分享的Linu系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你 !
