Installing Window7 (64Bit) on a GPT disk, on motherboards with EFI, without USB / DVD

    Immediately you need to clarify that we will talk about installing Win next to the linux distribution. That is, grub-efi should be installed on the computer.
    Installation is possible only 64 bit Windows system.

    Since we have an EFI board, it means there is at least one FAT32 partition on the disk.
    We also need to create a section where we will unpack the Win image.

    / dev / sda1 - EFI partition
    / dev / sda3 - The partition where we will unpack the image, Fat32 minimum 5GB (well, or how much your image weighs)

    Copy the image to disk

    Next is the preparatory towel:
    sudo mkdir /mnt/cdrom
    sudo mkdir /mnt/isoExtr
    sudo mount -o loop ~/ISO/win7_sp1_64.iso /mnt/cdrom/
    sudo mount /dev/sda3 /mnt/isoExtr/
    cd /mnt/cdrom/
    #Копируем образ на раздел
    sudo cp -Rv ./* ../isoExtr/
    cd /tmp
    sudo umount /mnt/cdrom
    


    Unpack the EFI boot loader

    To do this, we need a 7z archiver, the bootloader is stored in the sources / install.wim file (Windows / Boot / EFI / bootmgfw.efi)
    sudo apt-get install p7zip-full
    cd /tmp
    7z x /mnt/isoExtr/sources/install.wim Windows/Boot/EFI/bootmgfw.efi
    

    Copy the bootloader into the efi of our unpacked image
    sudo cp /tmp/Windows/Boot/EFI/bootmgfw.efi /mnt/isoExtr/efi/microsoft/boot/
    


    We learn UUID of disks

    ls -l /dev/disk/by-uuid/ 
    

    In my case it is:
    lrwxrwxrwx 1 root root 10 Nov 28 22:29 A18B-57CD -> ../../sda1
    lrwxrwxrwx 1 root root 10 Nov 28 22:29 CAA9-A38B -> ../../sda3


    Create a menu in Grub

    Add to the end of /etc/grub.d/40_custom
    sudo nano /etc/grub.d/40_custom
    


    menuentry "Microsoft Windows Start" --class windows --class os {
    insmod usbms
    insmod part_gpt
    insmod part_msdos
    insmod fat
    insmod search_fs_uuid
    insmod chain
    search --fs-uuid --no-floppy --set = root A18B-57CD # <- CHANGE THIS TO YOUR UUID
    chainloader ($ {root}) / efi / microsoft / BOOT / bootmgfw.efi
    }

    menuentry "Microsoft Windows x86_64 UEFI-GPT Setup" --class windows --class os {
    insmod usbms
    insmod part_gpt
    insmod part_msdos
    insmod fat
    insmod search_fs_uuid
    insmod chain
    search --fs-uuid --no-floppy --set = root CAA9-A38B # <- CHANGE THIS TO YOUR UUID
    chainloader ($ {root}) / efi / Microsoft / Boot / bootmgfw.efi
    }


    sudo chmod +x /etc/grub.d/40_custom
    sudo update-grub
    cd ~
    sudo umount /mnt/isoExtr
    


    Windows installation

    Reboot
    sudo reboot
    


    We select in a hornbeam "Microsoft Windows x86_64 UEFI-GPT Setup".
    We put Windows on the desired partition, during the installation process it will ask you to reboot.
    Apparently, at this moment she writes her bootloader (/efi/microsoft/BOOT/bootmgfw.efi) to the EFI partition, and does not break grub-efi
    in the hornbeam, select "Microsoft Windows Start", the system will be installed.
    Installation completed.
    Next, when you need Windows, select the item "Microsoft Windows Start" in the hornbeam.

    One of the drawbacks of this method is that you need to deploy the image to disk, although it would be easier to create a new image in which the bootloader we needed was, but all my attempts to do this failed.
    The advantage is that the bootloader does not need to be repaired after installing Windows.
    PS: If someone knows how to start the bootloader from iso in grub efi, I will be very grateful for the information provided, since I could not start the EFI bootloader from any linux images.
    P.S.2: I managed to put Win7 (64bit) at home on a live computer, however, I had two physical disks. In VirtualBox, I could not repeat it, because the EFI Windows bootloader crashed, it issued the mythical "BlXmiInitialize failed 0xc000009a". I will be glad if someone repeats on a live machine, since I do not want to go through the ad installation of Windows again.

    Also popular now: