📜 ⬆️ ⬇️

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

Immediately you need to clarify that it will be about installing Win next to the linux distribution. That is, grub-efi should be 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 partition where we will unzip the Win image.

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

Copy the image to disk

Next prep 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 Win Loader

For this we need 7z archiver, the bootloader is stored in the file sources / install.wim (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 in the efi of our unpacked image
 sudo cp /tmp/Windows/Boot/EFI/bootmgfw.efi /mnt/isoExtr/efi/microsoft/boot/ 


Learn UUID drives

 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 end /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 


Install Windows

Reboot
 sudo reboot 


We choose in the hornbeam "Microsoft Windows x86_64 UEFI-GPT Setup".
We put the Windows on the desired partition, during the installation process, it will ask to reboot.
Apparently, at this moment, she writes her bootloader (/efi/microsoft/BOOT/bootmgfw.efi) to the EFI partition, without breaking grub-efi
In the hornbeam, select "Microsoft Windows Start", the system will be installed.
Installation completed.
Then, when you need a Windows, choose 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 loader we needed would be, 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 grub efi bootloader from iso, I will be very grateful for the information provided, since I could not start the EFI bootloader from any linux images.
PS.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, because the EFI Windows boot loader crashed, gave out the mythical “BlXmiInitialize failed 0xc000009a”. I would be glad if someone repeats on a live machine, since I don’t want to go through the ad-installation of Windows again.

Source: https://habr.com/ru/post/160655/


All Articles