EFI Boot Windows from Local Hard Drive (No need for USB)



If you do not have a usb here available, or usb not bootable for some reason (i.e. motherboard issue, usb issue, or whatever), you might need to boot your windows from local hard drive.

Make available for an empty partition and format it into NTFS

It just needs to hold the installation files, so make it 8G will suffice.

# Using GParted will be fine
# i.e. /dev/sda4 is formatted into NTFS with label "WIN10"
mkdir -p "~/mounted/WIN10"
mount /dev/sda4 "~/mounted/WIN10"

mount your disk iso to any directory:

mount -o loop [path to your iso] [dest directory]
# i.e. mount -o loop "~/isos/win10.iso" "/mnt"

Copy over everything to the new drive

cp -r "/mnt/*" "~/mounted/WIN10"

Add a menuentry to your grub.cfg

search command:

search --no-floppy --set=root --label [USB drive label] --hint [your partition number]

your partition number: hd0,msdos4 ==> /dev/sda4 where:

  • hd0 means the first drive
  • msdos means the partition table (msdos or gpt)
  • msdos4 means the 5th partition of your drive, corresponds to /dev/sda4

Example menuentry here:

# grub.cfg should be located at '/boot/grub/grub.cfg'
# Append the following menuentry after your last memuentry

menuentry "Start Windows Installation" {
    insmod ntfs
    insmod search_label
    insmod chain
    insmod part_gpt

    set root=hd0,msdos4
    search --no-floppy --set=root --label "WIN10" --hint ($root)
    chainloader ($root)/boot/efi/bootx64.efi
}

Q&A:

  1. Do we need to run update-grub after adding menuentry?
    • No. Otherwise, update-grub will overwrite your grub.cfg file
  2. I'm booted into grub rescue. What can I do?
    • It doesn't matter. Booting into grub rescue means that the menuentry has some errors inside. You can manually type the menuentry commands in the grub rescue.

Reference:

  • http://onetransistor.blogspot.com/2014/09/make-bootable-windows-usb-from-ubuntu.html
  • http://onetransistor.blogspot.com/2015/09/uefi-ntfs-bootable-windows-usb-linux.html

注释