banner
三文字

方寸之间

居善地,心善渊,与善仁,言善信,正善治,事善能,动善时。
github
email
mastodon
website

A simple method for configuring dual boot with Linux and Windows.

OS: Arch Linux + Windows 10

Bootloader: GRUB

Because I occasionally need to use Windows for some tasks, I used to have to exit through the GRUB interface and reselect every time, which was quite troublesome. So I tried to configure dual boot for Arch Linux + Windows. The tool I used is os-prober, and the operation is very simple.

  1. First, install os-prober:
    [root@archlinux /]# pacman -S os-prober
  1. Check the disk partitions and confirm the installation location of Windows (choose the disk device according to your own installation situation, mine is /dev/sda):
    [root@archlinux /]# 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
  1. After finding the EFI partition for Windows, mount it to ensure that os-prober can detect it:
    [root@archlinux /]# mount /dev/sda2 /mnt/
    [root@archlinux /]# ls -l /mnt/
    total 1
    drwxr-xr-x 4 root root 1024 Feb 23 10:24 EFI
  1. Then run os-prober:
    [root@archlinux /]# os-prober
    /dev/sda2@/EFI/Microsoft/Boot/bootmgfw.efi:Windows Boot Manager:Windows:efi
  1. Of course, for safety reasons, first execute the following command to back up the original boot configuration:
    [root@archlinux /]# cp /boot/grub/grub.cfg /boot/grub/grub.cfg.bak
  1. Then, regenerate the GRUB configuration file:
    [root@archlinux /]# 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
  1. Finally, restart the computer and you can directly select the operating system you want to enter on the GRUB interface.

Originally posted on personal blog: 方寸之间

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.