Install Grub2 on USB and HDD from Windows

Install Grub2 on USB and HDD from Windows

Grub2 is a very powerful boot loader, developed by GNU. You can easily install Grub2 from Windows with just a few commands.

Grub2 supports both UEFI and Legacy BIOS modes. It is capable of booting most Windows, Linux, BSD and macOS operating systems. For more information on Grub2, please refer to the GNU GRUB Manual.

Grub2 also supports installation on many operating systems such as Ubuntu, Linux distributions and including Windows. This article will guide you how to install Grub2 from Windows. AIO Boot also uses Grub2, which saves you a lot of time.

Install Grub2 on USB

Download

You can download Grub2 source code for all platforms here. For Windows, you should download the latest version of Grub2 here.  It supports Windows 7, 8, 8.1 and Windows 10, not yet tested on Windows XP.

Once downloaded, you need to extract the downloaded file above. Here I will extract the grub-2.02-for-windows directory to the C: drive.

Install Grub2

We will now start installing Grub2. You can install Grub2 for USB, or HDD, or even a memory card.

  1. Run Command Prompt under Admin and go to the grub-2.02-for-windows directory that you extracted above.
    cd /d C:\grub-2.02-for-windows
  2. Check the number of hard disk you will install, be it USB or HDD. Run diskmgmt.msc to open Disk Management.

    Install Grub2 from Windows
    Here I will install Grub2 for USB. In Disk Management is Disk 2, we will remember number 2 here.
  3. Grub2 for Windows supports installation and boot on three platforms: i386-pc, x86_64-efi and i386-efi. If you want to boot Grub2 in UEFI mode, you need to create a partition formatted as FAT32.
  4. Install Grub2 for BIOS (i386-pc):

    grub-install.exe --boot-directory=G:\ --target=i386-pc //./PHYSICALDRIVE2
    • Number 2 in the above command is the number of the hard disk that we checked in step 2.
    • G: is the drive of one of the partitions of the hard disk above.
  5. Install Grub2 for UEFI 64-bit (x86_64-efi):

    grub-install.exe --boot-directory=G:\ --efi-directory=G: --removable --target=x86_64-efi
  6. Install Grub2 for UEFI 32-bit (i386-efi):

    grub-install.exe --boot-directory=G:\ --efi-directory=G: --removable --target=i386-efi

    For UEFI, you need to specify a drive of the FAT32 partition at the –efi-directory parameter. If it does not support UEFI, Grub2 will report an error: grub-install.exe: error: F: doesn’t look like an EFI partition.

  7. Output results:
    C:\grub-2.02-for-windows>grub-install.exe --boot-directory=G:\ --target=i386-pc //./PHYSICALDRIVE2
    Installing for i386-pc platform.
    Installation finished. No error reported.
    

C:\grub-2.02-for-windows>grub-install.exe --boot-directory=G:\ --efi-directory=G: --removable --target=x86_64-efi
Installing for x86_64-efi platform.
Installation finished. No error reported.

C:\grub-2.02-for-windows>grub-install.exe --boot-directory=G:\ --efi-directory=G: --removable --target=i386-efi
Installing for i386-efi platform.
Installation finished. No error reported.

  • If you want to change the path of the grub directory, change the value of the –boot-directory parameter. For example, if you want the grub directory located in YourName, use –boot-directory=G:\YourName.
  • You have now completed the installation of Grub2. Please restart your computer for testing.
  • Configuration

    The configuration file for Grub2 is grub.cfg, which is stored in the grub directory. This file includes all Grub2 configurations, including interface, fonts and menus.

    You can create this file for yourself. Or download my grub.cfg file here and copy it into the grub directory.

    Here I will open the grub.cfg file to add two menus: Restart and Power Off.

    menuentry “Restart” {
    reboot
    }

    menuentry “Power Off” {
    halt
    }

    Wish success!

     
    Rate this (31 Votes)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值