14 August 2012

How to install and run a full winxp on usb disk

Winxp is really a good member of windows family. It is maybe the most common version of windows has ever used until now. This post will show you how to put a full winxp on usb disk to use it anywhere.

Requirement :

  • Ability to use some VirtualMachine Management like VirtualBox, VMware, ... 
  • Good knowledge at using Winxp. 

Terminology :

  • Vhd file : It looks like an image of a disk (and partitions) inside. 
  • WinVBlock : Virtual scsi driver for Winxp to mount vhd disk image. 
  • NTloader : Boot loader of Windows works with ntldr file. 
  • Grub4Dos : Boot loader used to map vhd disk image file. 

Primary steps :

  1. Create .vhd disk image includes a running Winxp (with WinVblock driver installed). 
  2. Make USB disk bootable with NTloader and Grub4Dos. 
  3. Boot the image by Grub4Dos. 

Steps in detail :

1. Create .vhd disk image includes Winxp (with WinVblock driver installed)

1.1 Create New Machine :

In this post we will use VirtualBox to make an Winxp virtual machine with vhd disk image (fixed-size harddisk) (2GB for example) in vhd format. Notice to use fixed-size hard disk, otherwise Grub4Dos won't work !

 

Point the CDROM drive to an Winxp installation disc (.iso), and install it as usual till it finishes.


1.2 Disable Page File :

By default Winxp uses a page-file (double RAM size) on the C: drive, it takes alot of disk space. We don't need it, so we will remove it, and a full Winxp will takes about 900MB in size.


1.3 Config the Winxp driver to make it works on all machine :

Because our Winxp will run on USB disk, we need to make it able to run on all of different machine without depend on the driver (independent with driver) by making some devices using Standard Driver.

Open the Device Manger and update : IDE ATA/ATAPI Controllers and System Devices to use
Standard driver. In this case, they should use :
  • IDE ATA/ATAPI Controller :
    • Standard Dual Channel PCI IDE Controller. 
  • System Devices : 
    • PCI bus. 
    • PCI standard host CPU bridge. 
    • PCI standard ISA bridge. 


Reboot the virtual machine if necessary, and you should have a status like this after all :

1.4 Install WinVblock driver :

