September 22, 2018

Creating Windows 7 install USB stick from Debian

1. Format USB stick to fat32 (for example, in GParted)

2. Mount it, note mount point (for example, /media/user/BF09-F91C)

3. Create empty folder "boot" (/media/user/BF09-F91C/boot)

4. Run command in terminal:
sudo grub-install --target=i386-pc --recheck --boot-directory={path to boot folder} {USB device}
(sudo grub-install --target=i386-pc --recheck --boot-directory=/media/user/BF09-F91C/boot /dev/sdb)

5. Run command in terminal:
sudo grub-mkconfig -o {path to boot folder}/grub/grub.cfg
(sudo grub-mkconfig -o /media/user/BF09-F91C/boot/grub/grub.cfg)

6. Edit grub.cfg, replace all contents with the following:

menuentry 'Windows 7 Installer' --class windows --class os {
set root=(hd0,1)
insmod part_msdos
insmod fat
insmod ntldr
ntldr /bootmgr
}

7. Extract Win7.iso into USB stick
(note, that "boot" folder exists in Win7 install as well, give your blessing to overwrite)

Source: https://gist.github.com/iamnotstanley/44424739081cb946589af999ea2bdcea

No comments: