Jump to content











Photo
* * * * * 2 votes

[Tutorial] Boot Windows 7 from USB hard disk by karyonix


  • Please log in to reply
171 replies to this topic

#26 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 01 December 2009 - 01:22 PM

Any ideas...otherwise, I will have to throw in the towel, until I can get my hands on another 16 GB USB stick.

Sticks are, generally speaking, "slow".

USB, even USB 2.0 is "slow" for the sizes you mention.
Even if you get the full throughput (which you won't) of 480Mbps, it will take ages, as it tops at around 60 MB/s, comparable roughly to an old ATA 66 drive.

In reality a USB device device RARELY get's up to 20MB/s, 10 to 15 being an average result:
http://www.forensicf...m...opic&t=2035

Here is a sample of a comparison (just to have an idea):
http://www.testfreak...d-and-compared/
http://www.testfreak...no-labels-2.jpg

If you are used to a "normal" SATA II drive, it probably provides a throughput around or over the 150 MB/s mark, which is about 10 times faster, and besides your drive will have NCQ (Native Command Queing) that will speed up things a lot.

We need USB 3.0:
http://en.wikipedia....ial_Bus#USB_3.0

:clap:

jaclaz

#27 edborg

edborg

    Frequent Member

  • .script developer
  • 387 posts
  •  
    Italy

Posted 02 December 2009 - 10:25 PM

Following this tutorial, I succeeded in booting Windows 7 Ultimate from an USB partition, but failed the VHD native-boot. :clap:

These are the steps I followed after attaching the VHD to the (Vista) host with VHDMount:

.......
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
[*] 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

[*] detach VHD from host
[*] boot from VHD in USB

At boot I got a 0xc000000e error, required device not accessible.

I then tried other variants such as:
bcdedit /store U:\Boot\BCD /set {default} device file=[V:]\nameofvhd.vhd
....
and
bcdedit /store U:\Boot\BCD /set {default} device file=[C:]\nameofvhd.vhd
....
and
bcdedit /store U:\Boot\BCD /set {default} device file=[locate]\nameofvhd.vhd
....
to no avail.
Substituting "vhd" to "file" caused syntax error.

Thanks for any suggestion helping me understand what went wrong.

edborg

#28 wimb

wimb

    Gold Member

  • Developer
  • 2281 posts
  •  
    Netherlands

Posted 03 December 2009 - 11:23 AM

Following this tutorial, I succeeded in booting Windows 7 Ultimate from an USB partition, but failed the VHD native-boot. :clap:

These are the steps I followed after attaching the VHD to the (Vista) host with VHDMount:

Try to attach VHD to Windows 7 host.
I think this option is not available for Vista. :clap:

#29 edborg

edborg

    Frequent Member

  • .script developer
  • 387 posts
  •  
    Italy

Posted 03 December 2009 - 11:46 AM

Try to attach VHD to Windows 7 host.
I think this option is not available for Vista. :clap:

Thanks for your suggestion, that however would be difficult for me to follow as unfortunately I don't have a Windows 7 host ... apart from the one just created on USB, that was personalised for the PC where it was installed first, that I don't have available now. :clap:

I'm confused, however. :cheers:
I had understood that the limitation to native-boot applies to the OS within the VHD (that must be Windows 7 Enterprise or Ultimate), not to the one installed on the host machine, as when natively booting there's no host.
Or am I wrong?
edborg

#30 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 453 posts
  •  
    Thailand

Posted 03 December 2009 - 02:18 PM

Vista's bcdedit may not know to set VHD device value in BCD store.
Vista's driver may not provide enough information to bcdedit.
You should do it from Windows 7.

Following this tutorial, I succeeded in booting Windows 7 Ultimate from an USB partition, but failed the VHD native-boot. :clap:

Why did you say you don't have Windows 7 host ? You already have Windows 7 in USB partition. Just boot it.
Connect the disk containing VHD to the computer that Windows 7 runs in and attach VHD.
You can also create BCD store by using bcdboot command in Windows 7's system32 directory.
Read post #12-#15.

#31 edborg

edborg

    Frequent Member

  • .script developer
  • 387 posts
  •  
    Italy

Posted 03 December 2009 - 08:23 PM

Vista's bcdedit may not know to set VHD device value in BCD store.
Vista's driver may not provide enough information to bcdedit.

Thanks for this info.
Now I understand why I must use Windows 7.

Why did you say you don't have Windows 7 host ? You already have Windows 7 in USB partition. Just boot it.

As I said, my Windows 7 on USB had been personalised on a PC different from the one I was working on. :clap:

However, I subsequently went to that PC again and did exactly as you suggested.
Native VHD booting works perfectly now, thanks! :)

