|
 |
[Tutorial] Boot Windows 7 from USB hard disk by karyonix |
|
|
|
Sep 25 2009, 11:40 PM
|
|
|
From this thread --> http://www.boot-land.net/forums/index.php?showtopic=9051Install in IDE/SATA disk and move to USB- Attach IDE/SATA disk to computer
You can create a new partition and mark it as active partition before boot from Windows 7 DVD - Boot from Windows 7 setup DVD (or other media),
create a partition in SATA (if not already created), use diskpart to mark partition as active (if it is not the only partition in the computer), install Windows 7 - Boot from SATA disk into new Windows 7
- Run cmd as administrator
CODE bcdedit /set {default} detecthal on - Run usbbootfix.bat as administrator
usbbootfix.bat ( 1.4K )
Number of downloads: 5497
- (optional)
If you want to move USB Windows to other machine, make sure target machine's hard disk controller driver is loaded at boot time (Start=0). If you are not sure which drivers you will use and want ALL preinstalled hard disk controller driver to be loaded at boot time, run this StorageBootStart.bat as administrator. Don't use it unnecessarily. It will increase boot time.
StorageBootStart.bat ( 1.4K )
Number of downloads: 1620
- Shutdown.
- Put SATA disk in USB SATA disk enclosure
or clone Windows 7 to USB disk. - Boot from USB disk
When Windows detect new hardware and install drivers automatically, it will also run usbbootfix.bat automatically. If you install USB drivers (or motherboard or chipset drivers) by other ways, you should run usbbootfix.bat again before shutdown or reboot.
Note: This "simple" cloning procedure use xcopy command which does not know about hard link. All hard links become multiple regular files and use more disk space than source. It may be better to use other programs that can create hard link in destination. Cloning Windows 7 from IDE/SATA/VHD disk to USB disk Don't use running Windows as source drive. - Attach target disk to computer.
- Create partition in target disk and format (if not already exists). Mark as active partition.
- If source BCD is not in source Windows partition, manually copy bootmgr and BCD to target partition.
- Save clone7.bat it in a directory.
(modified 2009-12-24)
CODE @echo off setlocal rem Source drive, Destination drive set src=S: set dst=T: set bcddrive=%dst%
echo List of files to be copied xcopy %src%\ %dst%\ /exclude:%~dp0\cloneexclude.txt /e /c /i /h /k /x /y /b /l echo Copy files from %src% to %dst% xcopy %src%\ %dst%\ /exclude:%~dp0\cloneexclude.txt /e /c /i /h /k /x /y /b /w
echo Make sure boot manager are not compressed. compact /u %dst%\bootmgr %dst%\ntldr %dst%\grldr.* %dst%\menu.lst
echo Adjust \DosDevices\C: value set dstsignature= for /f "skip=2 tokens=1,2,*" %%I in ('reg query HKLM\SYSTEM\MountedDevices /v \DosDevices\%dst%') do ( set dstsignature=%%K ) reg load HKLM\systemdst %dst%\Windows\system32\config\system reg add HKLM\systemdst\MountedDevices /v \DosDevices\C: /t REG_BINARY /d %dstsignature% /f reg query HKLM\systemdst\MountedDevices /v \DosDevices\C: reg unload HKLM\systemdst
bcdboot %dst%\Windows /s %bcddrive%
endlocal - Write names of unwanted files and directories in cloneexclude.txt and save in the same directory.
CODE :\RECYCLER :\$Recycle.Bin :\System Volume Information :\PerfLogs :\hiberfil.sys :\pagefile.sys :\bootstat.dat \Temp\ \Temporary Internet Files\ - Open cmd.exe running as SYSTEM account.
- Boot from Windows 7 DVD and press Shift+F10 to run cmd.exe.
or - from another Windows Vista/7 (not on source partition)
Get Sysinternal PsExec. Unzip PsExec.exe. Create shortcut systemcmd.
CODE psexec.exe -s -i -d cmd When you run this shortcut as administrator, it will open cmd.exe running as SYSTEM account. You can increase its screen buffer size by right-click title bar, select Properties, Layout page.
- Open clone7.bat in notepad or other text editor.
Set appropriate value for src and dst in clone7.bat. If dst is in VHD, set bcddrive to active partition of the host disk containing dst. - run clone7.bat from cmd.exe running as SYSTEM account.
Verify that source and destination drive are correct and press a key to start copy. - Shutdown
Another way to install. This is not preferred way to install, just another possibility. Install in VHD by using virtual machine (Windows Virtual PC or VirtualBox) Note : Not all editions of Windows 7 support native-boot VHD. Only Windows 7 Enterprise and Ultimate (including Release Candidate) support native-boot VHD. - Create partition in USB disk (U:), format, make it active partition.
- Use Disk Management or Diskpart to Create VHD image, size 15GB or more.
- In Windows Virtual PC folder or VirtualBox, create virtual machine RAM 1GB or more
- Attach VHD and Windows 7 DVD or ISO to virtual machine
- Start virtual machine, boot from DVD, install Windows 7
- Copy usbbootfix.bat to VHD (by network share or mount VHD in host).
- In virtual machine, run usbbootfix.bat as administrator
- Shutdown virtual machine.
- In Disk Management in Windows 7 host, attach VHD.
- If you just want to use VHD as source for cloning to USB disk, skip the following steps and goto Cloning Windows 7 above.
If you want to native-boot VHD, adjust BCD entry for native-boot VHD with the following steps. - Let's assume USB disk partition is U: and Windows partition in U:\name.vhd is V: in host computer
- (modified 2009-12-24)
Copy bootmgr and Boot directory from V:\ to U:\ Run cmd as administrator in host bcdedit /store U:\Boot\BCD /set {default} device partition=V: bcdedit /store U:\Boot\BCD /set {default} osdevice partition=V: bcdedit /store U:\Boot\BCD /set {default} detecthal on Run cmd as administrator in host
CODE bcdboot V:\Windows /s U: - detach VHD from host
- boot from VHD in USB
|
12 user(s) said "Thank you!" to karyonix for this fantastic post: chipp7, edborg, Exception e, iaracy, ktp, Marietto2009, Nuno Brito, operat0r, oriensol, Shirin Zaban, strongline, wimb |
|
|
Sep 26 2009, 12:14 AM
|
|

