如何将 Windows 添加到 GRUB

lin*_*bie 3 grub arch-linux windows

我的 SSD 上安装了加密的 Archlinux。现在我有一个安装了 Windows 的硬盘。但是在我的 GRUB 中只显示了 Archlinux(难怪,因为我刚刚在另一个硬盘上安装了 Windows,GRUB 现在还不知道。)。

我的问题是,如何将我的 Windows-HDD 正确添加到 GRUB,以便我可以在启动时选择启动哪个?

我有点害怕破坏我的 GRUB,所以我不能再启动我加密的 Archlinux。

谢谢!

小智 6

保存所有 grub 配置文件的备份。

我过去使用过两种方法:

1)ntfs-3g使用您的包管理器安装(这应该允许您的安装自动查看Windows分区)。我可以在 EPEL 存储库中找到它,但您必须在 Arch 上为它找到不同的存储库。

然后sudo grub2-mkconfig。这对我有用,同时试图让我的 centos7 双启动与 Windows 一起工作。

2)或者,您最好通过将文件添加到 /etc/grub.d/

例如,在我当前的 Centos7 + Windows 10 双启动系统上:

$ sudo cat /etc/grub.d/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 "Windows 10" {
   set root='(hd0,1)'
   chainloader +1
} 
Run Code Online (Sandbox Code Playgroud)

其中menuentry参数是将出现在 grub 菜单中的名称。该(hd0,1)会根据什么硬盘和分区什么你有Windows更改。