Install Windows 10/7 without USB or DVD from Linux

I am often asked help for installing Operating System, and this is a new way I have not tried before.
Supposed you have a empty NTFS partition, say /dev/sda4, and a windows iso file, say windows.iso. And you have a GRUB boot menu.
Note: The /dev/sda4 should be larger than the size of windows.iso. This partition can be used as windows installation partition or just for bootable windows installation partition. If you use /dev/sda4 just for boot windows installation program, you need to create another empty NTFS partition for Windows system.
Installation steps:
1. Use mount -o loop windows.iso /mnt to mount windows.iso in folder /mnt, so you can access files in windows.iso;
2. Use cp -pr /mnt/* /path/to/sda4/mount/folder to copy all windows installation to a new partition;
3. Edit GRUB menu:

# Add the following to /boot/grub/grub.cfg
   menuentry "Windows 10" {
       insmod part_gpt
       insmod ntfs
       insmod search_fs_uuid
       insmod chain
       search --fs-uuid --no-floppy --set=root partition-uuid
       chainloader (${root})/efi/boot/bootx86.efi
   }

Note: The above example is for GPT partition table with UEFI boot program, if you are using MBR partition table, you should change /efi/boot/bootx86.efi to /bootmgr and change insmod part_gpt to insmod_msdos.
4. After the above steps, you should be able to see a Windows 10 boot entry in GRUB menu. Just following the installation guide as usual.
5. After installing Windows, you may be unable to see GRUB boot menu again, so you may need to fix it.
Another
Boot from Windows 7 from grub2(windows 7.iso is extracted to a partition, USB disk in this case)

    insmod part_msdos
    insmod ntfs
    insmod ntldr
    set root='(hd0,msdos1)'
    search --no-floppy --fs-uuid --set=root 1EA0019AA0017A13
    ntldr ($root)/bootmgr

You can get UUID using ls -l

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章