超简单的Arch Linux+Windows双启动配置教程


> OS:Arch Linux + Windows 10 > > bootloader:GRUB

因为偶尔仍然要使用Windows做些事情,之前每次都是通过GURB的界面退出操作进行重新选择,很是麻烦,所以就尝试进行配置Arch Linux+Windows的双启动。用的工具是os-prober,操作很简单。

1、首先安装os-prober

    [[email protected] /]# pacman -S os-prober

2、检查磁盘分区,确认Windows的安装位置(根据自己的安装情况选择磁盘设备,我这里是/dev/sda):

    [[email protected] /]# fdisk -l /dev/sda
    Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
    Disk model: KINGSTON SA400S3
    Units: sectors of 1 \* 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: gpt
    Disk identifier: 78241A73-6994-4D0B-9FCB-433076B5EC41

    Device       Start       End   Sectors  Size Type
    /dev/sda1     2048   1023999   1021952  499M Windows recovery environment
    /dev/sda2  1024000   1228799    204800  100M EFI System
    /dev/sda3  1228800   1261567     32768   16M Microsoft reserved
    /dev/sda4  1261568 468860927 467599360  223G Microsoft basic data

3、找到Windows的EFI分区之后,挂载它以确保os-prober可以发现:

    [[email protected] /]# mount /dev/sda2 /mnt/
    [[email protected] /]# ls -l /mnt/
    total 1
    drwxr-xr-x 4 root root 1024 Feb 23 10:24 EFI

4、然后执行os-prober

    [[email protected] /]# os-prober
    /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi

5、当然,为了安全起见,首先执行下面命令,备份原有的boot配置:

    [[email protected] /]# cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak

6、然后,重新生辰GRUB配置文件:

    [[email protected] /]# grub-mkconfig -o /boot/grub/grub.cfg
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-linux
    Found initrd image: /boot/initramfs-linux.img
    Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
    Found Windows Boot Manager on /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi
    done

7、最后重启电脑就可以在GRUB界面直接选择想要进入的操作系统了。