Create a bootable Window 7 installer usb disk on Debian 7








  1. You need to the Windows 7 ISO image file ready. e.g. Win7.ISO
  2. You need to install p7zip-full to extract the ISO image.
    sudo apt-get install p7zip-full
  3. You need to install ms-sys
  4. Plugin your USB disk and check its device name.
    sudo blkid
  5. Make a NTFS partition on the USB drive by using cfdisk, or gparted and apply boot flag to it.
  6. Format the USB partition,
    sudo mkfs.ntfs -n WIN7 /dev/sdX1
  7. Mount the partition by pulling off and re-plug in the USB drive or run
    mount /dev/sdX1 /media/USB
  8. Extract the ISO image to the mounted partition:
    cd /media/USB; 7z x /path/to/Win7.iso
  9. Run ms-sys to install the Window 7 boot sector:
    ms-sys -7 /dev/sdX
    Note: you need to install the boot sector to the USB drive's MBR, so you should use /dev/sdX NOT /dev/sdX1

See also




Remove grub boot sector from a partition








I accidentally installed grub boot sector onto partition /dev/sdc1 instead of /dev/sdc, which is wrong. To remove the boot sector from partition /dev/sdc1:
sudo dd if=/dev/sdc1 of=sdc1.bootsector bs=512 count=1
sduo dd if=/dev/zero of=/dev/sdc1 bs=512 count=1
The file sdc1.bootsector is a backup in case anything go wrong.


Install ms-sys on Debian








  1. Download ms-sys from http://ms-sys.sourceforge.net/#Download.
  2. Install required packages:
    sudo apt-get install build-essential gettext
    
  3. Extract the source, and compile, then install:
    cd /tmp; tar zxvf ~/Downloads/ms-sys-2.4.0.tar.gz; 
    cd /tmp/ms-sys-2.4.0
    make
    sudo make install
    

NOTE:

  • You need to install build-essential package to install the compilers.
  • You need to install gettext package to fix the error msgfmt: command not found