Secured by Comodo InstantSSL

ServerFlux – Securing the Internet

Server Administration, Internet Security and Tutorials

Create a USB Installation of Windows from Linux

The situation arose the other day where I was faced with the situation of not having access to a windows box. All I had at my disposable was a Debian box. This tutorial will show you how to create a USB installation of MSDOS – up until Windows 7.

Firstly you will need to a USB pen (for Windows 7, you should have a pen sizing 4GB or above) and you should format it using FAT32 (for older versions of Windows) or NTFS (for newer versions e.g. XP, Vista, 7 etc.).

Once the drive has been formatted, we will need access to a disc image (iso) of the operating system or alternatively a CD / DVD. Copy all the contents of the root of the CD onto the root of the USB Drive. For example in Linux:

cp /mount/cdrom/* /mount/usbdrive

Now we need to write a MBR to the USB Drive, in this tutorial we will use a utility called “ms-sys”:

 cd /tmp
wget http://downloads.sourceforge.net/project/ms-sys/ms-sys%20stable/2.2.1/ms-sys-2.2.1.tar.gz?r=http%3A%2F%2Fms-sys.sourceforge.net%2F&ts=1323440650&use_mirror=netcologne -o ms-sys-2.2.1.tar.gz
tar zxvf ms-sys-2.2.1.tar.gz
cd ms-sys-2.2.1
make
make install

We will now use the utiltiy to write the Windows 7 MBR to the USB Drive:

ms-sys -7 /dev/usbdrive

This should take a few seconds and upon finishing, restart your PC (make sure you enable USB boot within your BIOS and change the boot priority accordingly) and the Windows 7 setup should start! :)

As mentioned earlier in the tutorial, this can be applied to various different Microsoft operating systems, see below for a full list of supported OS’s:

Usage:
	ms-sys [options] [device]
Options:
    -1, --fat12     Write a FAT12 floppy boot record to device
    -2, --fat32nt   Write a FAT32 partition NT boot record to device
    -3, --fat32     Write a FAT32 partition DOS boot record to device
    -4, --fat32free Write a FAT32 partition FreeDOS boot record to device
    -5, --fat16free Write a FAT16 partition FreeDOS boot record to device
    -6, --fat16     Write a FAT16 partition DOS boot record to device
    -l, --wipelabel Reset partition disk label in boot record
    -p, --partition Write partition info (hidden sectors, heads and drive id)
                    to boot record
    -H, --heads  Manually set number of heads if partition info is written
    -7, --mbr7      Write a Windows 7 MBR to device
    -i, --mbrvista  Write a Windows Vista MBR to device
    -m, --mbr       Write a Windows 2000/XP/2003 MBR to device
    -9, --mbr95b    Write a Windows 95B/98/98SE/ME MBR to device
    -d, --mbrdos    Write a DOS/Windows NT MBR to device
    -s, --mbrsyslinux    Write a public domain syslinux MBR to device
    -z, --mbrzero   Write an empty (zeroed) MBR to device
    -f, --force     Force writing of boot record
    -h, --help      Display this help and exit
    -v, --version   Show program version
    -w, --write     Write automatically selected boot record to device

    Default         Inspect current boot record

Warning: Writing the wrong kind of boot record to a device might
destroy partition information or file system!
 

Comments

No comments so far.

Leave a Reply

 
(will not be published)