edborg

P.S.
Your explanation triggers a question to me.
To avoid that limitation, would it be possible to substitute bcdedit and drivers in Vista with those from Windows 7 without messing up everything?
Unfortunately I don't have a Vista installation available for testing. I borrowed the one I was working on for this project (a notebook with Vista preinstalled that I can't tamper with :cheers: )

#32 LevT

LevT
  • Members
  • 5 posts

Posted 07 December 2009 - 12:55 PM

Thanks

It looks like somewhat related to ahci is missing.


Following the original post, I got a HDD that boots up from USB while my mobo is in IDE (Enhanced) mode but fails if nothing changed but the ICH10 switched to AHCI or RAID mode.

#33 edborg

edborg

    Frequent Member

  • .script developer
  • 387 posts
  •  
    Italy

Posted 09 December 2009 - 03:56 PM

Not sure if it is the cause, but I have found USB hard drives (as against USB flash drives) tend to have a small start up time during which they may not be recognised by the BIOS, resulting in them not booting even when they are enabled in the BIOS as first boot device. This may be affected by having POST turned off, I haven't experimented.

I find that in these cases if I can get the BIOS to pause for a few seconds it will then find and boot from the hard drive. I generally achieve this by using whatever key brings up the menu to select boot order or source menu, then wait 5 seconds before selecting the external hard drive. This applies on Toshiba and HP laptops I have used.

Cheers

Great observation!!! :whistling:
This solved my problem with an Acer notebook that refused to boot from an otherwise perfectly booting Windows 7 on USB.
It kept flashing on a black screen as if it were an MBR problem, but it wasn't. :thumbup:

Strange thing is that it was booting correctly from the same USB HD with a previous installation. And that it restarted working correctly after "educating it " with the above suggested procedure :thumbup:

Thanks! :thumbsup:
edborg

#34 RobertD0275

RobertD0275

    Member

  • Members
  • 31 posts
  •  
    United States

Posted 11 December 2009 - 04:13 PM

Hey karyonix,

I have a question for you. Your tutorial was easy as pie to follow for me and everything seems to work great. I have run this on an HP nc6220, nc6400, hp 6910p, and a lenovo t400. all work great!!

Here is the question, It says that I need to activate windows (while I was logged in to a 6910p) so I did. Then when i go to another PC nc6400 or Lenovo, it says that I need to activate again!! If I boot it back on the 6910p it says that it is activated.

Is there a reason that it is doing this? And is there a patch or something around it or to make it go away? I love this setup, just what I was looking for, but it won't do me any good if I have to rebuild it every 3 days cause it locks out the other 4 controlsets that I am using.

help!!

#35 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 453 posts
  •  
    Thailand

Posted 11 December 2009 - 09:43 PM

@RobertD0275
It do that to prevent its unlicensed use.
And according to EULA, you are not permitted to bypass or circumvent activation, so talking about overcoming activation is not allowed here.

However, there is a way to backup and restore activation status on same machine when you reinstall Windows. I have not tried it yet.

#36 gtragitt

gtragitt

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 12 December 2009 - 11:14 PM

Can anybody help me troubleshoot the code for usbbootfix?