|
|
Joined: 13-July 06
From: Pittsburgh
Posts: 8,638
Thank(s): 464
 Portugal

|
|
Excellent tutorial! But getting all these steps completed might take a good while..  Any chances of automating the build with a wb project? Virtualbox is fairly easy to manage from command line and perhaps even the install procedure could be completely automated as well.
--------------------
|
2 user(s) said "Thank you!" to Nuno Brito for this fantastic post: edborg, Exception e |
|
|
Oct 1 2009, 10:12 PM
|
|
|
Really easy to follow tutorial, Many Thanks. I used the first option 'Install in IDE/SATA disk and move to USB' and then cloned the hard drive image to a usb drive using ghost. Works perfectly, thanks again.
|
|
|
|
Oct 9 2009, 06:48 AM
|
|
|
|
Excellent tutorial mate. And it works. Ive been hoping to achieve this for a long time, and now my dreams are reality. Ive actually booted my Windows 7 drive on 3 different PC's now, all with success. A Truly "portable" Windows Installation.
Thankyou very much.
|
|
|
|
Nov 10 2009, 06:24 PM
|
|
|

|
|
Joined: 16-February 07
Posts: 653
Thank(s): 37

|
|
|
I tried this method, and it boots correctly on one laptop, but on another, I get BSOD ! I have to disable the automatic reboot since the blue screen disappears too quickly,.
For information: Instead of installing on a real computer, I installed Windows 7 under VMware, then I run the usbootfix.bat and shutdown, then I take the disk image with DriveSnapshot (similar to Ghost), then I restore the image to an USB HDD and boot from it.
|
|
|
|
Nov 11 2009, 06:46 AM
|
|
|

|
|
Joined: 16-February 07
Posts: 653
Thank(s): 37

