Before you start
Objectives: learn how to create USB installation source by using tools available on your PC.
Prerequisites: you have to have a Windows 7 installation DVD and a USB storage device with at least 4 GB of free space.
Key terms: command prompt, elevated mode, usb drive preparation, diskpart, diskpart commands, bootable usb drive, windows 7 installation, source
Procedure
Before we begin keep in mind that during this process USB flash drive will be completely erased, so we have to make sure that we save any data that it contains. In our example we have a Windows 7 installation DVD present in our D drive, and a USB flash drive available trough drive E, as shown on the picture.
Image 143.1 – Computer Drives
1. Open Command Prompt (CMD)
We will be working with Command Prompt in elevated mode. You can find CMD in: Start menu > All Programs > Accessories > Command Prompt. To open CMD in elevated mode, right-click on the Command Prompt and select ‘Run as administrator’. Click Yes to confirm.
Image 143.2 – Run CMD as Administrator
We know that we are running CMD in elevated mode because we have the ‘Administrator’ in the name of the CMD window.
Image 143.3 – Administrator: Command Prompt
2. Prepare USB drive
We will open the command line utility called diskpart, which is used to manage partitions and drives. To do that we will simply enter diskpart in CMD.
Image 143.4 – Diskpart
Next, we will enter: list disk. With this command we can view all the available disks on our computer.
Image 143.5 – List Disk
In our example, Disk 0 is the hard drive. We know that because the size of our internal hard disk is 40GB. The size of our USB flash drive is 4 GB (3875 MB to be more precise). To work with USB drive we need to select it. To do that, in our case, we have to type in: select disk 1.
Image 143.6 – Select Disk 1
After the selection we will clean the USB drive. We have to wipe out any partition information and anything on it. To do that we will type in: clean.
Image 143.7 – Clean
After the cleaning, notice that, if we browse to the Computer, our USB drive now changed. There is no info shown about the free space.
Image 143.8 – USB drive in Windows Explorer
Now we need to create the partition on our USB drive. To do that, in Command Prompt we will enter:create partition primary.
Image 143.9 – Create Partition Primary
After that we will format our new partition with the FAT32 as our file system. To do that we will enter:format fs=fat32 quick.
Image 143.10 – Format
Now, we need to mark our new partition as active. To do that we will enter: active.
Image 143.11 – Active
Now we have a USB drive with an active partition. To use it as the installation source we also have to make it bootable. As we will see, we will run the bootsect command to copy the boot manager information, that Windows 7 requires to perform the install, to our USB drive. Then we will have to copy the entire content of the Windows 7 DVD to the USB drive. To do all that, first we need to exit from Diskpart. In CMD enter: exit.
Image 143.12 – Exit
In our example, Windows 7 installation DVD is in the D drive. In the D drive, in the folder called ‘Boot’, there is a program called ‘bootsect‘. We will run it with the ‘/NT60‘ parameter and we will also specify the drive letter of our USB drive. This will copy the the boot manager files to our USB drive. The command, in our case, looks like this: d:\boot\bootsect /NT60 e:.
Image 143.13 – Bootsect
As we can see, our E drive was updated with all the necessary boot manager information that Windows 7 needs to boot of the USB drive.
3. Copy DVD Content to USB Drive
The last step is to copy all files from the Windows 7 DVD to our USB drive.
Image 143.14 – Copy Content From DVD to USB
Once the copy is complete, our USB drive is ready for use. Of course, on the computer on which we want to perform the installation, we have to go to the BIOS and make sure that the USB device is selected to boot from. After that the installation will be the same as if we were installing from a DVD.
Remember
Command Prompt must be in elevated mode (right-click on the Command Prompt and select ‘Run as administrator’). To manage partitions and drives in CMD we use diskpart. We have to make our USB drive bootable, after which we have to copy all content from the Windows 7 installation DVD to the USB drive.
Paths that are mentioned in this article
- Command Prompt: Start menu > All Programs > Accessories > Command Prompt
Commands that are mentioned in this article
In Command Prompt:
- diskpart– run diskpart utility which is used to manage partitions and drives using command line.
Diskpart specific commands:
- list disk – view available disks on the computer
- select disk [number] – select disk on which you want to work on (example: select disk 1)
- clean – wipe out all data and any partition information on selected disk
- create partition primary – create primary partition on selected disk
- format fs=fat32 quick – format selected disk in quick mode using FAT32 file system
- active – mark partition as active on selected disk
- exit – exit diskpart
In Command Prompt:
- [DVD drive:]\boot\bootsect /NT60 [USB drive:] – copy boot manager files from Windows 7 installation DVD to the USB drive to make it bootable (example: d:\boot\bootsect /NT60 e:).