C:\Windows\system32>@echo off
[codebox]if "%1"=="fix" goto :fix rem -- install task copy /y "%~f0" "%SystemRoot%\system32\usbbootfix.bat" The system cannot find the file specified. SCHTASKS /Create /RU SYSTEM /SC ONEVENT /MO "*[System[Provider[@Name='Microsoft- Windows-UserPnp'] and EventID=20003]]" /EC System /TN USBBootFix /TR "'%SystemRo ot%\system32\usbbootfix.bat' fix" /F SUCCESS: The scheduled task "USBBootFix" has successfully been created. rem -- apply other settings reg add HKLM\SYSTEM\CurrentControlSet\services\pciide /v Start /t REG_DWORD /d 0 x0 /f The operation completed successfully. reg add HKLM\SYSTEM\CurrentControlSet\services\msahci /v Start /t REG_DWORD /d 0 x0 /f The operation completed successfully. reg add HKLM\SYSTEM\CurrentControlSet\services\intelide /v Start /t REG_DWORD /d 0x0 /f The operation completed successfully. reg add HKLM\SYSTEM\CurrentControlSet\services\viaide /v Start /t REG_DWORD /d 0 x0 /f The operation completed successfully. rem -- run :fix once after install :fix call :fixservice usbehci "Boot Bus Extender" Invalid attempt to call batch label outside of batch script. call :fixservice usbohci "Boot Bus Extender" Invalid attempt to call batch label outside of batch script. call :fixservice usbuhci "Boot Bus Extender" Invalid attempt to call batch label outside of batch script. call :fixservice usbhub "System Bus Extender" Invalid attempt to call batch label outside of batch script. call :fixservice usbstor "SCSI miniport" Invalid attempt to call batch label outside of batch script. goto :eof :fixservice setlocal set Start= set Group= for /f "skip=2 tokens=1,2,*" %%I in ('reg query HKLM\SYSTEM\CurrentControlSet\se rvices\%~1') do ( %%I was unexpected at this time. if "%%I"=="Start" set Start=%%K if "%%I"=="Group" set Group=%%K ) if not "%Start%"=="0x0" reg add HKLM\SYSTEM\CurrentControlSet\services\%~1 /v St art /t REG_DWORD /d 0x0 /f The operation completed successfully. if not "%Group%"=="%~2" reg add HKLM\SYSTEM\CurrentControlSet\services\%~1 /v Gr
oup /t REG_SZ /d "%~2" /f
The operation completed successfully.
endlocal
goto :eof[/codebox]

#37 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 453 posts
  •  
    Thailand

Posted 13 December 2009 - 03:55 AM

Don't paste batch file script into cmd window.
You should save it to a file with extension .cmd or .bat.
Then run it by right-click and select "Run as administrator" from context menu.

#38 gtragitt

gtragitt

    Newbie

  • Members
  • 16 posts
  •  
    United States

Posted 13 December 2009 - 04:31 AM

Thanks for the quick reply. It worked well. I turned off the pagefile. I assume that I won't be able to use one.

#39 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 453 posts
  •  
    Thailand

Posted 13 December 2009 - 05:53 AM

@gtragitt
Normally, Windows doesn't use pagefile in USB hard disk. It automatically creates pagefile in internal hard disk.
If you want pagefile in USB hard disk, try this thread http://www.boot-land...?showtopic=9461 .

#40 copain

copain

    Newbie

  • Members
  • 13 posts
  •  
    India

Posted 13 December 2009 - 02:50 PM

hi all plz help me
i have installed the fresh windows 7 to ide/sata hard disk and run the commands as karyonix said..later i have cloned this to my transcend usb hdd and tried to boot..the windows 7 logo appeared then it suddenly reboots...i couldnt understand whats wrong with it...
actually i started the cmd with administrator rights then copied the text part of batch file from site and pasted in the command..i hv seen that
rem -- install task
copy /y "%~f0" "%SystemRoot%\system32\usbbootfix.bat"
at this line it said that usbbootfix.bat not seen...then in the next line it said that
created the usbbootfix.bat then bla bla and continues....
should i create a batch file named usbbootfix.bat and or what i hv done is a correct way?//
plzzzz help me..

#41 was_jaclaz

was_jaclaz

    Finder

  • Advanced user
  • 7100 posts
  • Location:Gone in the mist
  •  
    Italy

Posted 13 December 2009 - 02:58 PM

then copied the text part of batch file from site and pasted in the command..i hv seen that
.....
should i create a batch file named usbbootfix.bat and or what i hv done is a correct way?//


3 (three) posts above yours:

Don't paste batch file script into cmd window.
You should save it to a file with extension .cmd or .bat.
Then run it by right-click and select "Run as administrator" from context menu.


jaclaz

#42 copain

copain

    Newbie

  • Members
  • 13 posts
  •  
    India

Posted 13 December 2009 - 03:15 PM

thnx jaclaz for such quick reply..what abt this line
bcdedit /set {default} detecthal on
should i save it as cmd or bat??
one more doubt is it a generic win7 ?will it work on any pc that can boot frm usb??

#43 RobertD0275

RobertD0275

    Member

  • Members
  • 31 posts
  •  
    United States

Posted 13 December 2009 - 05:06 PM

@RobertD0275
It do that to prevent its unlicensed use.
And according to EULA, you are not permitted to bypass or circumvent activation, so talking about overcoming activation is not allowed here.

