Thursday, March 6, 2014

A Simple Way to Create A Windows Installation USB on Linux

Sometime you might want to create a flash drive (USB drive) for installing Windows, but... on Linux. One of the simple way is to use UNetbootin. However, the recent versions of UNetbootin do not support NTFS partition anymore, and you just cannot create such a drive in usual way.

Fortunately, UNetbootin is not support NTFS partition in GUI only, it still work like a charm with the command line options.

Now, it is time to begin.

0. I assume that you have a ISO file of Windows 7 (or 8) Installation Disk (win7.iso, for example) and a flash drive with the capacity of at least 4GB (which is recognized as /dev/sdd, for example.) I also assume that you already have UNetbootin in your system.

1. First of all, creating a partition which is big enough for storing Windows installation packages. It should be larger than 3.2 GB. You can use any tool that you are familiar with, such as gparted, Disk Utility, etc. I use parted here for example.

$ sudo parted -s /dev/sdd mklabel msdos mkpart primary 1024KiB 4GiB print
$ sudo mkfs.ntfs -L WIN /dev/sdd1

2. Mount the created partition to a point in your system. If you use Genome, it should mount that partition automatically to /run/media/${USER}/WIN. If it is not the case, use the following command.

$ sudo mount /dev/sdd1 /mnt

3. Run the following command.

$ sudo unetbootin method=diskimage isofile=win7.iso targetdrive=/dev/sdd1

The GUI will be shown with all the options you need. Click OK.

Blah, blah, blah...