Wednesday, March 24, 2010

Running Windows 2008 (runtime) off a USB Drive Without VHD


This post describes installing MS-Windows 2008 on a USB Drive without the help of a Virtual Hard Drive (VHD). In an earlier post I described how to do this WITH a VHD.

Installing windows onto a USB device requires quite some steps. In what situations this is possible I cannot say, but it obviously works in some.

Below is a description of a Windows 7 installation setting up a new USB HardDisk with "Hyper-V Windows Server 2008 R2".
Let's take every single step into account.

(Intermezzo's are used to show errors you would get when skipping steps. One of them is important.)

Assumptions
Your USB HDD drive letter is going to be "U:".
Your DVDDrive has drive letter "V:".
You have administrator rights.

Tools needed
Your Windows Installation Disk.
BootSect.exe (can be found in the "Boot" directory of your windows install disk).
Windows Automated Installation Kit (WAIK) (Needed for ImageX).

Steps
1 - You will need access to the BIOS setup.
Make sure that your BIOS supports booting into a USB device.

2 - If you've got a brand new drive, you will need to initialize it. You can do this in Window's Disk Management tool, which is available in all windows versions.

Make sure you choose for NTFS. Give it a drive letter (we need it later). For the rest of this tutorial, I will assume drive letter "U:".

INTERMEZZO:
Trying to boot from the USB Drive will now give the following error.

Non-System disk or disk error.
Replace and strike any key when ready.

3 - Make sure the partition on the USB HDD that you wish to install in is Active. You can do this in de Windows Disk Management.
(This step got me going for a while……)
Note that the option to mark the partition as active will be greyed out if the partition is active by default.





















4. Install WAIK. You should now have three "ImageX" executables (one for AMD64, one for Intel64, and one for 32 bits.) These can be found in C:\Program Files\Windows AIK\Tools.

NOTE: For me the only one working was the AMD version, although I have an Intel T5500 processor !!?!??!?!

5 - Open an elevated command prompt.
Go to the correct WAIK directory for your machine.
Type the following command (DO NOT FORGET THE DRIVELETTER:)

BootSect /nt60 U:

Note the colon.
(Bootsect.exe updates the master boot code for hard disk partitions to switch between BOOTMGR and NTLDR.)

Leave the CMD open. We'll need it again later.

IMPORTANT
We need to make sure that your machine can actually boot into the USB Drive before we continue. Make sure the USB Drive is the first to boot so that a automatic restart will go back to the USB Drive.

Try it now, and make sure you get the following error when rebooting your machine. After that, boot back into windows so you can continue with this tutorial.


INTERMEZZO:
Trying to boot from the USB Drive will now give the following error.

BOOTMGR is missing.
Press Ctrl+Alt+Del to restart.


INTERMEZZO:
If you were now trying to install Windows onto the USB Drive, you would receive the following error:












6 - In de Elevated CMD run the following:

imagex /info V:\sources\install.wim

This will show you all the entries (or versions) available in the WIM-file; Hyper-V Server 2008 R2 has only one entry; it will have "index 1". No changes have been made yet.

Remember that V: was assumed to be the drive letter of your DVD Drive (where the Windows Install disk lives).

With the previously found index number, run the following:

imagex /apply /check /verify V:\sources\install.wim 1 U:

This step takes a while, and will place a complete image of the Windows version you want to install onto the USB drive.

7 - Boot files
Let's copy the necessary boot file to the USB Drive (use the elevated DOS prompt again):

bcdboot U:\Windows /s U: /v

(Note: if this fails it may help to disconnect and reconnect the USB Drive.)

8 - Clean up
You can now close the CMD where you ran BcdBoot.

Remove your Windows Install disk from the drive. It is no longer needed.

Reboot the machine, and make sure the FIRST boot device is the USB Drive. Windows may want to reboot a few times, and it would be annoying if it would boot into the wrong version.

Boot into the USB Drive and see the magic happen.

Thursday, March 11, 2010

Running Windows 7 / 2008 (runtime) off a USB Drive using a VHD


This post describes installing MS-Windows 7 or MS-Windows 2008 on a USB Drive with help of a Virtual Hard Drive (VHD). In a later post I describe how to do this WITHOUT a VHD (which is easier for Windows 2008 but more complex for Windows 7).

Installing MS-Windows 7 or MS-Windows 2008 onto a USB device requires quite some steps. In what situations this is possible I cannot say, but it obviously works in some.

Below is a description of a Windows 7 installation setting up a new USB HardDisk with "Hyper-V Windows Server 2008 R2".
Let's take every single step into account.

(Intermezzo's are used to show errors you would get when skipping steps. One of them is important.)

Assumptions
Your USB HDD drive letter is going to be "U:".
Your DVDDrive has drive letter "V:".
You have administrator rights.

Tools needed
Your Windows Installation Disk.
BootSect.exe (can be found in the "Boot" directory of your windows install disk).
Windows Automated Installation Kit (WAIK) (Needed for ImageX).

Steps
1 - You will need access to the BIOS setup.
Make sure that your BIOS supports booting into a USB device.

2 - If you've got a brand new drive, you will need to initialize it. You can do this in Window's Disk Management tool, which is available in all windows versions.

Make sure you choose for NTFS. Give it a drive letter (we need it later). For the rest of this tutorial, I will assume drive letter "U:".

INTERMEZZO:
Trying to boot from the USB Drive will now give the following error.

Non-System disk or disk error.
Replace and strike any key when ready.

3 - Make sure the partition on the USB HDD that you wish to install in is Active. You can do this in de Windows Disk Management.
(This step got me going for a while……)
Note that the option to mark the partition as active will be greyed out if the partition is active by default.





















4. Install WAIK. You should now have three "ImageX" executables (one for AMD64, one for Intel64, and one for 32 bits.) These can be found in C:\Program Files\Windows AIK\Tools.

NOTE: For me the only one working was the AMD version, although I have an Intel T5500 processor !!?!??!?!

5 - Open an elevated command prompt.
Go to the correct WAIK directory for your machine.
Type the following command (DO NOT FORGET THE DRIVELETTER:)

BootSect /nt60 U:

Note the colon.
(Bootsect.exe updates the master boot code for hard disk partitions to switch between BOOTMGR and NTLDR.)

Leave the CMD open. We'll need it again later.

IMPORTANT
We need to make sure that your machine can actually boot into the USB Drive before we continue. Make sure the USB Drive is the first to boot so that a automatic restart will go back to the USB Drive.

Try it now, and make sure you get the following error when rebooting your machine. After that, boot back into windows so you can continue with this tutorial.


INTERMEZZO:
Trying to boot from the USB Drive will now give the following error.

BOOTMGR is missing.
Press Ctrl+Alt+Del to restart.


INTERMEZZO:
If you were now trying to install Windows onto the USB Drive, you would receive the following error:












6 - Now things get complicated.
First we are going to create a VHD in which we can place an Image of the Windows version we want to install. In this tutorial I will call this Image.VHD. Note that this VHD is also the one that will eventually be used for new Windows Install. Make sure it's big enough, or make its size dynamic. (I've used fixed for my test, but I intend to change that). For permanent use I would recommend a name like "Win2K8R2_Image.VHD".

In the CMD we still have open:

Diskpart
(Starts the disk management CMD-utility)

create vdisk file=U:\Image.vhd maximum=14500 type=fixed
(This creates a VHD on the USB Drive with the size 14500 MB. As this file will later hold the actual Windows Version, it should be placed on the USB device, where it can be found by the boot manager. (This step will take a few minutes.)

select vdisk file=U:\Image.vhd
(Selects the created disk)

attach vdisk
(Attaches it so Windows can see it)

list disk
(Shows you all the disks in the system, note the number of your newly created VHD)

select disk disknumber
(Selects the newly created VHD)

create partition primary
(Creates a primary partition)

select partition 1
(Selects the primary partition)

active
(Sets it to active)

format fs=ntfs quick
(Format it with NTFS and do it quick)

assign
(Assigns a driveletter)

list volume
(Note the driveletter the new drive got!)

Leave DiskPart open and start a new CMD with administrative rights.
Please take note of the DriveLetter assigned. This will be referred to as "vhddrive:" from now on.

7 - In de Elevated CMD run the following:

imagex /info V:\sources\install.wim

This will show you all the entries (or versions) available in the WIM-file; Hyper-V Server 2008 R2 has only one entry; it will have "index 1". No changes have been made yet.

Remember that V: was assumed to be the drive letter of your DVD Drive (where the Windows Install disk lives).

With the previously found index number, run the following:

imagex /apply V:\sources\install.wim 1 vhddrive:

This step takes a while, and will place a complete image of the Windows version you want to install into the VHD.

8 - Boot files
Let's copy the necessary boot file from the new VHD to the USB Drive:

bcdboot vhddrive:\Windows /s U: /v

9 - Clean up
You can now close the CMD where you ran BcdBoot.
Go back to the CMD with DiskPart, en run:

detach vdisk

Exit

Close the CMD Window.

Remove your Windows Install disk from the drive. It is no longer needed. The created VHD will be used for installing Windows.

Reboot the machine, and make sure the FIRST boot device is the USB Drive. Windows may want to reboot a few times, and it would be annoying if it would boot into the wrong version.

Boot into the USB Drive and see the magic happen.

Friday, March 5, 2010

Credibility

I was more than surprised to see someone disbelieving a rather very interesting post, with quality content, because he ONLY HAD 6 COMMENTS. Unbelievable but true. Credibility is rated by the number of comments on a post. This a particularly awkward for new posts, as by definition new posts have ZERO COMMENTS. Oh dear.... should we start commenting on our own posts in order to attract attention?

Would the content of the comments matter?

Great post!
by Adje

Wonderfully put
by Frank

Experienced the very same thing!
by ScreenMan

Are you kidding me?
by TheDude