|
|
OK after disabling the automatic reboot, I saw that the BSOD is with the dreaded stop code 0x7B. I am familiar with this, so on the laptop that boots fine, I just applied my great old usb_all.reg that changes important USB-related registry entries (usbehci, usbohci, usbuhci, usbccgp, usbhub, USBSTOR). Afterwards, now Windows 7 boots fine on both laptops from USB HDD ! Note that depending on the hardware, you are asked to reboot once to update the ACPIPIC/ACPIAPIC device (other drivers like network, sound... are already automatically searched and installed). So this is not 100% "portable" as with my current XP booting from USB HDD using usboot from usboot.org. The method of usb_all.reg applied for Vista too already, so there is nothing new. usbwatcher.exe method seemingly tries to set to right values in registry, and karyonix's method seems to create a planned job that does same thing at initial boot time. I don't know why it does not work in my case. Anyhow, to be sure, before any reboot, and especially after Windows update or driver update or USB plug-and-play, remember to apply usb_all.reg. This ensures that no BSOD 0x7B is hit on next boot. If ever you still get it, you have to offline change the registries (using RegEditPE or RegistryLoaderPE ) for these USB-related values (in fact the important key is Start which must be set to 0, usually we got BSOD 0x7B because Windows resets it to 3). Here is usb_all.reg content: CODE Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbccgp] "DisplayName"="Microsoft USB Generic Parent Driver" "Group"="Boot bus extender" "ImagePath"=hex(2):5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\ 74,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,64,00,72,\ 00,69,00,76,00,65,00,72,00,73,00,5c,00,75,00,73,00,62,00,63,00,63,00,67,00,\ 70,00,2e,00,73,00,79,00,73,00,00,00 "ErrorControl"=dword:00000001 "Start"=dword:00000000 "Type"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbccgp\Enum] "0"="Root\\LEGACY_USBCCGP\\0000" "Count"=dword:00000001 "NextInstance"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbehci] "DisplayName"="Microsoft USB 2.0 Enhanced Host Controller Miniport Driver" "Group"="Boot bus extender" "ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\ 52,00,49,00,56,00,45,00,52,00,53,00,5c,00,75,00,73,00,62,00,65,00,68,00,63,\ 00,69,00,2e,00,73,00,79,00,73,00,00,00 "ErrorControl"=dword:00000001 "Start"=dword:00000000 "Type"=dword:00000001 "Tag"=dword:00000019
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbehci\Enum] "0"="PCI\\VEN_8086&DEV_24CD&SUBSYS_001F1025&REV_03\\3&18d45aa6&0&EF" "Count"=dword:00000001 "NextInstance"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbhub] "DisplayName"="Microsoft USB Standard Hub Driver" "Group"="Boot bus extender" "ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\ 52,00,49,00,56,00,45,00,52,00,53,00,5c,00,75,00,73,00,62,00,68,00,75,00,62,\ 00,2e,00,73,00,79,00,73,00,00,00 "ErrorControl"=dword:00000001 "Start"=dword:00000000 "Type"=dword:00000001 "Tag"=dword:0000001b
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbhub\Performance] "Library"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\ 74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,75,\ 00,73,00,62,00,70,00,65,00,72,00,66,00,2e,00,64,00,6c,00,6c,00,00,00 "Open"="OpenUsbPerformanceData" "Close"="CloseUsbPerformanceData" "Collect"="CollectUsbPerformanceData" "InstallType"=dword:00000001 "PerfIniFile"="usbperf.ini" "First Counter"=dword:00000d60 "Last Counter"=dword:00000d82 "First Help"=dword:00000d61 "Last Help"=dword:00000d83
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbhub\Enum] "0"="Root\\LEGACY_USBHUB\\0000" "Count"=dword:00000005 "NextInstance"=dword:00000005 "1"="USB\\ROOT_HUB\\4&b71b443&0" "2"="USB\\ROOT_HUB\\4&1b0914a3&0" "3"="USB\\ROOT_HUB\\4&33f1b84&0" "4"="USB\\ROOT_HUB20\\4&dd5a51b&0"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbohci] "DisplayName"="Microsoft USB Open Host Controller Miniport Driver" "Group"="Boot bus extender" "ImagePath"=hex(2):5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\ 74,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,64,00,72,\ 00,69,00,76,00,65,00,72,00,73,00,5c,00,75,00,73,00,62,00,6f,00,68,00,63,00,\ 69,00,2e,00,73,00,79,00,73,00,00,00 "ErrorControl"=dword:00000001 "Start"=dword:00000000 "Type"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbohci\Enum] "0"="Root\\LEGACY_USBOHCI\\0000" "Count"=dword:00000001 "NextInstance"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR] "DisplayName"="USB Mass Storage Driver" "ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\ 52,00,49,00,56,00,45,00,52,00,53,00,5c,00,55,00,53,00,42,00,53,00,54,00,4f,\ 00,52,00,2e,00,53,00,59,00,53,00,00,00 "ErrorControl"=dword:00000001 "Start"=dword:00000000 "Type"=dword:00000001 "Group"="Boot bus extender" "Tag"=dword:00000008
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Enum] "0"="Root\\LEGACY_USBSTOR\\0000" "Count"=dword:00000002 "NextInstance"=dword:00000002 "1"="USB\\VID_067B&PID_2506\\0"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbuhci] "DisplayName"="Microsoft USB Universal Host Controller Miniport Driver" "Group"="Boot bus extender" "ImagePath"=hex(2):73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,44,00,\ 52,00,49,00,56,00,45,00,52,00,53,00,5c,00,75,00,73,00,62,00,75,00,68,00,63,\ 00,69,00,2e,00,73,00,79,00,73,00,00,00 "ErrorControl"=dword:00000001 "Start"=dword:00000000 "Type"=dword:00000001 "Tag"=dword:00000018
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbuhci\Enum] "0"="PCI\\VEN_8086&DEV_24C2&SUBSYS_001F1025&REV_03\\3&18d45aa6&0&E8" "Count"=dword:00000003 "NextInstance"=dword:00000003 "1"="PCI\\VEN_8086&DEV_24C4&SUBSYS_001F1025&REV_03\\3&18d45aa6&0&E9" "2"="PCI\\VEN_8086&DEV_24C7&SUBSYS_001F1025&REV_03\\3&18d45aa6&0&EA"
|
|
|
|
Nov 20 2009, 10:18 PM
|
|
|
|
As I am definitely a noob on this subject, please bear with me while I ask some very basic “stupid” questions which must be self-explantory for most of you…but I seem to be missing the big picture. My apologies in advance….here I go:
1) Install in IDE/SATA disk and move to USB a. At the end of step 7 in these set of procedures, we have installed Win 7 on a physical SATA drive. b. Now, our next objective in Part 2 below will be to clone our SATA drive installation of Win 7 to a USB external disk {I’m thinking out loud here} 2) Cloning Windows 7 from IDE/SATA/VHD disk to USB disk a. At the end of step 9 of these set of procedures, we have completed cloning our physical SATA HDD to an external USB HD. 3) Install in VHD by using virtual machine a. Step 1 in this set of procedures says to “Create partition in USB disk (U:), format, make it active partition.” Here is where, my confusion begins….Are we creating a partition on the same external USB HD that was just cloned from a SATA physical HDD in Part 2 above ? Or are we introducing a 2nd USB HD here ? Why do we have to create a separate partition here ? We already have a full clone of our Win 7 from the SATA HD, why do we now need to create a separate partition ? What are we trying to achieve in this part ? b. Where is the VHD supposed to be created ? On the new U: partition of the USB HD ? c. Step 3 says to “In Windows Virtual PC folder or VirtualBox, create virtual machine RAM 1GB or more”. Where does this Virtual PC folder live ? On the host machine or on the USB HD ? If on the USB HD, then is this folder inside the new U: partition of the USB HD ?
|
|
|
|
Nov 21 2009, 02:03 AM
|
|
|
QUOTE (Uncle_HQ @ Nov 21 2009, 05:18 AM)  2) a. At the end of step 9 of these set of procedures, we have completed cloning our physical SATA HDD to an external USB HD. After step9 is completed, you can boot computer from that USB disk. QUOTE (Uncle_HQ @ Nov 21 2009, 05:18 AM)  3) a. Here is where, my confusion begins….Are we creating a partition on the same external USB HD that was just cloned from a SATA physical HDD in Part 2 above ? Or are we introducing a 2nd USB HD here ? No. No. After part2 is completed, your USB disk is ready for booting. Part3 is just another story, another way to install. The tutorial above is updated to prevent new readers from this confusion. QUOTE (Uncle_HQ @ Nov 21 2009, 05:18 AM)  3) b. Where is the VHD supposed to be created ? On the new U: partition of the USB HD ? Yes, if you want to boot from Windows in VHD in USB disk instead. You can also create it in SATA disk first, and copy to USB disk later. QUOTE (Uncle_HQ @ Nov 21 2009, 05:18 AM)  Where does this Virtual PC folder live ? If you use Windows Virtual PC, you can open it from Star Menu - All Programs - Windows Virtual PC - Windows Virtual PC. It opens "%userprofile%\Virtual Machines" folder that contains list of your virtual machines. You can create new virtual machine from a toolbar button of that folder.
|
|
|
|
Nov 21 2009, 08:42 PM
|
|
|
Thanks for the clarifications. I have another stupid question  , as I am new to Windows 7. In step 12, Under Install in VHD by using virtual machine (Windows Virtual PC or VirtualBox), we are told to "Copy bootmgr and Boot directory from V:\ to U:\". Is bootmgr a directory under Windows or is it a filename ? I could not locate it on my Windows 7 partition under \Windows. Where exactly can I find this on my host Windows 7 partition ?In step 13, we are told to execute a series of cmds, "bcdedit /store U:\Boot\BCD ...." My boot directory under Windows, only has 4 sub directories, "DVD, EFI, Fonts, and PCAT". But command says to \Boot\BCD ? I don't see a BCD sub directory or and file named BCD under \Boot ? Am I missing something here ? Once again, my apologies for asking questions which are probably too obvious and basic for most people. Also, I noticed that Windows Virtual PC (64 bit version) does not allow you to create a 64 bit virtual machine installation of Windows 7 guest, even if your host machine is running on a x64 hardware & x64 OS. In my case, I want to create a 64 bit VHD of Win 7 Enterprise. So what I have done, is to take an existing 64 bit VHD installation of Win 7 which I created earlier (using my Win 7 Enterprise x64 DVD), and then applied the usbbootfix.bat to it, then shut down the VM, and attached it to my host Win 7 system using disk mgmt. I see no reason why this shouldn't work. Right ?
|
|
|
|
|
 |
8 User(s) are reading this topic ()
|
|