However, there is a way to backup and restore activation status on same machine when you reinstall Windows. I have not tried it yet.

Thanks for the reply.

I was notimpling that I was looking for a crack..this info was just what i needed. I am using this for it tools on 5 PCs...they are different and I was able to activate the license on all the controlsets for each pc...so that was not my main issue...it was going to be clonaed over for the other IT guys in my area so they can use it as well..

backing up the keys worked great!! Also...I used clonezilla to clone them..it is a free tools, and as long as I did it from vmware..it works...if I tried it useing the original install method I get the 7b BSD...so no biggie..I just load up the vmware image I have , clone it...and run the backup tools...worked great..

#44 Dual Citizen

Dual Citizen
  • Members
  • 1 posts
  •  
    Canada

Posted 23 December 2009 - 09:35 PM

This has been very helpful in my understanding.

However, I am having a problem, and could use your advice. I've recently purchased an SSD Expresscard, to insert in my 3 month old HP Tablet. It has both a PCIE interface and a USB 2.0 interface. My tablet has two bootable partitions...my Windows 7 RTM (production) partition, and a Windows 7 Home Premium Gold clean install.

I have been using my production partition with Method 2 above to copy all the files from the Windows Gold partition to the SSD Expresscard. The "Compact" command returns an "access denied" error whether the Expresscard is intested in its slot, or connected via USB 2.0 cable.

Is there a workaround for this problem?

Thanks in advance.

#45 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 453 posts
  •  
    Thailand

Posted 24 December 2009 - 05:43 AM

That command is there just to make sure bootmgr file is not compressed in compressed NTFS partition.
If bootmgr is not compressed, don't worry about it.
If it is compressed, I am not sure it can be loaded by bootsector or not. You can try if you want.
You can also uncompress it from Windows Explorer, open bootmgr file's context menu, select Properties, Advanced..., uncheck Compress contents to save disk space.

#46 Loralon

Loralon
  • Members
  • 9 posts
  •  
    United States

Posted 31 December 2009 - 04:11 PM

Hi karyonix,

On the following post, I have a question. What's the proper way to go if one forgets and reboots the pc after windows update for step 8: Install in IDE/SATA disk and move to USB
8. 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.


I am now getting BSOD with windows 7 64-bit after an update and even last known good config is not helping.

Thanks

#47 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 453 posts
  •  
    Thailand

Posted 31 December 2009 - 05:15 PM

It seems my usbbootfix.bat is not good enough.

Use regedit (run as administrator) from other installed Windows.
Or boot Windows 7 DVD and press Shift+F10 to open cmd then type regedit.
Select HKEY_LOCAL_MACHINE
Click menu File, Load Hive...
Select (your USB drive)\Windows\system32\config\system file and Open it.
Give it a name sys.
Browse to HKEY_LOCAL_MACHINE\sys\ControlSetxxx\services\usbehci. Make sure its Start value is 0.
Do the same for usbohci, usbuhci, usbhub, usbstor in all ControlSet*\services key.
Select HKEY_LOCAL_MACHINE\sys
Click menu File, Unload Hive...

#48 Loralon

Loralon
  • Members
  • 9 posts
  •  
    United States

Posted 01 January 2010 - 09:33 AM

Hi karyonix,

The below command worked perfectly for me, I hope it will also be useful to other people.

Thanks

#49 Loralon

Loralon
  • Members
  • 9 posts
  •  
    United States

Posted 02 January 2010 - 10:35 AM

Hi karyonix,

Now I have a question regarding something weird that happened to one of my external drive. After having my windows 7 up and running with pagefile with diskmod 0.0.2.2, I wanted to get some files from my second external usb hdd but the windows driver installation failed and the disk is not recognized by windows. In disk management window, I can see the disk but when trying to initialize it, windows reports disk not ready.

I have also tried to get it to work in windows xp but no luck so far. Is there a way to get this disk working again? I am suspecting diskmod to have something to do with this behavior.

Thanks in advance for your help.

#50 karyonix

karyonix

    Frequent Member

  • Advanced user
  • 453 posts
  •  
    Thailand

Posted 02 January 2010 - 01:24 PM

It is also possible that this problem arise from inadequate electrical power on USB ports.
When you run OS from internal harddisk, without diskmod, can you use 2 USB external hard disks connected to this computer at the same time ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users