Google and download the WinVblock driver (or you can download a copy here : https://drive.google.com/file/d/0B3OvTrPZEcO9MTZzVGxVekpqR00/edit?usp=sharing), unzip it. Open Control Panel / Add Hardware. Follow the Wizard and point it to the WinVblock driver folder.

After reboot the Winxp vitual machine, It should have 2 more scsi devices like this.


1.5 Defragment the C drive :

In order to boot with Grub4Dos (map to file), the image file need to be in contiguous disk area.
Just have a check if the C: drive has been fragmented ? If does, open the My Computer, right click on C: drive / Properties / Tools / Defragment Now ...


1.6 Locate the vhd file :

Until now, you should have a running Winxp virtual machine includes :
  • WinVBlock driver. 
  • Some devices with Standard driver (IDE controller and system devices) 
  • C: drive not fragmented. 
Shutdown the virtual machine and locate for the .vhd file (check the Preferences of VirtualBox to find out the default location).

  

71 comments:

  1. Hey! I've tried this, and I can successfully boot into Grub. However, when I try to boot into the VHD, I get some error (before it can boot Windows), and it goes right back to the Grub Menu!!??

    Any solution to this?

    ReplyDelete
    Replies
    1. Hi,

      Could you show more detail about the error ? Text screen or screenshot is ok.

      Delete
  2. I've updated the post with a video show the boot process. Let's have a check on it. :)

    ReplyDelete
  3. Hi! when i type the map (hd0,0)/winxpfull.vhd (hd0)
    i got an error 26: Selected disk does not exist
    sorry im newbie can you help me. tnx in advance.

    ReplyDelete
  4. Grub4dos see first harddisk as hd0, second disk as hd1 and so on. Perhap your usb disk was map as the second disk.

    You can try (hd1,0) or type "(hd" then tab to list all of disk reconigze by grub4dos.

    Read more here : http://diddy.boot-land.net/grub4dos/files/syntax.htm

    ReplyDelete
    Replies
    1. tnx it works.

      but it hangs on windows logo screen and i didnt put in a new machine.
      i also tried to change my bios setup usb legacy mode.
      i am using 8Gb Kingston Flash Drive.

      Delete
    2. Try :
      _ Add /sos to boot.ini to show more debug info.
      _ Change BIOS usb setting to HighSpeed to get more usb speed.
      _ Change BIOS SATA/AHCI/IDE to Legacy/Compactible mode.

      Delete
  5. I don't see why the defrag is required? The vhd file ON THE USB DRIVE needs to be contiguous, but the contents inside the vhd file don't need to be. If you get a 'file is not contiguous' error fron grub4dos then that is because the vhd file itself is fragmented when you copied it to the USb drive. Running WinContig on the VHD file will fix it (if there is enough spare space on the USB drive for WinContig to work).

    ReplyDelete
    Replies
    1. After using winContig to defrag VHD file, I still get Error 60.

      "Error 60: File for drive emulation must be in one contiguous disk area"

      Any solution for this?
      Thank You!

      Delete
    2. Try the way mention in the post. Other way is defrag the whole usb disk before booting.
      Cheers.

      Delete
  6. Very helpful comment.
    Thanks Steve.

    ReplyDelete
  7. With the grub loading. What is going wrong if you get an Error 17 message. Its that it cant be loaded.

    ReplyDelete
    Replies
    1. Error 17 means that grub can not read the partition/disk filesystem to locate the image file.
      Well, it looks like that the partition order and filesystem on the usb disk is quite not right.
      Try to delete and recreate/format the usb disk partition.

      Cheer.

      Delete
    2. After trying your solution, I formatted the drive, ntfs quick. Then I used the bootsect.exe to make the device bootable again. Then moved all the required files back and the map(hd0,0)/winxpfull.vhd (hd0) works
      map --hook works
      chainloader (hd0,0)/ntldr I get error 17 and then when I try it again the first line starts to give me the same Error. I restart then it fails the first time on chainloader.

      Delete
    3. Well. It looks like that grub can not read for ntldr. This can be :
      + Device mapper has something wrong, your usb is not mapped as hd0. You can try (hd1,0) or type "(hd" then tab to list all of disk reconigze by grub4dos). You also can try the command "find --set-root --ignore-floppies /ntldr" for looking for ntdr file.
      + Have a check that the file ntldr has been NTFS compressed ? If was, decompress it.

      Good luck.

      Delete
    4. The VHD image needs to be formated as FAT32 not NTFS that could be your problem.

      Delete
    5. I just posted on the second page regarding an unknown file system error from GRUB, and I suspect this is the issue right here. This would have been very helpful to know before spending several hours building the OS and updating in a VM! It might be a good idea to add this little detail to your guide..?

      Delete
    6. Getting Error: 17 Cannot mount selected partition. and Warning: Total_Sectors calculated from partition table is greater then the number of sectors in the while disk image.

      Are you kidding? the file has to be Fat32? Put it in the guide asap please! 5 hours wasted

      Delete
  8. I have gotten as far as the Windows XP loading screen-but nothing happens, the blue bar just keeps on sliding across the screen. The light on my drive is not blinking to show it being read.

    When I try booting into safe mode, it goes along and gets stuck at mup.sys. Any ideas?

    ReplyDelete
    Replies
    1. Hi. Maybe you are in some known issues. Try these :

      _ Add /sos to boot.ini to show more debug info.
      _ Change BIOS usb setting to HighSpeed to get more usb speed.
      _ Change BIOS SATA/AHCI/IDE to Legacy/Compactible mode.

      Delete
    2. Also present to you a new way : http://www.linuxbyexamples.net/2012/09/yet-another-way-to-make-winxp-lite-and-run-on-usb-by-using-embedded-studio.html

      Cheers.

      Delete
    3. I have the same problem with Win XP Home SP3. On 3 completely different PCs. :(

      Delete
    4. same here
      in bios there is no Legacy/Compactible mode and adding /sos to boot.ini only results blue windows screen with windows version

      Delete
    5. What model of you motherboard ?

      Delete
  9. Hi, I have one question, in the step --> 2.2 Make the USB disk bootable, I've been able to accomplish all instructions, but I'm stuck in this part:

    "Let's restart the PC and boot from USB disk. The NTloader will load Grub4Dos according to the boot.ini file."

    What are the right settings for VirtualBox to be able and boot from the USB stick, or do you have any special arrangement in your settings that I can't see? I'm a newbie and I'd appreciate any info.

    I'm trying with a Kingston USB stick, by the way.

    Thanks.

    Jimmy O.

    ReplyDelete
    Replies
    1. Let's restart the PC -> I mean the real PC, not virtualbox. When the usb is ready. Plug it to a real PC, change BIOS setting to boot from it.

      Good luck to you.
      Cheers.

      Delete
  10. i get this error i took a pic of it. https://www.dropbox.com/s/gupaz912ymrveca/20121026_133437.jpg
    can someone help me with this.

    ReplyDelete
  11. i got error ERROR 17 :
    warning :total_sectors calculated from partition table (16450560) is greater than the number sectors in the whole disk image (4194305)


    How can I solve this error sir ?

    ReplyDelete
    Replies
    1. i got Error 13 : Invalid or unsupported executable format
      after menu.lst processed in line -> chainloader (hd0, 0) /ntldr

      Any idea to solve this sir ?

      Delete
  12. are changes saved with this setup?

    ReplyDelete
  13. When I install winvblock the second device has an exclamation point and when I finish the tutorial I get a BSOD with 0x0000007B error.

    ReplyDelete
  14. I am getting Error 17 after "map --hook" this command seems to be dismounting the partition. Any ideas?

    ReplyDelete
  15. After I do all this I get the Windows XP logo and a blue screen and reboots immediately without leting me see what it is. Any ideas? I tried in 2 different machines.

    ReplyDelete
    Replies
    1. Put /sos to boot.ini file and turn on Crash Dump Screen : Right-click Mycomputer / Properties / Advanced / Startup and Recovery / Setting / Uncheck Automatically restart.

      Reboot the machine.

      Delete
  16. could u plz tell me how to install winvblock driver and update driver for IDE ATA/ATAPI Controller ?

    ReplyDelete
  17. I also get to that Windows Logo,... but when it's time to show welcome screen, it just reboots the pc. I believe it's the winvblock driver.
    Can someone please post a good working link for winvblock. The installation of the one i downloaded goes fine, and when rebooted windows xp detects new hardware and adds winvblock driver again. The tut is clear about 2 scsci adapters being added, but when i look in device manager, the second winvblock driver has that yellow warning icon... I deleted the second one and tried booting with that, but i get the same result...

    ReplyDelete
    Replies
    1. Post your request to http://reboot.pro and you'll see.

      Delete
    2. Thank you Atrus.... I'll do that...

      Delete
  18. Has anyone been able to get this to work?
    I get that same windows logo screen with knight Rider light (Blue not red) and the system hangs... This tut looks so usefull to me... but i spent 3 days on it... create almost 8 vhd different sizes, but couldn't get it to work... I gues i'll try another tut...

    ReplyDelete
    Replies
    1. I suggest you to enable debug mode : /sos in boot.ini and enable windows crash dump to see what did happened to your stuff.

      Delete
    2. Yes, I get...But in menu.lst is written:

      title --- Boot WinXP-Embedded from VHD
      find --set-root --ignore-floppies /XP-Em.vhd
      map /XP-Em.vhd (hd0,0)
      map --rd-size=2048
      map --mem (rd)+4 (0x55)
      map --hook
      write (0x55) #GRUB4DOS\x00v=1\x00XP-Em.vhd\x00\x80\x00
      root (hd0,0)
      chainloader /ntldr
      boot

      Delete
    3. Too complex. Why should you try the menu.lst as in this post I did mention.

      Delete
    4. Finally got it to work! :) ... Hang at windows logo solved by using USB_XP_Fix.exe (I Downloaded the whole Img_XP package from http://www.mediafire.com/download.php?sp3n96zzemk3bca and Installed mabebt/imdiskinst.exe first as a requirement)

      run USB_XP_FIX.EXE, and select the vhd drive on the USB flash drive, created using this tutorial and click go... after process is complete, it works like a charm...

      Thank you for this great Tut... and I hope this can be of help to others...

      Delete
    5. Hello Deepak, Atrus, Can you please be more detailed? My XP still stucks at the Loading screen (with Logo).

      Delete
    6. Quỳnh đọc kỹ bài viết và các comment bên dưới là được.

      Atrus.

      Delete
    7. I also got it work following Tut and Deepak Solution. You should go to this page:
      http://www.911cd.net/forums//index.php?showtopic=23553&st=40
      and download Img_XP. This is an .exe file which once you run it it will extract to a location you pick on your computer. (These are done on the host computer not the image you have made.)
      Then you need to go to the extracted folder and on the main folder run imdiskinst.exe. Then run USB_XP_FIX.EXE and pick the vhd file from your USB and hit GO. Then restart and the windows will boot.

      Delete
    8. Hey I got the infinite load screen as well then applied the USB_XP_FIX.exe to the image file but once I tried that when windows started to boot (before load screen) I got the following:

      Windows could not start because the following file is missing or corrupt:

      \WINDOWS\SYSTEM32\CONFIG\SYSTEM

      any ideas?

      Delete
  19. But is it possible otherwise: Boot Linux from VHD-file? That is, not install Linux on real HDD?

    ReplyDelete
    Replies
    1. I think it's possible. That is the way hypervisor (virtualbox|vmware) does. It's another story.

      Delete
  20. " hypervisor (virtualbox|vmware) does" Yes, Iknow that. But I think so: create VHD with Linux into; then write it on HDD and boot with grub as my OS. Is it possible? Boot only Linux from VHD without any virtual mashines - the same, as XP?

    ReplyDelete
    Replies
    1. You have to check if the linux kernel can r/w to vhd file. If not, you will need a driver as winvblock for winxp.

      Delete
  21. Thanks; very good BUT..
    Does exists any easy way for use this steps on external hard drives or "CF (CompactFlash as a hard drive)"??
    I get this message after any boot: "Disk error .. Press any key to restart".

    ReplyDelete
  22. i know this topic is aging, but in theory this could work on an internal HD and if windows gets screwed up you just replace the VHD image.

    Is this a possibility that could work?

    reason i ask i have hotel computers that have to be reloaded every time a customer gets on them and decide they want to down load 20 tool bars and all the malware/spyware available. i could see this saving hours of reload down to 10min of just copying a copy of the VHD from the thumb drive to the HD. this would even be faster then a system restore/reload from a restore partition.

    Randy

    ReplyDelete
    Replies
    1. There're a lot of solution for this :
      + Ghost
      + DeepFreeze
      + Boot Winxp from http server : http://www.linuxbyexamples.net/2012/08/boot-winxp-from-http-server.html

      Delete
    2. While the the first two are good options they do cost and as an individual not associated with anybody else that eats in to my personal profits

      and HTTP load is not an option as i don't have a spare computer to setup PXE DHCP boot server, or a HTTP boot server.

      Everything you have used here is open source GPL(exp Win XP of course).

      this is something worth trying(for me at least) on an internal HD hooked up to the HD controler rather then through USB.i was just wondering if this could work that way. back in the old dos days there were drive emulation programs like drive staker that made your HD look like it was twice the size. but in reality it was a big compressed file. back you that file and you had the whole system to replace later. with that in mind and what i've read here the concept is the same. however you've made it and i was just wondering if before i start doing it is if i'm going to be wasting my time.

      i just don't wanna spend time reinventing the wheel if the axle won't fit

      Randy

      Delete
  23. Wheel works, after following the guide i removed the hard drive from USB hooked up to the internal IDE controller and computer booted fine, loaded a some junk apps, used a PE boot CD to copy over existing VHD with fresh, from cd boot to copy over fresh VHD and reboot less then 10 min.

    ReplyDelete
  24. Hi, I have some trouble with booting from USB, There was nothing appeared on the screen. However in VirtualBox, it says something about UNMOUNTABLE_BOOT_VOLUME, and the error 0x000000ED... Any help?

    ReplyDelete
  25. Hey I have tried it but I got error 15 can anybody help me out ...

    ReplyDelete
  26. map --hook
    chainloader (hd0,0)ntdlr
    boot


    error8: kernel must be loaded before booting

    any idea how to fix this? thanks in advance

    ReplyDelete
    Replies
    1. 2 typing errors: missing a "/" and switched "ld" as "dl" in ntldr?
      chainloader (hd0,0)ntdlr instead of
      chainloader (hd0,0)/ntldr

      Delete
  27. Almost gave up on this, but as a few have mentioned, a combination of this TUT and the Img_XP gave me a solution. Follow this tut word for word, then use the further stages of the IMG_XP tut on 911, USB_XP_Fix.exe and later, specifically, I found that did the job.
    I made sure Virtualbox was able to boot the VM (vhd) as an IDE attachment and as a SATA, to save some time. I now have an external SSD (its own BCD helped by EasyBCD) with XP, Windows7, Windows 8 all booting as VHDs (7 & 8 as offered by microsofts solution)and various linux persistent distros, folder based, all booting from and running from the external usb connection, and being SSD, speed is great.
    I have noticed on a newer HP laptop the XP won't boot, am looking as to why and will update this....so great Tutorials both of these and all others involved...what next??

    ReplyDelete
  28. I now have a new problem, after realising I needed to have the VXD image as FAT32 and not NTFS I get Error 15 File cannot be found. If I got command prompt I can ls and see the file and I've double checked the spelling it all good. Is this case sensitive, or all lowercase ?

    ReplyDelete
  29. If I install win xp on my usb pen with this method, will I be able to run games and programs that are installed on my win 7 on the hard drive?

    ReplyDelete
    Replies
    1. The best way to know is having a try. Good luck with that !

      Delete